Chapter 11 08/03/04 Morphological image processing o nonlinear techniques dealing with the shape/structure/form of features in an image o usually applied to binary images resulting from segmentation process o may also be applied to grayscale images o probe an image with a structuring element small array containing a shape template has an origin that may be outside the array position the origin at each pixel in the image and compare structuring element to image neighborhood logical comparison locations where structuring element is zero are ignored fit - every non-zero structuring element value corresponds to a non-zero neighborhood value hit - any non-zero structuring element value corresponds to a non-zero neighborhood value o StructElement.java o StructElementTypes.java o BinaryStructElement.java Fundamental operations o erosion given an image f and a structuring element s, if s fits f at x,y then g(x,y) = 1 else g(x,y) = 0 must deal with access outside image boundaries erodes pixels away from boundaries of regions removes small extrusions at region boundary could use this to find region boundaries by subtracting eroded image from original image o dilation given an image f and a structuring element s, if s hits f at x,y then g(x,y) = 1 else g(x,y) = 0 opposite of erosion - adds a layer of pixels to region boundaries o shape of the structuring element affects the results of erosion or dilation dilation by a disc - smooths convex corners erosion by a disc - smooths concave corners o dilation is the dual of erosion o BinaryMorphologicalOp.java o BinaryErodeOp.java o BinaryDilateOp.java Set theory is the language of mathematical morphology o a binary image is represented as the set of all black (or white) pixels o each element of the set is a 2D vector whose coordinates are the (x,y) coordinates of a pixel o basic definitions include translation reflection complement intersection union difference o dilation and erosion can be defined in terms of these basic definitions o dilation of A by B all x such that the intersection of A with the reflection of B translated by x in not null o o o o o o o o set of all x displacements such that the reflection of B and A overlap by at least one nonzero element erosion of A by B all x such that B translated by x is a subset of A set of all x such that B, translated by x, is contained in A dilation and erosion are duals of each other with respect to complementation and reflection we can perform dilation by performing erosion on the complement of the image if our structuring element is not symmetric with respect to rotation, we need to reflect it first compound operations opening an erosion followed by a dilation breaks narrow isthmuses, eliminates thin protrusions can open a gap between two regions joined by a narrow bridge of pixels can be used to separate two regions that should be distinct advantage over erosion is that the regions are returned to their original size, minus the connecting pixels closing a dilation followed by an erosion closes narrow gaps, eliminates small holes advantage over dilation is that the region is restored to its original size opening and closing are idempotent once an image has been opened, further openings with the same structuring element have no effect once an image has been closed, further closings with the same structuring element have no effect opening and closing are duals of each other with respect to complementation and reflection hit or miss transform probes both the inside and the outside of a region used for shape detection uses two structuring elements - s1 probes inside the regions - s2 probes outside the region other compound operations include boundary extraction region filling extraction of connected components convex hull thinning thickening skeletons pruning examples of morphological filtering optical character recognition analysis of a printed circuit board image analysis of cookies BinaryOpenUp.java BinaryCloseUp.java HitAndMiss.java application BinaryMorphologyTool application Grayscale morphology o apply morphological processing concepts to grayscale images o adds another dimension o visualize the image as a height field o the structuring element is now 3D - structuring function o erosion darkens image, reduces or eliminates small bright structure maximum distance the structuring element can be pushed up and stay under the height field computed as the minimum of the differences of neighborhood values and corresponding structuring element values structuring element of all zeros produces same result as the minimum rank filter o dilation lightens image, reduces or eliminates small dark structure structuring element must be reflected (if not symmetrical) minimum distance the structuring element must be pushed up to be above the height field computed as the maximum of the sums of neighborhood values and corresponding (reflected) structuring element values structuring element of all zeros produces the same result as the maximum rank filter o opening defined as before - erosion followed by dilation reduces or eliminates small bright structure, leaving dark features undisturbed o closing defined as before - dilation followed by erosion reduces or eliminates small dark structure, leaving bright features undisturbed o compound operations morphological smoothing opening followed by closing attenuates both bright and dark artifacts or noise morphological gradient subtract erosion from dilation of image highlights sharp gray-level transitions top-hat transformation name comes from use of a cylindrical structuring element with a flat top subtract the opening of an image from the original image leaves just the small bright structure o GreyStructElement.java o GreyErodeOp.java o GreyDilateOp.java o GreyOpenOp.java o GreyCloseOp.java