0% found this document useful (0 votes)
57 views10 pages

Unit V Image Restoration: Restoration Function H Degradation Function H

The document discusses image restoration and degradation. It describes how images can be degraded by noise and other factors, and restoration techniques aim to recover the original image by modeling the degradation process and applying the inverse. It then provides examples of different types of noise that can degrade images, such as Gaussian, salt and pepper, and speckle noise, and how they can be modeled and added to images using imnoise functions. It also discusses geometric transformations that can modify pixel relationships in images and techniques for image registration.

Uploaded by

Sakshi Hulgunde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views10 pages

Unit V Image Restoration: Restoration Function H Degradation Function H

The document discusses image restoration and degradation. It describes how images can be degraded by noise and other factors, and restoration techniques aim to recover the original image by modeling the degradation process and applying the inverse. It then provides examples of different types of noise that can degrade images, such as Gaussian, salt and pepper, and speckle noise, and how they can be modeled and added to images using imnoise functions. It also discusses geometric transformations that can modify pixel relationships in images and techniques for image registration.

Uploaded by

Sakshi Hulgunde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Unit V

Image Restoration

The objective of restoration process is to improve a given image in some predefined


sense. Restoration attempts to reconstruct or recover an image that has been degraded by
usingdegradation phenomenon. Thus restoration techniques are oriented towards modeling
the degradation and applyingthe inverse process to recover the original image.

A model of image degradational restoration process

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

Fig: A model of image degradation and restoration process

The above process can be represented in mathematical form as:

g(x,y)=H[f(x,y)]+n(x,y)

Where, f(x,y) is an input image, H is degradation function and n(x,y) is an additional


noise.

PREPARED BY: MS. SHAIKH TAYYABA M. 1 | 10


We can represent this process in spatial domain as:

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.

The objective of restoration is to obtain an estimate f(x,y) of original image. As we want


estimate to be as close as possible to the original image.

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.

Followings are the different noise models supported by MatLab-

1. Gaussian Noise

The syntax of Gaussian noise model is:


g=imnoise(f, 'gaussian',m,var);
It adds Gaussian noise of mean m and variance var to image f. The default value for mean
is 0 and var is 0.01.

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)')

PREPARED BY: MS. SHAIKH TAYYABA M. 2 | 10


Output-

2. Localvar Noise

The syntax of Localvar noise model is:

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)')

PREPARED BY: MS. SHAIKH TAYYABA M. 3 | 10


Output-

3. Salt & Pepper Noise

The syntax of Salt & Pepper noise model is:

g=imnoise(f, 'salt & pepper',d);

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)')

PREPARED BY: MS. SHAIKH TAYYABA M. 4 | 10


Output-

4. Speckle Noise

The syntax of Speckle noise model is:

g=imnoise(f, 'speckle',var);

It adds multiplicative noise to image f, using the equation g=f+n*f.

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)')

PREPARED BY: MS. SHAIKH TAYYABA M. 5 | 10


Output-

5. Poisson Noise

The syntax of Poisson noise model is:

g=imnoise(f, 'poisson');

It generates poisson noise from the data instead of adding artificial noise to the image.

Example

>> %Poisson Noise Model


>> f=imread('rice.png');
>> g=imnoise(f,'poisson');
>> h=medfilt2(g,[7 7]);
>> 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)')

PREPARED BY: MS. SHAIKH TAYYABA M. 6 | 10


Output-

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.

Geometric Spatial Transformation

Suppose that an image f, defined over an(x,y) co-ordinate system undergoesgeometric


transformation to produce an image g, defined over an (w,z) co-ordinate system.

This transformation may be expressed as:


(w,z)=T{(x,y)}
One of the most commonly used forms of spatial transformation is the ‘affine transform’.
Affine transformation can scale, rotate, translate or shear a set of points depending on the
values chosen for the elements of T.

PREPARED BY: MS. SHAIKH TAYYABA M. 7 | 10


The following table shows how to choose values of elements to achieve different
transformations.

Sr. No. Type Affine Matrix Co-ordinate Equation


1. Identity
1 0 0 x=w
0 1 0 y=z
0 0 1
2. Scaling
Sx 0 0 x=Sxw
0 Sy 0 y=Syz
0 0 1
3. Rotation x=wcosθ-zsinθ
cosθ sinθ 0 y=wsinθ+zcosθ
-sinθ cosθ 0
0 0 1
4. Shear
(Horizontal) 1 0 0 x=w+αz
α 1 0 y=z
0 0 1

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

1. Identity type of Affine Transformation


>> f=imread('rice.png');
>> T=[1 0 0;0 1 0;0 0 1];
>> tform=maketform('affine',T);
>>g=imtransform(f,tform);
>> imshow(f),figure,imshow(g)

PREPARED BY: MS. SHAIKH TAYYABA M. 8 | 10


2. Scaling type of Affine Transformation
>> f=imread('rice.png');
>> T=[30 0 0;0 30 0;0 0 1];
>> tform=maketform('affine',T);
>>g=imtransform(f,tform);
>> imshow(f),figure,imshow(g)

3. Rotation type of Affine Transformation


>> f=imread('rice.png');
>> th=pi/6;
>> T=[cos(th) sin(th) 0;-sin(th) cos(th) 0;0 0 1];
>> tform=maketform('affine',T);
>>g=imtransform(f,tform);
>> imshow(f),figure,imshow(g)

4. Shear(Horizontal) type of Affine Transformation


>> f=imread('rice.png');
>> T=[1 0 0;0.8 1 0;0 0 1];
>> tform=maketform('affine',T);
>>g=imtransform(f,tform);
>> imshow(f),figure,imshow(g)

5. Shear(Verticle) type of Affine Transformation


>> f=imread('rice.png');
>> T=[1 0.9 0;0 1 0;0 0 1];
>> tform=maketform('affine',T);
>>g=imtransform(f,tform);
>> imshow(f),figure,imshow(g)

6. Translation type of Affine Transformation


>> f=imread('rice.png');
>> T=[1 0 0;0 1 0;8 8 1];
>> tform=maketform('affine',T);
>>g=imtransform(f,tform);
>> imshow(f),figure,imshow(g)

PREPARED BY: MS. SHAIKH TAYYABA M. 9 | 10


Image Registration

Geometric transformations are used frequently to perform image registration. This


process takes two images of the same scene and aligns them so they can be merged for
visualization or for quantitative comparison.

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).

Then the commands are needed to align image g to image f as follows:

>> 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)

PREPARED BY: MS. SHAIKH TAYYABA M. 10 | 10

You might also like