Explain Following Morphological Methods With Examples
Explain Following Morphological Methods With Examples
a. Boundary Extraction
If A is an image and structuring element is B Then Boundary Extraction can be
given as, Boundary (A) = A - (A Ɵ B)
It means subtracting the erode image of A form the original Image.
Let A =
If B=
b. region/Hole Filling
It fills the hollow portion of the image.
Xk=(Xk−1⊗B) ∩ ACk=1,2,3,…..
To start the procedure of region filling, we start with a pixel p and assign a value 1
to it.
Then apply the above formula to it, X0=p and B is the structuring element.
X5=(X4⊗B) ∩AC
Since, X5=X4(Xk=Xk−1.) we stop the algorithm here.
Therefore, Xk=X4
The final step is finding the union of image A and X4X4
AUXk=A∩X4AUXk=A∩X4
c. Extraction of Connected Components
Connected components labeling scans an image and groups its pixels into
components based on pixel connectivity, i.e. all pixels in a connected
component share similar pixel intensity values and are in some way connected
with each other. Once all groups have been determined, each pixel is labeled
with a graylevel or a color (color labeling) according to the component it was
assigned to.
After completing the scan, the equivalent label pairs are sorted into equivalence
classes and a unique label is assigned to each class. As a final step, a second scan
is made through the image, during which each label is replaced by the label
assigned to its equivalence classes. For display, the labels might be different gray
levels or colors.
d. Thinning
Thinning is a morphological operation that is used to remove selected foreground
pixels from binary images, somewhat like erosion or opening. It can be used for
several applications, but is particularly useful for skeletonization. In this mode it is
commonly used to tidy up the output of edge detectors by reducing all lines to
single pixel thickness. Thinning is normally only applied to binary images, and
produces another binary image as output.
Implementation.
We have described the effects of a single pass of a thinning operation over the
image. In fact, the operator is normally applied repeatedly until it causes no
further changes to the image (i.e. until convergence). Alternatively, in some
applications, e.g. pruning, the operations may only be applied for a limited
number of iterations.
Figure 1.
Structuring elements for skeletonization by morphological thinning. At each
iteration, the image is first thinned by the left hand structuring element,
and then by the right hand one, and then with the remaining
six 90° rotations of the two elements. The process is repeated in cyclic
fashion until none of the thinnings produces any further change. As usual,
the origin of the structuring element is at the center.
Figure 2
Figure 2
Example skeletonization by morphological thinning of a simple binary
shape, using the above structuring elements. Note that the resulting
skeleton is connected.
Note that skeletons produced by this method often contain undesirable short
spurs produced by small irregularities in the boundary of the original object.
These spurs can be removed by a process called pruning, which is in fact just
another sort of thinning. The structuring element for this operation is shown in
Figure 3, along with some other common structuring elements.
Figure 3 Some applications of thinning. 1 simply finds the boundary of a
binary object, i.e. it deletes any foreground points that don't have at least
one neighboring background point. Note that the detected boundary is 4-
connected. 2 does the same thing but produces an 8-
connected boundary. 3a and 3b are used for pruning. At each thinning
iteration, each element must be used in each of its four 90° rotations.
Pruning is normally carried out for only a limited number of iterations to
remove short spurs, since pruning until convergence will actually remove all
pixels except those that form closed loops.
e. Thickening
Thickening is a morphological operation that is used to grow selected regions of
foreground pixels in binary images, somewhat like dilation or closing. It has
several applications, including determining the approximate convex hull of a
shape, and determining the skeleton by zone of influence. Thickening is normally
only applied to binary images, and it produces another binary image as output.
Implementation.
We have described the effects of a single pass of a thickening operation over the
image. In fact, the operator is normally applied repeatedly until it causes no
further changes to the image (i.e. until convergence). Alternatively, in some
applications, the operations may only be applied for a limited number of
iterations.
Figure 1
Structuring elements for determining the convex hull using thickening.
During each iteration of the thickening, each element should be used in
turn, and then in each of their 90° rotations, giving 8 effective structuring
elements in total. The thickening is continued until no further changes
occur, at which point the convex hull is complete.
The image
One method of calculating the SKIZ is to first determine the skeleton of the
background, and then prune this until convergence to remove all branches except
those forming closed loops, or those intersecting the image boundary. Both of
these concepts are described (applied to foreground objects) under thinning.
Since thickening is the dual of thinning, we can accomplish the same thing using
thickening. The structuring elements used in the two processes are shown in
Figure 2.
Figure 2
Structuring elements used in determining the SKIZ. 1a and 1b are used to
perform the skeletonization of the background. Note that these elements
are just the duals of the corresponding skeletonization by thinning
elements. On each thickening iteration, each element is used in turn, and in
each of its 90° rotations. Thickening is continued until convergence. When
this is finished, structuring elements 2a and 2b are used in similar fashion
to prune the skeleton until convergence and leave behind the SKIZ.
f. Skeletons
Skeletonization is a process for reducing foreground regions in a binary image to a
skeletal remnant that largely preserves the extent and connectivity of the original
region while throwing away most of the original foreground pixels. To see how this
works, imagine that the foreground regions in the input binary image are made of
some uniform slow-burning material. Light fires simultaneously at all points along
the boundary of this region and watch the fire move into the interior. At points
where the fire traveling from two different boundaries meets itself, the fire will
extinguish itself and the points at which this happens form the so called `quench
line'. This line is the skeleton. Under this definition it is clear that thinning produces a
sort of skeleton.
Another way to think about the skeleton is as the loci of centers of bi-tangent circles
that fit entirely within the foreground region being considered. Figure 1 illustrates
this for a rectangular shape.
Implementation
The skeleton/MAT can be produced in two main ways. The first is to use some kind
of morphological thinning that successively erodes away pixels from the boundary
(while preserving the end points of line segments) until no more thinning is possible,
at which point what is left approximates the skeleton. The alternative method is to
first calculate the distance transform of the image. The skeleton then lies along
the singularities (i.e. creases or curvature discontinuities) in the distance transform.
This latter approach is more suited to calculating the MAT since the MAT is the same
as the distance transform but with all points off the skeleton suppressed to zero.
Note: The MAT is often described as being the `locus of local maxima' on the
distance transform. This is not really true in any normal sense of the phrase `local
maximum'. If the distance transform is displayed as a 3-D surface plot with the third
dimension representing the gray value, the MAT can be imagined as the ridges on
the 3-D surface.
Just as there are many different types of distance transform there are many types of
skeletonization algorithm, all of which produce slightly different results. However,
the general effects are all similar, as are the uses to which the skeletons are put.
In addition, to this, the MAT (not the pure skeleton) has the property that it can be
used to exactly reconstruct the original shape if necessary.
As with thinning, slight irregularities in a boundary will lead to spurious spurs in the
final image which may interfere with recognition processes based on the topological
properties of the skeleton. Despurring or pruning can be carried out to remove spurs
of less than a certain length but this is not always effective since small perturbations
in the boundary of an image can lead to large spurs in the skeleton.
Here are some example skeletons and MATs produced from simple shapes. Note that
the MATs have been contrast-stretched in order to make them more visible.
Starting with
Skeleton is
MAT is
Starting with
Skeleton is
MAT is
Starting with
Skeleton is
MAT is
Starting with
Skeleton is
MAT is
The skeleton and the MAT are often very sensitive to small changes in the object. If,
for example, the above rectangle changes to
Using a different algorithm which does not guarantee a connected skeleton yields
is much more complex than the one we would obtain from the ideal shape of the
telephone receiver. This example shows that simple thresholding is often not
sufficient to produce a useful binary image. Some further processing might be
necessary before skeletonizing the image.
The skeleton is also very sensitive to noise. To illustrate this we add some `pepper
noise' to the above rectangle, thus obtaining
As can be seen in
the corresponding skeleton connects each noise point to the skeleton obtained from
the noise free image.
g. Pruning
The pruning algorithm is a technique used in digital image processing based
on mathematical morphology. It is used as a complement to the skeleton and
thinning algorithms to remove unwanted parasitic components (spurs). In this
case 'parasitic' components refer to branches of a line which are not key to the
overall shape of the line and should be removed. These components can often be
created by edge detection algorithms or digitization. Common uses for pruning
include automatic recognition of hand-printed characters. Often inconsistency in
letter writing creates unwanted spurs that need to be eliminated for better
characterization.
The standard pruning algorithm will remove all branches shorter than a given
number of points. If a parasitic branch is shorter than four points and we run the
algorithm with n = 4 the branch will be removed. The second step ensures that
the main trunks of each line are not shortened by the procedure.
Structuring Elements
The x in the arrays indicates a “don’t care” condition i.e. the image could have
either a 1 or a 0 in the spot.
Step 1: Thinning
Apply this step a given (n) times to eliminate any branch with (n) or less pixels.
Step 2: Find End Point
Wherever the structuring elements are satisfied, the center of the 3x3 matrix is
considered an endpoint.