370 likes | 840 Views
MATHEMATICAL MORPHOLOGY. Introduction. Morphology commonly denotes a branch of biology that deals with the form and structure of animals and plants Morphology is particularly useful for analyzing shapes in images. Basic Ideas (1). Translation
E N D
Introduction • Morphology commonly denotes a branch of biology that deals with the form and structure of animals and plants • Morphology is particularly useful for analyzing shapes in images
Basic Ideas (1) • Translation • A is a set of pixels in a binary image • W = (x,y) is a particular coordinate point. • AW is the set A translated in direction (x,y) • Example: w=(2, 2) Aw=A(2,2)
Basic Ideas (2) • Reflection • Example: • The open and closed circles form sets that are reflections of each other
Dilation of A by B, written A B, is defined as B is called a structuring element For every point x B, we translate A by those coordinates and take the union of all these translations Equivalent definition Example It is not necessarily true that original object A will lie within its dilation A B (example) Dilation is commutative A B = B A Dilation
A B = Erosion • Erosion of A by B, written A B, is defined as: • The erosion of A by B consists of all points w = (x,y) for which Bw is in A • We can move B over A, find all the places it will fit, and for each such place mark down the corresponding (0,0) point of B. The set of all such points will form the erosion • It is not necessarily true that A B will lie within original object A • Erosion is related to Minkowski subtraction A B • Example
Dilation and Erosion • The complement of an erosion is equal to the dilation of the complement. Thus, • Example (1) A (2) A B (3) (A B)’ (4) A’ (5) A’ B^
Boundary Detection • If A is an image and B a small structuring element consisting of pints symmetrically placed about the origin, we can then define three boundaries of A : • 1. Internal boundary • 2. External boundary • 3. Morphological gradient
Internal boundary • The internal boundary consists of those pixels in A that are at its edge • It is defined as A – ( A B ) A – ( A B )
External boundary • The external boundary consists of pixels outside A that are just next to it • It is defined as ( A B ) - A
Morphological gradient • The morphological gradient is a combination of both the internal and external boundaries. • It is defined as ( A B ) – ( A B )
Boundary Detection - Example Rice image Internal boundary External boundary Morphological gradient
Opening • The opening of A by B, denoted A◦B, is defined as A◦B = ( A B ) B • An equivalent definition is • Opening is the union of all translations of B that fit inside A • The difference with erosion: the erosion consists only of the (0,0)point of B for those translations that fit A. The opening consists of all of B • Example
Opening • Opening tends to smooth an image, to break narrow joins, and to remove thin protrusions.
Closing • The closing of A by B, denoted AB, is defined as AB = ( A B ) B • Example • Closing also tends to smooth an image, but it fuses narrow breaksand thin gulfs and eliminates small holes.
Noise Removal • A is a binary image corrupted by impulse noise (some of the black pixels are white, and some of the white pixels are black).
A B Noise Removal • Solution • Step 1:using erosion to remove the single black pixels, but will enlarge the holes • Step 2:fill the holes by dilating twice, then return the holes to their original size • ((A B) B) B ((A B)B)B (A B)B
Noise Removal • Solution • The second dilation will enlarge the objects in the image. • Step 3:to reduce them to their correct size, perform a final erosion • (((A B) B) B) B equal to ((A◦B)B) is called morphological filtering Original image Morphological filtering result
Opening and Closing • Opening and closing share a relationship very similar to that of erosion and dilation. • The complement of an opening is equal to the closing of a complement, and the complement of closing is equal to the opening of a complement.
Hit-or-Miss Transform • The hit-or-miss transform is a powerful method for finding shapes in images. • Example – locate 3*3 square shapes B1 B2
Hit-or-Miss Transform: example (1) A (2) A B (3) A’ (4) A’ C (5) B (6) C (7)
Region Filling • An image with region bounded by an 8-connected boundary. • Given a pixel p within the region, we wish to fill up the entire region.
Region Filling • We create a sequence of sets Ps. Using cross-shaped kernel
Connected Components • Using a very similar algorithm to fill a connected component • Example
Connected Components Original image Using 3*3 square kernel Using 11*11 square kernel
Skeletonization • The skeleton of a binary object is a collection of lines and curves that encapsulate the size and shape of the object.
Erosion Example Grayscale Morphology
Grayscale Morphology • Dilation • Example
Grayscale Morphology • example Erosion Original image Dilation
Opening and Closing • Opening is an erosion followed by a dilation, and closing is a dilation followed by an erosion.
Opening and Closing • Example Closing Original image Opening