180 likes | 196 Views
Morphology – Chapter 10. 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
E N D
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)
Binarization • But, the process is not always perfect (is rarely perfect?) • Contours get broken
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
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
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
Dilation/Erosion Dilation operation Erosion operation Reflection of the structuring element (change coordinates from – to +, + to -) 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
Grayscale morphology • Instead of checking for values equal to 1 or 0 (and copying into the result image, etc.) you check for minimum and maximum values • From my experience this isn’t done very much • The book doesn’t go into details • ImageJ doesn’t implement • So I’m going to just move on