Hit-or-miss transform

In mathematical morphology, hit-or-miss transform is an operation that detects a given configuration (or pattern) in a binary image, using the morphological erosion operator and a pair of disjoint structuring elements.

The result of the hit-or-miss transform is the set of positions where the first structuring element fits in the foreground of the input image, and the second structuring element misses it completely.

In binary morphology, an image is viewed as a subset of a Euclidean space

, for some dimension d. Let us denote this space or grid by E. A structuring element is a simple, pre-defined shape, represented as a binary image, used to probe another binary image, in morphological operations such as erosion, dilation, opening, and closing.

The hit-or-miss transform uses pairs of structuring elements that are disjoint.

Following structuring elements can be used to find different convex corner points in images.

This helps in locating the bottom-left convex corners in binary images.

This helps in locating the top-left convex corners in binary images.

This helps in locating the top-right convex corners in binary images.

This helps in locating the bottom-right convex corners in binary images.

After obtaining the locations of corners in each orientation, we can then simply OR(Logic OR) all these images together to get the final result showing the locations of all right angle convex corners in any orientation.

Mask one for Hit or Miss Transformation
Mask two for Hit or Miss Transformation
Mask three for Hit or Miss Transformation
Mask four for Hit or Miss Transformation
The structuring elements Ci, Di, Bi as described in the text. The top two rows show the pairings of C1+D1, and C2+D2. The bottom two rows show how B1-B8 are generated by rotating (C1+D1) and (C2+D2). The numbering of B1-B8 are arbitrary. (White pixels are not included in any of these sets, and are shown only to keep the spacing intelligible. Red and Blue pixels identify set membership only, and do not represent a pixel's actual color value.)