HIT and MISS Hit or Miss Transformation Hit

  • Slides: 37
Download presentation
HIT and MISS

HIT and MISS

Hit or Miss Transformation • “Hit or Miss” Called also “Hit and Miss” is

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 B 1) B 1 (Ac B 2) B 2 – A eroded by B 1, intersection A complement eroded by B 2 (two different structuring elements)

Hit or Miss Example: Find cross shape pixel configuration 0 1 1 1 0

Hit or Miss Example: Find cross shape pixel configuration 0 1 1 1 0 MATLAB Function: C = bwhitmiss(A, B 1, B 2) bwhitmiss

Original Image A and B 1 A eroded by B 1 Complement of Original

Original Image A and B 1 A eroded by B 1 Complement of Original Image and B 2 Erosion of A complement And B 2 Intersection of eroded images From: Digital Image Processing, Gonzalez, Woods And Eddins

Hit or Miss • Have all the pixels in B 1, but none of

Hit or Miss • Have all the pixels in B 1, but none of the pixels in B 2

Hit or Miss Example #2 • Locate upper left hand corner pixels of objects

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) B 1 = 0 0 1 1 0 B 2 = 1 1 0 0 Don’t Care about SE

Hit or Miss in Matlab G = bwhitmiss(f, B 1, B 2); Figure, imshow(g)

Hit or Miss in Matlab G = bwhitmiss(f, B 1, B 2); 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

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); >> g 2 = bwmorph(f, ‘thin’, 2); >> g 3 = bwmorph(f, ‘thin’, Inf);

Chapter 9 Morphological Image Processing Input From: Digital Image Processing, Gonzalez, Woods And Eddins

Chapter 9 Morphological Image Processing Input From: Digital Image Processing, Gonzalez, Woods And Eddins >> f = imread(‘fingerprint_cleaned. tif’); >> g = bwmorph(f, ‘thin’, 1); >> g 2 = bwmorph(f, ‘thin’, 2); >> g 3 = bwmorph(f, ‘thin’, Inf);

From: Digital Image Processing, Gonzalez, Woods And Eddins

From: Digital Image Processing, Gonzalez, Woods And Eddins

Hit-and-miss Transform is used for “Pattern Matching” • Hit and Miss is used to

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 0 s and 1 s!!

Example for a Hit-and-miss Structuring Element • Contains 0 s, 1 s and don’t

Example for a Hit-and-miss Structuring Element • Contains 0 s, 1 s 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

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-andmiss Transform • Structuring Elements representing four corners

EXAMPLE: Corner Detection with Hit-andmiss Transform • Structuring Elements representing four corners

Corner Detection with Hit-andmiss Transform 1. Apply Hit-&-Miss with each Structuring Element 2. Use

Corner Detection with Hit-andmiss Transform 1. Apply Hit-&-Miss with each Structuring Element 2. Use OR operation to combine the four results Allows to describe approximate shape of an object

Basic THINNING

Basic THINNING

1. Used to remove selected foreground pixels from binary images 2. After edge detection,

1. Used to remove selected foreground pixels from binary images 2. After edge detection, lines are often thicker than one pixel. 3. Thinning can be used to thin those line to one pixel width. Thinning

Definition of Thinning • Let K be a kernel and I be an image

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!

Example Thinning with two H&M transforms We use two Hit-and-miss Transforms 0 0

Example Thinning with two H&M transforms We use two Hit-and-miss Transforms 0 0

Basic THICKENING

Basic THICKENING

Thickening • Used to grow selected regions of foreground pixels • E. g. applications

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

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

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

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

Objects in Images In many cases we want to find some known objects in images Image containing ten objects From: Digital Image Processing, Gonzalez, Woods And Eddins A subset of pixels from the Image

Finding objects in pictures Pixel p and its diagonal neighbors Pixel p and its

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

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

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) Marker image Intermediate image after 100 iterations

Morphological Reconstruction Original image (the mask) Marker image Intermediate image after 100 iterations

Morphological Reconstruction Chapter 9 Morphological Image Processing

Morphological Reconstruction Chapter 9 Morphological Image Processing

Translation and Reflection From: Digital Image Processing, Gonzalez, Woods And Eddins

Translation and Reflection From: Digital Image Processing, Gonzalez, Woods And Eddins

Reflection • Dilation definition: definition “Dilation of A by B is the set consisting

Reflection • Dilation definition: 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 TO THINK

PROBLEMS TO THINK

Images of lanes and corridors

Images of lanes and corridors

Problems 1. Consider the images on slide 17! Why are the images getting darker

Problems 1. Consider the images on slide 17! Why are the images getting darker under erosion? Explain! 2. Consider the images on slide 31! Why are the intensities becoming more uniform? Explain! 3. Compare Dilatation and Erosion! How are they related? Verify your answers with Matlab! 4. Apply Erosion and Dilatation for noise removal! 5. Consider slide 38: Remove the artefacts remaining with the horizontal lines.

Problems 6. Derive dilatation and erosion from the Hitand-miss transformation 7. How to use

Problems 6. Derive dilatation and erosion from the Hitand-miss transformation 7. 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 1. Volker Krüger 2. Rune Andersen 3. . Roger S. Gaborski

Sources Used 1. Volker Krüger 2. Rune Andersen 3. . Roger S. Gaborski