Lecture11 PDF
Lecture11 PDF
Pixel Neighborhoods
Remember the two definitions of neighbors that weve
discussed:
4 Neighborhood
8 Neighborhood
Erosion Example
Dilation Example
Structuring Element
Definition
A structuring element is simply a binary image (or
mask) that allows us to define arbitrary neighborhood
structures.
Example:
QI = {(u, v) | I(u, v) = 1}
To simplify notation, well use a single variable for a
coordinate pair, p = (u, v). So,
QI = {p | I(p) = 1}
Complement = Inversion
Let I denote image inversion (pointwise NOT)
QI = QI = {p Z2 | p
/ QI }
I
Union = OR
Let I1 I2 be pointwise OR operation
Intersection = AND
Let I1 I2 be pointwise AND operation
Translation: Let d Z2
Id = {(p + d) | p I}
I
Reflection:
I = {p | p I}
Dilation
Definition
A dilation of an image I by the structure element H is
given by the set operation
I H = {(p + q) | p I, q H}
Alternative definition: Take the union of copies of the
structuring element, Hp , centered at every pixel location
p in the foreground:
IH =
[
pI
Hp
Dilation Algorithm
Uses equivalent formula I H =
qH
4.
Update I 0 = I 0 Iq
Iq :
Erosion
Definition
A erosion of an image I by the structure element H is
given by the set operation
I H = {p Z2 | (p + q) I, for every q H}
Alternative definition: Keep only pixels p I such that
Hp fits inside I :
I H = {p | Hp I}
I H = (I H )
Same duality for dilation:
I H = (I H )
Erosion Algorithm
Uses dual, I H = (I H )
Input: Image I , structuring element H
Output: Image I 0 = I H
1. Start with inversion, I 0 = I
2. Dilate I 0 with reflected structure element, H
3. Invert I 0
Properties of Dilation
Similar to convolution properties, we need to assume the
image domains are large enough that operations dont
fall off the edges.
Commutativity:
IH =HI
Means we can switch the roles of the structuring element
and the image
Properties of Dilation
Associativity:
I1 (I2 I3 ) = (I1 I2 ) I3
Means that we can sometimes break up a big structuring
element into smaller ones:
That is, if H = H1 H2 . . . Hn , then
I H = (((I H1 ) H2 ) . . . Hn )
Properties of Erosion
It is NOT commutative:
I H 6= H I
I
(I H1 ) H2 = I (H1 H2 )
I id = id I = I
I
Opening
I H = (I H) H
Stray foreground structures that are smaller than the H
structure element will disappear. Larger structures will
remain.
Closing
I H = (I H) H
Holes in the foreground that are smaller than H will be
filled.
Improving a Segmentation
Original image
Initial threshold
Improving a Segmentation
Original image
After opening
Improving a Segmentation
Original image
After closing
Outline
I0 = I H
B(u, v) = XOR(I 0 (u, v), I(u, v))
Outline
Outline Example
Binary segmentation
Skeletonize
Grayscale Morphology
Grayscale Morphology
Dilation:
Erosion:
http://rsbweb.nih.gov/ij/plugins/
gray-morphology.html