Professional Documents
Culture Documents
BINARY
MORPHOLOGY
and
APPLICATIONS IN
Vision
In general; what is
Morphology?
The science of form and structure
the science of form, that of the outer form, inner structure, and
development of living organisms and their parts
about changing/counting regions/shapes
Morphological operations on a
PC
Various but slightly different
implementations in
Scion
Paint Shop Pro
Adope Photoshop
Corel Photopaint
mm
Mathematical
Morphology
- Set-theoretic representation
for binary
shapes
Binary Morphology
Morphological operators are used to prepare
binary (thresholded) images for object
segmentation/recognition
Binary images often suffer from noise (specifically salt-andpepper noise)
Binary regions also suffer from noise (isolated black pixels
in a white region). Can also have cracks, picket fence
occlusions, etc.
Goals of morphological
operations:
1. Simplifies image data
2. Preserves essential shape characteristics
3. Eliminates noise
4. Permits the underlying shape to be identified
and optimally reconstructed from their distorted,
noisy forms
Binary
Morphology
Shape Operators
Shapes are usually combined by means of :
X2
X1 X2
X2 \ X1 X1c X2
Set
difference
Set intersection
X1
X2
X1
X2
Libraries of Structuring
Elements
Application
specific
structuring
elements
created by
the user
Notation
x
-2 -1 0 1
-2
-1
0
1
2
B
y
X
No necessarily compact
nor filled
A special set :
the structuring
element
3*3 structuring
element, see next slide how it works
Dilation
Explanation of Dilation
Dilation : x = (x1,x2) such that if we center B on them,
then the so translated B intersects X.
difference
dilation
The Concept
of Minkowski Sum
Minkowskis Sum
Definition of Minkowskis sum of sets S and B :
Minkowskis
Sum
Dilation
Dilation
It is like dilation
but we are not
going around ,
we go only to
top and to right
Minkowskis
Sum
Dilation
b b bb
B is not the same as B
Dilation
Dilation vs SE
Erosion shrinks
Dilation expands binary regions
Can be used to fill in gaps or cracks in binary images
structuring Element ( SE )
If the point at the origin of the structuring
element is set in the underlying image, then
all the points that are set in the SE are also
set in the image
Basically, its like ORing the SE into the
image
Dilation example
A B
Shape of A
repeated
without shift
A B
Shape of A
repeated
with shift
Properties of Dilation
objects are light (white in binary)
Dilation does the following:
Image
StructuringElement
Result
Image
StructuringElement
Result
Image
StructuringElement
Result
Image
StructuringElement
Result
Definition of Dilation:
Mathematically
Dilation is the operation that combines two sets
using vector addition of set elements.
Let A and B are subsets in 2-D space. A: image
undergoing analysis, B: Structuring element,
denotes dilation
A B {c Z 2 c a b for some a A, b B}
x is a vector
( A) x {c Z 2 c a x, for some a A}
a A
Shift vector
(0,0)
Shift vector
(0,1)
A( 0, 0 )
A( 0,1)
A B
a A
Center of
the circle
( B) x
A B
This
circle
will
create
one point
Mathematical Properties of
Dilation
Commutative
A B B A
Associative
A ( B C ) ( A B) C
Extensivity
if 0 B, A A B
Illustrated in
next slide
Dilation is increasing
A B implies A D B D
A B
Replaced with
Linearity
( A) x B ( A B ) x
( A B ) C ( A C )( B C )
Containment
( A B) C ( A C ) ( B C )
A ( B C ) ( A B) ( A C )
Dilation
1. The dilation operator takes two pieces of data as input
1. A binary image, which is to be dilated
2. A structuring element (or kernel), which determines the behavior
of the morphological operation
2. Suppose that X is the set of Euclidean coordinates of the input image,
and K is the set of coordinates of the structuring element
3. Let Kx denote the translation of K so that its origin is at x.
4. The DILATION of X by K is simply the set of all points x such that the
intersection of Kx with X is non-empty
Dilation
Example: Suppose that the structuring element is
a 3x3 square with the origin at its center
K=
X=
Dilation
Example: Suppose that the structuring element is
a 3x3 square with the origin at its center
Dilation
Structuring element
Input
output
Dilation
output
Dilation
output
Dilation
Dilation
Erosion
Example of Erosion
Erosion : x = (x1,x2) such that if we center B on them,
then the so translated B is contained in X.
difference
erosion
Erosion
2) Better : from Minkowskis substraction of sets
Minkowskis substraction
BINARY MORPHOLOGY
Notation
for Erosion
Erosion
circle
First we
calculate the
operation in
parentheses
to obtain a
diamond
d/2
d
Where d is a
diameter
Implementation of dilation:
very low computational cost
0
1 (or >0)
Logical or
Implementation of erosion:
very low computational cost
0
1
Logical and
More on
Erosion
Erosion
1. (Minkowski subtraction)
2. The contraction of a binary region (aka,
region shrinking)
3. Use a structuring element on binary image
data to produce a new binary image
4. Structuring elements (SE) are simply
patterns that are matched in the image
5. It is useful to explain operation of erosion
and dilation in different ways.
Properties of Erosion:
Erosion removes spiky edges
Erosion Example
AB
Image
StructuringElement
Result
How It Works?
During erosion, a pixel is turned on at the
image pixel under the structuring element
origin only when the pixels of the structuring
element match the pixels in the image
Both ON and OFF pixels should match.
This example erodes regions horizontally
from the right.
Image
StructuringElement
Result
Image
StructuringElement
Result
Image
StructuringElement
Result
Image
StructuringElement
Result
Image
StructuringElement
Result
Image
StructuringElement
Result
{x Z 2 x b A for every b B )
AB {x Z 2 ( B ) x A)
In terms of intersection
AB ( A) b
bB
Observe that
vector here is
negative
Because of negative
shift the origin is here
A1( 0,1)
A( 0, 0 )
AB
Center
here will
not add a
point to
the Result
AB
Center of
B is here
and adds a
point
Example of Erosions
with various sizes of
structuring elements
Structuri
ng
Element
Properties of Erosion
Erosion is not commutative!
Extensivity
Erosion is dereasing
AB BA
if 0 B, AB A
Chain rule
Properties of Erosion
Ax B ( AB ) x , ABx ( AB) x
Translation Invariance
Linearity
( A B )C ( AC ) ( BC )
Containment
( A B)C ( AC ) ( BC )
A( B C ) ( AB ) ( AC )
B {x for some b B, x b}
Observe negative
value which is
image
Theorem mirror
reflection of B
( AB ) A B
c
1
1
*
1
Dilation
if origin == 1 -> template unioned
resultant image is large than original
Erosion
only if whole template matches image
origin = 1, result is smaller than original
Another look at
duality
Erosion
We dilate
with negation
Erosion
.. And we
negate the
result
We obtain the
same thing as
from definition
This exists in
Matlab
Edge detection or
Binary Contour
Boundary Extraction
Erosion can be
used to find
contour
Dilation can be
also used for it think how?
Edge detection
Dilate - original
dilated
dilated
eroded
Close
Open
OPENING
OPENING
Opening :
also
OPENING
Supresses :
small islands
ithsmus (narrow unions)
narrow caps
difference
Open
An erosion followed by a dilation
It serves to eliminate noise
Does not significantly change an objects
size
Opening Example
What combination of
erosion and dilation
gives:
cleaned binary image
object is the same size
as in original
Original
Original
Erode
Dilate
CLOSING
EXAMPLE OF CLOSING
Closing :
also
Supresses :
small lakes (holes)
channels (narrow separations)
narrow bays
BINARY MORPHOLOGY
With bigger
rectangle like
this
With smaller
cross like this
Papilary lines
recognition
Application :
segmentation of microstructures (Matlab Help)
disk radius 6
original
negated
threshold
closing
opening
and with
threshold
HIT-OR-MISS
Hit-or-miss :
Hit part
(white)
Miss part
(black)
background
foreground
doesnt matter
ISOLATED POINTS
isolated points at
4 connectivity
More
examples on
Closing
Close
Dilation followed by erosion
Serves to close up cracks in objects and
holes due to pepper noise
Does not significantly change object size
Original
Original
Dilate
Erode
A B ( AB ) B
Closing
A B ( A B)B
{ x B x A}
Difference is
only in
corners
Bx
A B ( AB) B
AB
Bx
A ( B) x A B
Antiextensivity of opening
Extensivity of closing
Duality
A ( B) x A B
A B A
A A B
( A B) A B
c
Example of Openings
with various sizes of
structuring elements
Structuring
Element
Example of Closings
with various sizes of
Exampleelements
of Closing
structuring
Structuring
Element
Thinning
and Thickening
Thickenning :
Depending on the structuring elements (actually, series
of them), very different results can be achieved :
Prunning
Skeletons
Zone of influence
Convex hull
...
Prunning at 4 connectivity
Prunning at 4 connectivity : remove end points by a
sequence of thinnings
This point is
removed with dark
green neighbors
1 iteration =
2nd iteration
doesnt
matter
erosion
4-connectivity
4-connectivity
contour
8-connectivity
Original
shaper
Thickening
with first
mask
Union of
four
thickenings
iii. Skeleton :
Maximal disk : disk centered at x, Dx, such that
Dx X and no other Dy contains it .
Skeleton : union of centers of maximal disks.
1st
iteration
result of
1st iteration
Thinning
with thickening
Some sort of
region
clustering
20 iterations
of thinning
color white
40 iterations
Thickening
color white
Skeletonization
for OCR
BINARY MORPHOLOGY
Application : skeletonization for OCR by graph matching
skeletonization
vectorization
skeletonization
Application : skeletonization for OCR by graph matching
Hit-or-Miss
and 3 rotations
GZI
thr
erosion
7x7
and
opening
5x5
dist
erosion
7x7
thresholding
thinning
opening
smoothing
PROGRAMMING
OF MORPHOLOGICAL OPERATIONS
USING LISP
USING LISP
USING LISP
USING LISP
USING LISP
Morphological
Filtering
Morphological Filtering
Main idea of Morphological Filtering:
Examine the geometrical structure of an image by matching it
with small patterns called structuring elements at various
locations
By varying the size and shape of the matching patterns, we can
extract useful information about the shape of the different parts
of the image and their interrelations.
Combine set-theoretical and morphological operations:
Example 1: Morphological
filtering
Noisy image will break down OCR systems
Noisy image
Restored image
1 operation
2 operations
Postprocessing
Postprocessing
(a)
(b)
(c)
(d)
Grey Level
Morphology
erosion
dilation
Summary on Morphological
Approaches
Mathematical morphology is an approach for processing
digital image based on its shape
The language of morphology is set theory
The basic morphological operations are erosion and
dilation
Morphological filtering can be developed to extract useful
shape information
Methods can be extended to more values and more
dimensions
Nice mathematics can be formulated - non-linear
Conclusion
Conclusion
Postprocessing
Opening and closing to clean binary images.
Repeated erosion with special rule produces skeleton.
Problems 1 - 6
1. Write LISP or C++ program for dilation of binary
images
2. Modify it to do erosions (few types)
3. Modify it to perform shift and exor operation and
shift and min operation
4. Generalize to multi-valued algebra
5. Create a comprehensive theory of multi-valued
morphological algebra and its algorithms
(publishable).
Problem 7.
Electric Outlet Extraction has been done
using a combination of Canny Edge
Detection and Hough Transforms
Write a LISP program that will use only basic
morphological methods for this application.
Segmentation
Edge Detection
DPC compression
FFT
IFFT
DFT
Thinning
Growing
Haar Transform
Hex Rotate
Alpha filtering
DPC compression
Perimeter
Fractal
Gaussian Filter
Band Pass Filter
Homomorphic Filtering
Contrast
Sharper
Least Square Restoration
Warping
Dilation
Create morphological
equivalents of other image
processing methods.
New, publishable, use outlet
problem as example to illustrate
Problems 9 - 12.
9. Generalize binary morphological algebra from 2 dimensional
to 3 dimensional images. What are the applications.
10. Write software for 9.
11. Generalize your generalized multi-valued morphological
algebra to 3 or more dimensions, theoretically, find properties
and theorems like those from this lecture.
12. Write software for 11.
Problem 13
Mathematical morphology uses the concept of
structuring elements to analyze image features.
A structuring element is a set of pixels in some
arrangement that can extract shape information from
an image.
Typical structuring elements include rectangles,
lines, and circles.
Think about other structuring elements and their
applications.
Morphological Operations:
Matlab
demos/demo9morph/
Sources
Shreekanth Mandayam
ECE Department
Rowan University
Howie Choset
G.D. Hager,
Z. Dodds,
Dinesh Mocha