Unit V Image Restoration: Restoration Function H Degradation Function H
Unit V Image Restoration: Restoration Function H Degradation Function H
Image Restoration
The following figure shows a model of image degradation and restoration process-
Degradation Restoration
f(x,y) f(x,y)
function H function H
Noise n(x,y)
Degradation Restoration
g(x,y)=H[f(x,y)]+n(x,y)
g(x,y)=[h(x,y)*f(x,y)]+n(x,y)
Where, h(x,y) is the spatial representation of the degradation function and ‘*’ indicates
convolution.
Noise Models
The toolbox uses function imnoise() to corrupt an image with noise. This function
has the basic syntax as below:
g=imnoise(f,type,parameters);
Where, f is the input image and type specifies the type of noise which we are adding into
the image and parameters are the parameters of respective noise model.
The function imnoise converts the input image to class double in the range[0,1] before
adding noise to it.
1. Gaussian Noise
Example
>> %Gaussian Noise Model
>> f=imread('rice.png');
>> g=imnoise(f,'gaussian');
>> h=medfilt2(g);
>> subplot(1,3,1),imshow(f),title('Input Image')
>> subplot(1,3,2),imshow(g),title('Image with noise')
>> subplot(1,3,3),imshow(h),title('medfilt2(g)')
2. Localvar Noise
g=imnoise(f, 'localvar',v);
It adds zero mean m and v is an array of same size as f containing desired variance values
at each point.
Example
>> %Localvar Noise Model
>> f=imread('rice.png');
>> v=ones(256)/25;
>> g=imnoise(f,'localvar',v);
>> h=medfilt2(g);
>> subplot(1,3,1),imshow(f),title('Input Image')
>> subplot(1,3,2),imshow(g),title('imnoise(f)')
>> subplot(1,3,3),imshow(h),title('medfilt2(g)')
It corrupts the image f with Salt & Pepper noise, where d is the noise density that is the
percentage of the image area containing noise values. The default value of noise density
is 0.05.
Example
>> %salt & pepper Noise Model
>> f=imread('rice.png');
>> g=imnoise(f, 'salt & pepper',0.07);
>> h=medfilt2(g);
>> subplot(1,3,1),imshow(f),title('Input Image')
>> subplot(1,3,2),imshow(g),title('imnoise(f)')
>> subplot(1,3,3),imshow(h),title('medfilt2(g)')
4. Speckle Noise
g=imnoise(f, 'speckle',var);
Where, n is the uniformly distributed random noise with mean 0 and variance var. The
default value for var is 0.04.
Example
>> %Speckle Noise Model
>> f=imread('rice.png');
>> g=imnoise(f,'speckle',0.06);
>> h=medfilt2(g);
>> subplot(1,3,1),imshow(f),title('Input Image')
>> subplot(1,3,2),imshow(g),title('imnoise(f)')
>> subplot(1,3,3),imshow(h),title('medfilt2(g)')
5. Poisson Noise
g=imnoise(f, 'poisson');
It generates poisson noise from the data instead of adding artificial noise to the image.
Example
Geometric Transformation
Geometric Transformation modify the spatial relationship between pixels in an
image. They are often called rubber-sheet transformation because they may be viewed as
printing an image on a sheet of rubber and then stretching this sheet according to a
predefined set of rules.
5. Shear
(Vertital) 1 ß 0 x=w
0 1 0 y=ßw+z
0 0 1
6. Translation
1 0 0 x=w+δx
0 1 0 y=z+δy
δx δy 1
Examples
For example you may require aligning two or more images taken at roughly the same time
but using different instruments such as MRI (Magnetic Resonance Images) scan orany other
sensors.
While the images taken at different times using the same instrument such as satellite images
of a given location taken several days, months etc.
In either case combining the images or performing quantitative analysis requires to remove
geometric differences that may be caused by differences in the camera angle, distance and
orientation or any other factor.
The toolbox supports image registration based on the use of control points, which aresubset
of pixels whose locations in the two images can be selected.
Once a sufficient number of control points have been chosen, IPT function cp2tform() can
be used to fit a specified type of spatial transformation to the control points.
Example
Let, f denotes an image and g denote an unaligned image. The control point co-ordinates in
f are :( 83, 81), (450,56),(43,293),(249,392) and (436,442).
The corresponding control point locations in g are: (668,666),(375,47),(42,286),(275,434)
and (523,532).
>> f=imread('westconcordorthophoto.png');
>> g=imread('westconcordaerial.png');
>> imshow(f)
>> basepoints=[83 81;450 56;43 293;249 392; 436 442];
>> inputpoints=[668 666;375 47;42 286;275 434; 523 532];
>> tform=cp2tform(inputpoints , basepoints ,'projective');
>> gp=imtransform(g,tform);
>> imshow(f),figure,imshow(g),figure,imshow(gp)