morphological image processing - stanford...
TRANSCRIPT
![Page 1: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/1.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 1
Morphological Image Processing
Set-theoretic interpretation Opening, closing, morphological edge detectors Hit-miss filter
Binary dilation and erosion
Morphological filters for gray-level images Cascading dilations and erosions Rank filters, median filters, majority filters
![Page 2: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/2.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 2
Binary image processing Binary images are common
Intermediate abstraction in a gray-scale/color image analysis system • Thresholding/segmentation • Presence/absence of some image property
Text and line graphics, document image processing Representation of individual pixels as 0 or 1, convention:
foreground, object = 1 (white) background = 0 (black)
Processing by logical functions is fast and simple Shift-invariant logical operations on binary images:
“morphological” image processing Morphological image processing has been generalized to
gray-level images via level sets
![Page 3: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/3.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 3
Shift-invariance
Assume that digital images f [x,y] and g[x,y] have infinite support
. . . then, for all integers a and b
Shift-invariance does not imply linearity (or vice versa).
Shift- invariant system
f x, y[ ] g x, y[ ]
Shift- invariant system
f x − a, y − b[ ] g x − a, y − b[ ]
![Page 4: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/4.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 4
Structuring element
Neighborhood “window” operator
Example structuring elements :
“structuring element”
xyΠ
x
y
x
y
5x5 square cross
![Page 5: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/5.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 5
Binary dilation
x
y
xyΠ
![Page 6: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/6.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 6
Binary dilation with square structuring element
Expands the size of 1-valued objects
Smoothes object boundaries
Closes holes and gaps
Original (701x781) dilation with
3x3 structuring element dilation with
7x7 structuring element
![Page 7: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/7.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 7
Binary erosion
x
y
xyΠ
![Page 8: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/8.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 8
Binary erosion with square structuring element
Shrinks the size of 1-valued objects
Smoothes object boundaries
Removes peninsulas, fingers, and small objects
Original (701x781) erosion with
3x3 structuring element erosion with
7x7 structuring element
![Page 9: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/9.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 9
Relationship between dilation and erosion
Duality: erosion is dilation of the background
But: erosion is not the inverse of dilation
![Page 10: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/10.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 10
Example: blob separation/detection by erosion
Original binary image Circles (792x892)
Erosion by 30x30 structuring element
Erosion by 70x70 structuring element
Erosion by 96x96 structuring element
![Page 11: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/11.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 11
Example: blob separation/detection by erosion
Erosion by disk-shaped structuring element
Diameter=15
Erosion by disk-shaped structuring element
Diameter=35
Erosion by disk-shaped structuring element
Diameter=48
Original binary image Circles (792x892)
![Page 12: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/12.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 12
Example: chain link fence hole detection
Original grayscale image Fence (1023 x 1173)
Erosion with 151x151 “cross” structuring element
Fence thresholded using Otsu’s method
![Page 13: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/13.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 13
???
Consider a binary image of infinite extent that is 0 everywhere, except for a single pixel f [3,3]=1. After performing dilation with an L-shaped structuring element (SE) of width 3 pixels, how does the resulting image look like? (a) All zero, the single pixel has been removed. (b) L-shaped SE shifted to position 3,3 (c) L-shaped SE rotated by 180 degrees and shifted to position 3,3 (d) L-shaped SE rotated by 180 degrees and shifted to position -3,-3 (e) None of the above Answer the same question, but now performing erosion in lieu of dilation.
![Page 14: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/14.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 14
Set-theoretic interpretation
Set of object pixels
Background: complement of foreground set
Dilation is Minkowski set addition
translation of F by vector
Commutative and associative!
Continuous (x,y). Works for discrete [x,y] in the same way.
![Page 15: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/15.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 15
Set-theoretic interpretation: dilation
F x
y xyΠ
G
![Page 16: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/16.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 16
Set-theoretic interpretation: erosion
x
y xyΠF
G
Minkowski set subtraction
Reversed structuring element
Not commutative! Not associative!
![Page 17: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/17.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 17
Opening and closing Goal: smoothing without size change Open filter
Close filter
Open filter and close filter are biased
Open filter removes small 1-regions Close filter removes small 0-regions Bias is often desired for enhancement or detection!
Unbiased size-preserving smoothers
close-open and open-close are duals, but not inverses of each other.
![Page 18: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/18.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 18
Small hole removal by closing
Original binary mask Dilation 10x10
Closing 10x10 Difference to original mask
![Page 19: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/19.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 19
???
Which of the following holes in an object are filled by a morphological closing operation with a 10x10 square structuring element. (a) 5x5 square (b) 6x6 square (c) 9x9 square (d) 10x10 square (e) 10x10 square rotated by 45 degrees
![Page 20: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/20.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 20
Morphological edge detectors
dilate f ,W( )≠ f
f x, y
dilate f ,W( )≠ erode f ,W( ) erode f ,W( )≠ f
![Page 21: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/21.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 21
Recognition by erosion
2000
Structuring element W
34
44
Binary image f 14
00
![Page 22: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/22.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 22
Recognition by erosion
Structuring element W
34
44
![Page 23: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/23.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 23
Recognition by erosion Binary image f
2000
1400
Structuring element W
18
62
![Page 24: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/24.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 24
Recognition by erosion
Structuring element W
18
62
![Page 25: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/25.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 25
Hit-miss filter
Structuring element V
18
62 Structuring
element W 18
62
Binary image f
2000
1400
![Page 26: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/26.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 26
Hit-miss filter
Structuring element V
18
62
Structuring element W
18
62
![Page 27: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/27.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 27
Morphological filters for gray-level images
Threshold sets of a gray-level image f [x,y]
Reconstruction of original image from threshold sets
Idea of morphological operators for multi-level (or continuous-amplitude) signals Decompose into threshold sets Apply binary morphological operator to each threshold set
Reconstruct via supremum operation Gray-level operators thus obtained: flat operators Flat morphological operators and thresholding are commutative
![Page 28: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/28.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 28
Dilation/erosion for gray-level images
Explicit decomposition into threshold sets not required in practice Flat dilation operator: local maximum over window W
Flat erosion operator: local minimum over window W Binary dilation/erosion operators contained as special case
![Page 29: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/29.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 29
1-d illustration of erosion and dilation
Structuring element: horizontal line
Sample no.
Am
plitu
de
——Dilation ——Erosion ——Original
![Page 30: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/30.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 30
Image example
Original Dilation Erosion
![Page 31: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/31.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 31
Flat dilation with different structuring elements
Original Diamond
9 points
20 degree line Disk
2 horizontal lines
![Page 32: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/32.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 32
Example: counting coins
Original thresholded
dilation
20 connected components
thresholded after dilation
1 connected component
![Page 33: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/33.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 33
Example: chain link fence hole detection
Original grayscale image Fence (1023 x 1173)
Binarized by Thresholding Flat erosion with 151x151 “cross” structuring element
![Page 34: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/34.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 34
??? For the fence hole detection example, which method would you expect to give the better results in the presence of noise: (a) Flat erosion with 151x151 cross, followed by thresholding
(b) Thresholding of the image, followed by erosion with a 151x151 cross (c) Neither has an advantage over the other
![Page 35: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/35.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 35
Morphological edge detector
dilation g original f g-f (g-f) thresholded
![Page 36: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/36.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 36
Beyond flat morphogical operators
General dilation operator
Like linear convolution, with sup replacing summation, addition replacing multiplication Dilation with “unit impulse”
does not change input signal:
![Page 37: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/37.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 37
Flat dilation as a special case
Find such that
Answer:
Hence, write in general
w α ,β
![Page 38: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/38.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 38
General erosion for gray-level images
General erosion operator
Dual of dilation
Flat erosion contained as a special case
![Page 39: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/39.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 39
Cascaded dilations
dilate f ,w1,w2 ,w3( )
![Page 40: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/40.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 40
Cascaded erosions
Cascaded erosions can be lumped into single erosion
New structuring element (SE) is not the erosion of one SE by the other, but dilation.
![Page 41: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/41.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 41
Fast dilation and erosion
Idea: build larger dilation and erosion operators by cascading simple, small operators
Example: binary erosion by 11x11 window
Erosion with 11x11 window
Erosion with 1x3 window
Erosion with 1x3 window
…
Erosion with 3x1 window
Erosion with 3x1 window
…
5 stages
[ ]yxf ,
[ ]yxg ,
5 stages
[ ]yxf ,
[ ]yxg ,
120 AND per pixel 2x10 = 20 AND per pixel
![Page 42: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/42.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 42
??? Which of the following schemes performs dilation with a 5x5 square? (a) Two cascaded dilations with a 3x3 structuring element
(b) Two cascaded dilations with a 1x3 structuring element, followed by
two cascaded dilations with a 3x1 structuring element (c) NOT operation applied to invert the image, followed by two cascaded
erosions with a 1x3 structuring element, followed by two cascaded erosions with a 3x1 structuring element, followed by another NOT operation
![Page 43: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/43.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 43
Rank filters
Generalisation of flat dilation/erosion: in lieu of min or max value in window, use the p-th ranked value
Increases robustness against noise Best-known example: median filter for noise reduction Concept useful for both gray-level and binary images All rank filters are commutative with thresholding
![Page 44: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/44.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 44
Median filter Gray-level median filter
Binary images: majority filter
Self-duality
![Page 45: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/45.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 45
Majority filter: example
Binary image with 5% ‘Salt&Pepper’ noise 3x3 majority filter 20% ‘Salt&Pepper’ noise 3x3 majority filter
![Page 46: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/46.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 46
Median filter: example
Original image 5% ‘Salt&Pepper’ noise 3x3 median filtering 7x7 median filtering
![Page 47: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/47.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 47
Example: non-uniform lighting compensation
Original image 1632x1216 pixels
Dilation (local max) 61x61 structuring element
Rank filter 10st brightest pixel
61x61 structuring element
![Page 48: Morphological Image Processing - Stanford Universityweb.stanford.edu/class/ee368/Handouts/Lectures/2013_Spring/7... · erode(f,W) ≠f. Digital Image ... Median filter: example](https://reader031.vdocuments.mx/reader031/viewer/2022022502/5aabce697f8b9a9c2e8c5e57/html5/thumbnails/48.jpg)
Digital Image Processing: Bernd Girod, © 2013 Stanford University -- Morphological Image Processing 48
Example: non-uniform lighting compensation
Background – original image After global thresholding