Morphology Restoration

41
Morphological image processing Image Restoration SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration Nishil. B. S. Nisha J. S. Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing

Transcript of Morphology Restoration

Page 1: Morphology Restoration

Morphological image processingImage Restoration

SPEECH AND IMAGE PROCESSING LABMorphological image processing &

Image restoration

Nishil. B. S.Nisha J. S.

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 2: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Morphological image processing

What is morphological image processing ?

A broad set of image processing operations thatprocess images based on shapes

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 3: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Morphological image processing

Applications of Morphological image processingExtraction of image components

eg. Boundaries, skeletons etc.

Geometric measurementseg. Object location, orientation ,area ,perimeter

Morphological smoothing

To compute the morphological gradient of an image

To compensate uneven background illumination

Granulometry

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 4: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Morphological image processing

Value of each pixel in the output image is based on the neighbouringpixels in the input image

Morphological operations require an image and a structuring element

Size and shape of the neighbours depends on the structuring element

Basic morphological operationsErosion

Dilation

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 5: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Structuring element

Matrix consisting of only 0’s and 1’s

Can have any arbitrary shape and size

Pixels with values of 1 define the neighborhood

Origin of structuring element identifies the pixel of interest

Matlab syntax

strel(shape, parameters)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 6: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Dilation

Grows or thickens objects in a binary image

Manner and extent of thickening controlled by the structuringelement

Rule for dilation

The value of the output pixel is the maximum value of all the pixels inthe input pixel’s neighborhood

Matlab syntax

imdilate(original image, structuring element)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 7: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of dilation of binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 8: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of dilation of greyscale image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 9: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Erosion

Shrinks or thins objects in a binary image

Manner and extent of shrinking controlled by the structuring element

Rule for erosion

The value of the output pixel is the minimum value of all the pixels in theinput pixel’s neighborhood

Matlab syntax

imerode(original image, structuring element)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 10: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of erosion of binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 11: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Morphological Opening

Erosion followed by dilation

Smoothens object contours

Breaks thin connections between objects

Removes thin protrusions

matlab syntax

imopen(original image, structuring element)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 12: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of opening a binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 13: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of opening a binary image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 14: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Morphological Closing

Dilation followed by erosion

Joins narrow breaks

Fills long thin gulfs

Fills holes smaller than the structuring element

matlab syntax

imclose(original image, structuring element)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 15: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of closing a binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 16: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Hit or Miss Transformation

Used to identify specified configurations of pixels

Steps involved in Hit or Miss Transformation

1 Input image is eroded with a structuring element B1

2 Complement of input image is the eroded using a structuringelement B2

3 Logical AND operation is performed on images obtained from step 1and 2

4 Output image consists of 1 in all locations that match the pixels inB1

matlab syntax

bwhitmiss(original image, B1, B2)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 17: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of Hit or Miss Transformation of a binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 18: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of Hit or Miss Transformation of a binary image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 19: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Skeletonization

Skeletonization

Reduce all objects in an image to lines without changing theessential structure of the image

matlab syntax

bwmorph(original image, ‘skel’, inf)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 20: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of Skeletonization of a binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 21: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Perimeter Determination

Determines the perimeter pixels of the objects in a binary image

A pixel is considered a perimeter pixel if it satisfies both of thesecriteria:

The pixel is onOne (or more) of the pixels in its neighborhood is off

matlab syntax

bwperim(image)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 22: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of Perimeterisation of a binary image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 23: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Labeling Connected Components

Method to identify objects in a binary image

Pixels in each different object are assigned a unique integer

Type of the chosen connectivity affects the number of objects foundin an image

Definition of object

Set of pixels in a binary image that form a connected group is called anobject or a connected component

matlab syntax

[L num] = bwlabel(image,connectivity)

L = label matrix

num = total number of objects

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 24: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Labeling Connected Components

Pixel Connectivity

Connectivity defines which pixels are connected to other pixels

Standard 2D connectivities are :

4-connected8-connected

Custom connectivities can also be specified

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 25: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of Labeling of a binary image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 26: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Morpholgical Reconstruction

Repeated dilations of an imageMorphological transformation involving two images and a structuringelementOne image, the marker is the starting point of transformationOther image, the mask constrains the transformation

Morpholgical Reconstruction Algorithm

Initialize h1 to be the marker image

Create the structuring element: B = ones(3)

Repeat:

hk+1 = (hkdilationB) ∩mask

until hk+1 = hk .

matlab syntax

imreconstruct(marker, mask)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 27: Morphology Restoration

Morphological image processingImage Restoration

Morphological image processingStructuring elementMorhological operations

Illustration of Morpholgical Reconstruction

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 28: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Image Restoration

Image RestorationRecovering the desired or perfect image from a degradedversion.

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 29: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Image degradation

causes of Image degradation1 degradation due to sensor noise

2 Blur due to camera misfocus

3 Degradation due to camera motion

4 Degradation due to random atmospheric turbulence

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 30: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Degradation model

Degradation function together with an additive noise term operates on aninput image to produce degraded image

g(x , y) = h(x , y) ∗ f (x , y) + η(x , y)

f(x,y) Original true imageh(x,y) Degradation function, also called PSF(Point Spread Function)η(x , y) Additive noiseg(x,y) Degraded image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 31: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Degradation model cont..

Figure: Degradation model

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 32: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Image blurring

A form of bandwidth reduction of the image due to imperfect imageformation process

Caused by relative motion between the camera and the originalscene, or by optical system, which is out of focus

PSF of motion blur is characterized by two parameters namely, blurdirection and blur length

matlab syntax

fspecial(’motion’, blur length, blur angle)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 33: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Example of blurred image

Figure: Original and blurred image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 34: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Image restoration techniques

1 Inverse filtering

2 Wiener filtering

3 Lucy Richardson Algorithm

4 Blind deconvolution

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 35: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Inverse Filtering

This is a very basic restoration filter

Restoration is done using the inverse of degradation function

F̂ (x , y) =G (u, v)

H(u, v)

This filter generally gives poor results

matlab syntax

deconvwnr(degraded image, PSF)

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 36: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Wiener Filtering

Used for restoring images in the presence of blur as well as noise

Seeks an estimate f̂ that minimises the statistical error function

e2 = E (f − f̂ )2

Wiener filter function is given by :

F̂ (x , y) = G (u, v)

[|H(u, v)|2

H(u, v) |H(u, v)|2 + Sn(u, v)/Sf (u, v)

]

Sn= noise power spectrumSf = power spectrum of undegraded image

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 37: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

wiener filtering

features

This filter gives descent results

It is quite fast

matlab syntax

deconvwnr(degraded image, psf,nspr)nspr = Noise to signal power ratio

deconwnr(degraded image,psf, nacorr, facorr)nacorr = Noise autocorrrelation functionfacorr= Undegraded image autocorrelation function

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 38: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Lucy - Richardson Algorithm

Iterative non-linear image restoration technique

Used when only the PSF is known

This algorithm maximises the liklihood function

Features

Reduce the effect of noise amplification

Accounts for nonuniform image quality

Reduces Camera read-out noise

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 39: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

matlab syntax

deconvlucy(degraded image, psf,numit, dampar, weight)numit = Number of iterationsdampar = Threshold deviationweight = weight to be assigned to each pixel

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 40: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

Blind deconvolution

Image restoration not based on the specific knowledge of PSF

Based on maximum liklihood estimation

Restores the image and the PSF simultaneously using an iterativeprocess similar to the Lucy-Richardson algorithm

matlab syntax

deconvblind(degraded image, intpsf)intpsf = Initial PSF

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration

Page 41: Morphology Restoration

Morphological image processingImage Restoration

Image degradationDegradation modelImage restoration techniques

References

1 Rafael C. Gonzalez, Richard E. Woods & Steven L. Eddins,“Digitalimage processing using matlab”, Pearson Education Inc.

2 Anil K. Jain, “Fundamentals of digital image processing”,Prentice-Hall Inc.

3 www.prenhall.com/gonzalezwoods

4 www.mathworks.com

Nishil. B. S.Nisha J. S. SPEECH AND IMAGE PROCESSING LAB Morphological image processing & Image restoration