2.5.5 Hit-and-Miss Transform

The hit-and-miss transform is a general binary (only) morphological operation that can be used to look for particular patterns of foreground and background pixels in an image. It takes a binary image but takes a trinary structuring element.

Operation - How It Works

The structuring element used in the hit-and-miss transform is extended. It contains 1's for foreground, 0's for background and spaces for don't care. If the foreground and background pixels in the structuring element exactly match foreground and background pixels in the image, then the pixel at the origin will become the foreground pixel, otherwise (no match) that pixel will be set to the background pixel. This transform is used to look for occurences of particular binary patterns in fixed orientations.

If we are interested in finding right angle convex corner points then we would apply the following four structuring elements and OR together the four results.

 1 
011
00 
 1 
110
 00
 00
110
 1 
00 
011
 1 

Hit-and-miss transforms are very sensitive to noise, so noise filtering should be done first. Beware of median which cuts corners!