Top Banner
Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University
37

Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Dec 17, 2015

Download

Documents

Georgia Boone
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Morphological Image ProcessingMorphological Image Processing

Md. RokanujjamanAssistant ProfessorDept of Computer Science and EngineeringRajshahi University

Page 2: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

What are Morphological Operations?

Morphological operations come from the word “morphing”in Biology which means “changing a shape”.

Morphing

Image morphological operations are used to manipulateobject shapes such as thinning, thickening, and filling.

Binary morphological operations are derived fromset operations.

Page 3: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Basic Set Operations

Concept of a set in binary image morphology: Each set may represent one object. Each pixel (x,y) has its status: belong to a set or not belong to a set.

Page 4: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Translation and Reflection Operations

A

(A)z

z = (z1,z2)

Translation Reflection

B

BbbwwB for ,ˆ AazaccA z for ,

Page 5: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Logical Operations*

*For binary images only

Page 6: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Structuring Element

The two most common structuring elements (given a Cartesian grid) are the 4-connected and 8-connected sets, N4 and N8. They are illustrated in Figure

.

Figure: The standard structuring elements N4 and N8.

Page 7: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Binary Images

For a binary image, white pixels are normally taken to represent foreground regions, while black pixels denote background. (Note that in some implementations this convention is reversed, and so it is very important to set up input images with the correct polarity for the implementation being used). Then the set of coordinates corresponding to that image is simply the set of two-dimensional Euclidean coordinates of all the foreground pixels in the image, with an origin normally taken in one of the corners so that all coordinates have positive elements.

Page 8: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Fundamental Morphological Operations

Erosion and dilation work (at least conceptually) by translating the structuring element to various points in the input image, and examining the intersection between the translated kernel coordinates and the input image coordinates.

For instance, in the case of erosion, the output coordinate set consists of just those points to which the origin of the structuring element can be translated, while the element still remains entirely `within' the input image.

Virtually all other mathematical morphology operators can be defined in terms of combinations of erosion and dilation along with set operators such as intersection and union. Some of the more important are opening, closing and skeletonization.

Page 9: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Fitting and Hitting

When we place a structuring element in a binary image, each of its pixels is associated with the corresponding pixel of the neighborhood under the structuring element. In this sense, a morphological operation resembles a “binary correlation”. The operation is logical rather than arithmetic in nature.

The structuring element is said to fit the image if, for each of its pixels that is set to 1 , the corresponding image pixel is also 1.

The structuring element is said to hit, an image if for any of its pixels that is set to 1, the corresponding image pixel is also 1.

Page 10: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Dilation Operations

ABzBA zˆ

A = Object to be dilatedB = Structuring element

= Empty setDilate means “extend”

Or BbAabazzBA ,

The dilation A by B is the set of all displacements z, such that reflection of B and A overlap by at least one element.

Page 11: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Dilation Operations (cont.)

StructuringElement (B)

Original image (A)

B̂Reflection

Intersect pixel Center pixel

Page 12: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Dilation Operations (cont.)

Result of Dilation Boundary of the “center pixels”where intersects A zB̂

Page 13: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example: Application of Dilation

“Repair” broken characters

Page 14: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Erosion Operation

ABzBA z

A = Object to be erodedB = Structuring element

Erosion means “trim”

Or, BbxbzzBA every for

The erosion of A by B is the set of all points z such that B translated by z is contained in A

Page 15: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Erosion Operations (cont.)

StructuringElement (B)

Original image (A) Intersect pixel Center pixel

Page 16: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Erosion Operations (cont.)

Result of Erosion Boundary of the “center pixels”where B is inside A

Page 17: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example: Application of Dilation and Erosion

Remove small objects such as noise

Page 18: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Duality Between Dilation and Erosion

BABA cc ˆ) (

Proof:

where c = complement

BA

ABz

ABz

ABzBA

c

cz

ccz

c

zc

ˆ

) (

Page 19: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Opening Operation

BBABA ) (= Combination of all parts of A that can completely contain B

Opening eliminates narrow and small details and corners.

The process of erosion followed by dilation is called opening. It has the effect of eliminating small and thin objects, breaking the objects at thin points and smoothing the boundaries/contours of the objects.

Page 20: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example of Opening

Page 21: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Closing Operation

BBBA )A(

Closing fills narrow gaps and notches

The process of dilation followed by erosion is called closing. It has the effect of filling small and thin holes, connecting nearby objects and smoothing the boundaries/contours of the objects.

Page 22: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example of Closing

Page 23: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example: Application of Morphological Operations

Finger print enhancement

Page 24: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Hit-or-Miss Transformation

)( XWAXAXA c *

where X = shape to be detected W = window that can contain X

Hit-or-miss transform can be used for shape detection/ Template matching.

Page 25: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Hit-or-Miss Transformation (cont.)

)( XWABABA c *

Page 26: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Boundary Extraction

BAAβ(A)

Original image

Boundary

The boundaries/edges of a region/shape can be extracted by first applying erosion on A by B and subtracting the eroded A from A.

Page 27: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Region Filling

ckk ABXX 1

Original image

Results of region filling

where X0 = seed pixel p

Region filling can be performed by using the following definition. Given a symmetric structuring element B, one of the non-boundary pixels (X) is consecutively diluted and its intersection with the complement of A is taken as follows:

Terminates when Xk = Xk-1

Page 28: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Extraction of Connected Components

ABXX kk 1

where X0 = seed pixel p

Terminates when Xk = Xk-1

Page 29: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Convex Hull

i

i

DAC

4

1

)(

4,3,2,1 , 1 iABXX iik

ik *

iconv

i XD

Convex hull has no concave part.

Convex hull

Algorithm: where

Page 30: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example: Convex Hull

Page 31: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Thinning

cBAA

BAABA

) (

) (

*

*

))...))((...(( 21 nBBBABA

Page 32: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Example: Thinning

Make an object thinner.

Page 33: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Thickening

* ) ( BAABA . ) )...) ) ((...(( 21 nBBBABA . . . .

Make an object thicker

*

Page 34: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Skeletons

Dot lines are skeletons of thisstructure

Page 35: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Skeletons (cont.)

)()(0

ASAS k

K

k

with

where ...) ) ) (...( ( BBBAkB)A

BkB)AkB)AASk ( ()(

k times

and kBAkK max

Page 36: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Skeletons

Page 37: Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.

Thank You