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
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.
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.
Translation and Reflection Operations
A
(A)z
z = (z1,z2)
Translation Reflection
B̂
B
BbbwwB for ,ˆ AazaccA z for ,
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.
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.
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.
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.
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.
Dilation Operations (cont.)
StructuringElement (B)
Original image (A)
B̂Reflection
Intersect pixel Center pixel
Dilation Operations (cont.)
Result of Dilation Boundary of the “center pixels”where intersects A zB̂
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
Duality Between Dilation and Erosion
BABA cc ˆ) (
Proof:
where c = complement
BA
ABz
ABz
ABzBA
c
cz
ccz
c
zc
ˆ
) (
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.
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.
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.
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.
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
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
Skeletons (cont.)
)()(0
ASAS k
K
k
with
where ...) ) ) (...( ( BBBAkB)A
BkB)AkB)AASk ( ()(
k times
and kBAkK max