CS 6723 Image Processing
Lecture 22: Introduction to Morphology
- Morphology overview:
- Tool for extracting components of image using shapes.
- Can extract boundaries, skeletons, convex hull and approximate shapes.
- Described in terms of set operations.
- Basic set operations:
Suppose A and B are sets in Z2.
- Translation:
Bx = {c: c = b + x, for x in B}.
(Translation of B by x moves the
set so that its origin is at x.)
- Reflection: hat
(B) = {x : x = -b, for b in B}.
Reflection has the effect of flipping
- Complement:
Ac = {x: x not in A}.
- Difference:
A - B = {x: x in A but x not in B}.
Difference is A intersect Bc.
- Morphological image operations involve two sets:
A and B. Usually A is an image
and B is a structuring element.
- Move position of
B relative to A
and perform set operations.
- Matlab implements 4 morphological operations for binary or uint8:
imerode,
imdilate, imclose and imopen.
- A general morphological operator
bwmorph is available
for binary images.
- Must consider behavior at the boundary.
- The key to having effective morphological operations is picking a good
structuring element.
- Structuring element:
- Usually a small image that is used like a spatial filter.
- Has 1's in positions corresponding to elements in the set.
Has 0's elsewhere.
- The locations of the 1's are called the neighborhood
defined by the structuring element.
- The location of the origin is important:
- The origin isn't always
in the center.
- Two structuring elements which have the same
bit pattern, but different origins behave differently.
- To use a mask represented as an array with a Matlab morphological operation,
use
strel to convert it to the appropriate representation.
- Erosion:
-
A eroded by B = {x : Bx is in A}
- The symbol for erosion is a minus sign with a circle around it.
- Erosion reduces the size of objects, eliminating features that are
less than the scale of the neighborhood as defined by the structuring element.
- Matlab definition of erosion (works for graylevel as well as binary images):
A eroded by B =
{x : x = min pixels in A in neighborhood Bx}
- Matlab operation is
imerode.
- Matlab handles boundaries by assigning pixels beyond the boundary, the
maximum value possible for data type (1 for binary, 255 for uint8).
- Look at hand examples and Matlab script
testerode
- Dilation:
-
A dilated by B = {x :
hat(B)x is in A}.
- The symbol for dilation is a plus sign with a circle around it.
- Dilation expands the size of objects on the scale of the
structuring element neighborhood.
- Matlab definition of dilation (works for graylevel as well as binary images):
A dilated by B =
{x : x = max pixels in A in neighborhood Bx}
- Matlab operation is
imdilate.
- Matlab handles boundaries by assigning pixels beyond the boundary, the
minimum value possible for data type (1 for binary, 255 for uint8).
- Look at hand examples and Matlab script
testdilate.
- Note: The Matlab version appears to follow Gonzales and Woods and
reflects the structuring element before applying the mask operation. This
doesn't appear to be documented. There is some inconsistency about the
definition of dilation and hence the operations that depend on it.
For example, Fundamentals of Digital Image Processing by
Jain defines dilate without reflecting the structuring element
B.
This distinction is important if the structuring element is not symmetric.
- Open:
-
A opened by B is an erosion of A
by B followed by a dilation of A by B.
- The symbol for the open operation is a small open circle.
- Open smooths contours, breaks narrow isthmuses and eliminates little knobs.
- Matlab defines open in terms of erosion and dilation. The
definition works on both grayscale and binary images.
- Matlab operation is
imopen.
- Look at examples in the Matlab script
testopen.
- Close:
-
A closed by B is a dilation of A
by B followed by an erosion of A by B.
- The symbol for the open operation is a small closed circle.
- Close fuses narrow breaks, eliminates small holes and fuses gaps.
- Matlab defines close in terms of erosion and dilation. The
definition works on both grayscale and binary images.
- Matlab operation is
imclose.
- Look at examples in the Matlab script
testclose.
- Matlab scripts:
- Images:
Objective: Explore the basic operations of morphology.
Last revision: November 13, 2001 at 11:45 am