Ch9 - Morphological Image Processing
Ch9 - Morphological Image Processing
Introduction
The word morphology commonly denotes a branch of biology that deals with the form and structure of animals and plants. Therefore, morphological operations are intended to affect the shape of the object We use mathematical morphology as a tool for extracting image components that are useful in the representation and description of region shape, such as boundaries, skeletons.
Contents
Once segmentation is complete, morphological operations can be used to remove imperfections in the segmented image and provide information on the form and structure of the image we will consider:
What is morphology? Simple morphological operations Compound operations Morphological algorithms
1, 0, Black, White?
Throughout all of the following slides whether 0 and 1 refer to white or black is a little interchangeable All of the discussion that follows assumes segmentation has already taken place and that images are made up of 0s for background pixels and 1s for object pixels After this it doesnt matter if 0 is black, white, yellow, green.
What Is Morphology?
Morphological image processing (or morphology) describes a range of image processing techniques that deal with the shape (or morphology) of features in an image Morphological operations are typically applied to remove imperfections introduced during segmentation, and so typically operate on bilevel images
Quick Example
Mathematic Morphology
used to extract image components that are useful in the representation and description of region shape, such as boundaries extraction skeletons convex hull morphological filtering thinning pruning
Mathematic Morphology
mathematical framework used for: pre-processing noise filtering, shape simplification, ... enhancing object structure skeletonization, convex hull... Segmentation watershed, quantitative description area, perimeter, ...
Z2 and Z3
set in mathematic morphology represent objects in an image binary image (0 = white, 1 = black) : the element of the set is the coordinates (x,y) of pixel belong to the object Z2 gray-scaled image : the element of the set is the coordinates (x,y) of pixel belong to the object and the gray levels Z3
the origo is the reference point on which deictic relationships are based.
A C
= {w | w b, for b B} B
( A) z = {c | c a + z , for a A}
Logic Operations
Example:
Basic idea
in parallel for each pixel in binary image:
check if SE is satisfied output pixel is set to 0 or 1 depending on used operation
Fundamental Operations
Fundamentally morphological image processing is very like spatial filtering The structuring element is moved across every pixel in the original image to give a pixel in a new processed image The value of this new pixel depends on the operation performed There are two basic morphological operations: erosion and dilation
object background
Erosion
Erosion is one of the two basic operators in the area of mathematical morphology , the other being dilation. It is typically applied to binary image, but there are versions that work on gray scale image. The basic effect of the operator on a binary image is to erode away the boundaries of regions of foreground pixels (i.e. white pixels, typically). Thus areas of foreground pixels shrink in size, and holes within those areas become larger.
Erosion
Erosion of image f by structuring element s is given by f s The structuring element s is positioned with its origin at (x, y) and the new pixel value is determined using the rule:
1 if s fits f g ( x, y ) = 0 otherwise
Erosion:
Does the structuring element fit the set? erosion of a set A by structuring element B: all z in A such that B is in A when origin of B=z
A B = {z|(B)z A}
shrink the object
Erosion
Erosion
A B = { z|(B)z A }
Effect of erosion using a 33 square structuring element Applications of erosion : Eliminating unwanted detail in an image
Original image
Original image
Dilation
Dilation is one of the two basic operators in the area of mathematical morphology , the other being erosion. It is typically applied to binary image, but there are versions that work on gray scale image. The basic effect of the operator on a binary image is to gradually enlarge the boundaries of regions of foreground pixels (i.e. white pixels, typically). Thus areas of foreground pixels grow in size while holes within those regions become smaller.
Dilation
Dilation of image f by structuring element s is given by f s The structuring element s is positioned with its origin at (x, y) and the new pixel value is determined using the rule:
1 if s hits f g ( x, y ) = 0 otherwise
Dilation:
Does the structuring element hit the set? dilation of a set A by structuring element B: all z in A such that B hits A when origin of B=z
) A B = { z|( B z A }
grow the object
Dilation
Dilation
Dilation
B = structuring element
) A B = {z|(B z A }
Effect of dilation using a 33 square structuring element Applications of dilaion : For bridging gaps in an image
An example:
Dilation Example 1
Original image
useful
Erosion removal of structures of certain shape and size, given by SE Dilation filling of holes of certain shape and size, given by SE
Duality
A B = A B
( A B ) = A B
Compound Operations
More interesting morphological operations can be performed by performing combinations of erosions and dilations The most widely used of these compound operations are:
Opening Closing
Ao B = ( A B ) B A B = ( A B ) B
Opening Operation or
A o B = ( A B) B
A o B = {(B )z (B )z A}
Opening effect
Original Image Processed Image
Structuring Element
Opening example 2
Input Image
Resultant Image
Closing effect
Original Image Processed Image
Structuring Element
Closing Operation
A B = (A B)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Closing example 2:
Application
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
(A B)
Properties Opening
= Ac o B
1. A o B A 2. If C D then C o B D o B 3. ( A o B ) o B = A o B
Properties Closing
1. A A B 2. If C D then C B D B 3. ( A B ) B = A B
Idem potent property: cant change any more
A * B = (A
X ) Ac
(W X )
A * B = (A
X ) Ac
(W X )
How It Works ? The structural elements used for Hit-or-miss transforms are an extension to the ones used with dilation, erosion etc. The structural elements can contain both foreground and background pixels, rather than just foreground pixels, i.e. both ones and zeros. The structuring element is superimposed over each pixel in the input image, and if an exact match is found between the foreground and background pixels in the structuring element and the image, the input pixel lying below the origin of the structuring element is set to the foreground pixel value. If it does not match, the input pixel is replaced by the background pixel value.
Example
Structuring elements
Boundary Extraction
(A) = A ( A
B)
Original image
Boundary
Original image
X k = ( X k 1 B ) A
k = 1, 2, 3, ..
Thresholded image
Connected components
Algorithm:
C ( A) = D
i =1
where
i D i = X conv
X ki = (X k 1 * B i ) A,
i = 1,2,3,4
Thinning
Example: Thinning
Thickening
Skeletons
Skeletons (cont.)
K
S ( A) = Sk ( A)
k =0
with
Sk ( A) = ( A
kB) ( A
kB) o B
where ( A
and
K = max{k ( A
kB ) }
Skeletons
Pruning
X 1 = A {B}
8 k =1
= thinning
Example: Pruning
End points
Pruned result
x = dont care
f b = max{f ( s x, t y ) + b( x, y ) | ( s x ), (t y ) D f ; ( x, y ) Db }
+
Max Moving window Structuring element B Note: B can be any shape and subimage must have the same shape as reflection of B.
Output image
Min Moving window Structuring element B Note: B can be any shape and subimage must have the same shape as B. Output image
Darker
Brighter
After erosion
f o b = ( f b) b
f b = ( f b) b
Original image
After opening
After closing
Original image
After smoothing
Morphological Gradient
g = ( f b) ( f b)
Original image
Morphological Gradient
h = f ( f o b)
Original image
Example: Granulometry
Objective: to count the number of particles of each size Method: 1. Perform opening using structuring elements of increasing size 2. Compute the difference between the original image and the result after each opening operation 3. The differenced image obtained in Step 2 are normalized and used to construct the size-distribution graph.
Original image