morphology – chapter 10. binary image processing often it is advantageous to reduce an image from...
TRANSCRIPT
Binary image processing• Often it is advantageous to reduce an image
from gray level (multiple bits/pixel) to binary (1 bit/pixel)– Threshold the gray level image to isolate objects– Edge detect and threshold the edge magnitude map– Special lighting (assembly line manufacturing applications)
• The goal is to separate the image into foreground and background components
Binarization
• But, the process is not always perfect (is rarely perfect?)– Foreground objects have holes
(background shows through)
Morphology
• Morphology is a set of processes that allow us to alter the structure of the binary image
• Foundations in set theory– The image forms one set – the set of pixels that make up the
foreground
– The structuring element forms the other set – much like a convolution kernel
1| pIpF I
1| pHpS SE
Structuring element
• Looks like a convolution kernel– Contains only 0 and 1– Has a designated hot spot (origin)
– The hot spot is placed over the “current pixel” (like the center of the convolution kernel)
– The hot spot need not be in the center– The hot spot can be either 0 or 1
010
111
010
010
110
000
The operations
• All are based on set theory– Definitions are based on intersections and
unions of the image and the structuring element (logical AND/OR operations)
• The two fundamental operations are– Dilation – growing the foreground of the
image– Erosion – shrinking the foreground of the
image
Dilation
• No need to show the set theory definition – better to just see the words
• Place the hot spot on top of an image pixel that is in the set (a foreground pixel)
• Copy the 1’s of the structuring element into the image set
• Note that this must be done using double buffering (don’t overwrite the original image)
Erosion
• No need to show the set theory definition – better to just see the words
• Place the hot spot on top of an image pixel that is in the set (a foreground pixel)
• Place a 1 in the image only if all of the 1’s of the structuring element align with 1’s in the image
• Note that this must be done using double buffering (don’t overwrite the original image)
Dilation/Erosion usage
• Among other things…– Dilation is good for filling small holes– Erosion is good for removing small tails
• Dilation of the foreground can be achieved by erosion of the background
– See next slide for explanation
HIHI
*
Dilation/Erosion
HIHI
*
Dilation operation Erosion operation
H*
Reflection of the structuring element(change coordinates from – to +, + to -)
0001
1100
0101
101
0101
0110
0001
101
Reflect
All this really means is that implementation is easy
Typical…
• The shape of the structuring element is often a circular disk (approximate)– This results in a symmetrical dilation or
erosion (which is often desired)
• There is no easy (i.e. efficient) way to do this stuff– Lots of nested loops is all you can do
Composite operations
• Opening– Erosion followed by dilation (same structuring
element)• Erosion removes small elements (like noise)• Dilation puts the remaining stuff [almost] back to how it was
• Closing – Dilation followed by erosion (same structuring
element)• Dilation removes small holes and notches
• Erosion puts the remaining stuff [almost] back to how it was
Composite operations
• Opening the foreground is equivalent to closing the background– Again, this just means implementation is
easy– To do opening, invert the image (swap
foreground and background) and perform a closing operation