590 likes | 1.24k Views
HIT and MISS. Hit or Miss Transformation. “Hit or Miss” Called also “Hit and Miss” is useful to identify specified configuration of pixels. For instance, such combinations as: isolated foreground pixels or pixels at end of lines (end points) A B = (A B1 ) (A c B2 )
E N D
Hit or Miss Transformation • “Hit or Miss” Called also “Hit and Miss” is useful to identify specified configuration of pixels. • For instance, such combinations as: • isolated foreground pixels • or pixels at end of lines (end points) • A B = (A B1) (AcB2) • A eroded by B1, intersection A complement eroded by B2 (two different structuring elements)
Hit or Miss Example: Find cross shape pixel configuration MATLAB Function: C = bwhitmiss(A, B1, B2)
Original Image A and B1 A eroded by B1 Complement of Original Image and B2 Erosion of A complement And B2 Intersection of eroded images From: Digital Image Processing, Gonzalez,Woods And Eddins
Hit or Miss • Have all the pixels in B1, but none of the pixels in B2
Hit or Miss Example #2 • Locate upper left hand corner pixels of objects in an image • Pixels that have east and south neighbors (Hits) and no NE, N, NW, W, SW Pixels (Misses) B1 = B2 = Don’t Care about SE
Hit or Miss in Matlab G = bwhitmiss(f, B1, B2); Figure, imshow(g) From: Digital Image Processing, Gonzalez,Woods And Eddins
bwmorph(f, operation, n) • Implements various morphological operations based on combinations of dilations, erosions and look up table operations. • Example: Thinning >> f = imread(‘fingerprint_cleaned.tif’); >> g = bwmorph(f, ‘thin’, 1); >> g2 = bwmorph(f, ‘thin’, 2); >> g3 = bwmorph(f, ‘thin’, Inf);
Chapter 9 Morphological Image Processing Input From: Digital Image Processing, Gonzalez,Woods And Eddins • >> f = imread(‘fingerprint_cleaned.tif’); • >> g = bwmorph(f, ‘thin’, 1); • >> g2 = bwmorph(f, ‘thin’, 2); • >> g3 = bwmorph(f, ‘thin’, Inf);
Hit-and-miss Transform is used for “Pattern Matching” • Hit and Miss is used to look for particular patterns of foreground and background pixels • It allows a recognition of very simple objects • All other morphological operations can be derived from it!! • Input: • Binary Image • Structuring Element, containing 0s and 1s!!
Example for a Hit-and-miss Structuring Element • Contains 0s, 1s and don’t care’s. • Usually a “1” at the origin!
Hit-and-miss Transform as pattern matching • It is one variant of a general to Pattern Matching approach: • If foreground and background pixels in the structuring element exactly match foreground and background pixels in the image, • then the pixel underneath the origin of the structuring element is set to the foreground color.
EXAMPLE: Corner Detection with Hit-and-miss Transform • Structuring Elements representing four corners
Corner Detection with Hit-and-miss Transform • Apply Hit-&-Miss with each Structuring Element • Use OR operation to combine the four results Allows to describe approximate shape of an object
Thinning • Used to remove selected foreground pixels from binary images • After edge detection, lines are often thicker than one pixel. • Thinning can be used to thin those line to one pixel width.
Definition of Thinning • Let K be a kernel and I be an image with 0-1=0!! • If foreground and background fit the structuring element exactly, then the pixel at the origin of the SE is set to 0 • Note that the value of the SE at the origin is 1 or don’t care!
We use two Hit-and-miss Transforms Example Thinning with two H&M transforms 0 0
Thickening • Used to grow selected regions of foreground pixels • E.g. applications like approximation of convex hull
Definition Thickening • Let K be a kernel and I be an image with 1+1=1 • If foreground and background match exactly the SE, then set the pixel at its origin to 1! • Note that the value of the SE at the origin is 0 or don’t care!
Example Thickening If foreground and background match exactly the SE, then set the pixel at its origin to 1! 1 1
Skeletonization From: Digital Image Processing, Gonzalez,Woods And Eddins Bone Image Skeleton obtained using function bwmorph Resulting Skeleton obtained after pruning with function endpoints
Objects in Images In many cases we want to find some known objects in images Image containing ten objects A subset of pixels from the Image From: Digital Image Processing, Gonzalez,Woods And Eddins
Finding objects in pictures Pixel p and its diagonal neighbors Pixel p and its 8- neighbors Pixel p and its 4-neighbors Pixels that are 8 adjacent but not 4 adjacent 4 and 8 adjacent pixels These pixels are 4 and 8 connected These pixels are 8 connected but not 4 connected From: Digital Image Processing, Gonzalez,Woods And Eddins
How many objects are really in a picture? From: Digital Image Processing, Gonzalez,Woods And Eddins
Connected Components Center of mass is another useful concept in object recognition From: Digital Image Processing, Gonzalez,Woods And Eddins
Morphological Reconstruction Original image (the mask) Intermediate image after 100 iterations Marker image
Morphological Reconstruction Chapter 9 Morphological Image Processing From: Digital Image Processing, Gonzalez,Woods And Eddins
Translation and Reflection From: Digital Image Processing, Gonzalez,Woods And Eddins
Reflection • Dilation definition: “Dilation of A by B is the set consisting of all structuring element origin locations where the reflected and translated B overlaps at least some portion of A” • If structuring element is symmetric with respect to origin, reflection of B has no effect
Problems • Consider the images on slide 17! Why are the images getting darker under erosion? Explain! • Consider the images on slide 31! Why are the intensities becoming more uniform? Explain! • Compare Dilatation and Erosion! How are they related? Verify your answers with Matlab! • Apply Erosion and Dilatation for noise removal! • Consider slide 38: Remove the artefacts remaining with the horizontal lines.
Problems • Derive dilatation and erosion from the Hit-and-miss transformation • How to use these all operations to find some good features in our FAB building corridors and halls so that the robot can recognize the object such as door or windows?
Sources Used Volker Krüger Rune Andersen . Roger S. Gaborski