# Morphological Image Processing

Dilation
1. Dilation grows and thickens objects in a binary image.
2. Structuring element controls the specific manner and extent of this
thickening.
3. It is performed by function imdilate, having syntax:
A2 = imdilate (A, B)
4. The function strel constructs structuring elements with a variety of
shapes and sizes, having syntax:
se = strel (shape, parameters)

Erosion
1. Erosion shrinks and thins objects in a binary image.
2. It is performed by function imerode, having syntax:
se = strel (shape, parameters)
A2 = imerode (A, se)

Combining Dilation and Erosion
1. Opening and closing
a. Functions imopen and imclose are used to implement opening and
closing in the toolbox, having syntax:
C = imopen (A, B)
and C = imclose (A, B)
2. Hit-or-Miss transformation
a. Function bwhitmiss is used to implement hit-or-miss transformation,
having syntax:
C = bwhitmiss (A, B1, B2)
3. Using Lookup Tables
a. Lookup table (LUT) is the faster way to compute the hit-or-miss
transformation when structuring elements are small.
b. A lookup table is constructed by using function makelut, based on a
user-supplied function.
c. Function applylut processes binary images using this lookup table.
d. The line of code
persistent lut
establishes a variable called lut and declares it to be persistent.

Function bwmorph
1. Function bwmorph implements various useful operations by combining
dilations, erosions, and lookup table operations, having syntax:
g = bwmorph (f, operation, n)
2. The two main operations are thinning and skeletonization.
a. Thinning means reducing binary objects or shapes in an image to
strokes that are a single pixel wide.
b. Skeletonization reduces binary image objects to a set of thin strokes.
c. Thinning and skeletonization produce short extraneous spurs called
parasitic components.
d. The process of cleaning up these spurs is called pruning.

Labeling Connected Components
1. The term connected component was defined in terms of path which in
2. All the connected components in a binary image are computed by using
bwlabel function, having syntax:
[L, num] = bwlabel (f, conn)

Morphological Reconstruction
1. Reconstruction involves two images and a structuring element.
2. Function imreconstruct is used for morphological reconstruction, having
syntax: