Hit-or-miss transform explained

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.

Mathematical definition

Rd

or the integer grid

Zd

, 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.

Let

C

and

D

be two structuring elements satisfying

C\capD=\emptyset

. The pair (C,D) is sometimes called a composite structuring element. The hit-or-miss transform of a given image A by B=(C,D) is given by:

A\odotB=(A\ominusC)\cap(Ac\ominusD)

,

where

Ac

is the set complement of A.

That is, a point x in E belongs to the hit-or-miss transform output if C translated to x fits in A, and D translated to x misses A (fits the background of A).

Structuring elements

The hit-or-miss transform uses pairs of structuring elements that are disjoint. Here are four common structuring elements used in various morphological operations.

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

Element 1

This mask identifies the bottom-left convex corner, with '1's indicating the corner and its surroundings, '0's representing the background, and 'X's as don't-care conditions. It is designed to match patterns where the corner pixel and the pixels directly adjacent form a specific configuration. This helps in locating the bottom-left convex corners in binary images.

----

Element 2

This mask identifies the top-left convex corner, with '1's indicating the corner and its surroundings, '0's representing the background, and 'X's as don't-care conditions. It is designed to match patterns where the corner pixel and the pixels directly adjacent form a specific configuration. This helps in locating the top-left convex corners in binary images.

----

Element 3

This mask detects the top-right convex corner, with a similar pattern of '1's for the corner and surroundings, '0's for the background, and 'X's as don't-care conditions. It is designed to match patterns where the corner pixel and the pixels directly adjacent form a specific configuration. This helps in locating the top-right convex corners in binary images.

----

Element 4

This mask targets the bottom-right convex corner, using '1's to mark the corner and its adjacent pixels, '0's for the background, and 'X's as don't-care conditions. It is designed to match patterns where the corner pixel and the pixels directly adjacent form a specific configuration. 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.

Some applications

Thinning

Let

E=Z2

, and consider the eight composite structuring elements, composed of:

C1=\{(0,0),(-1,-1),(0,-1),(1,-1)\}

and

D1=\{(-1,1),(0,1),(1,1)\}

,

C2=\{(-1,0),(0,0),(-1,-1),(0,-1)\}

and

D2=\{(0,1),(1,1),(1,0)\}

and the three rotations of each by 90°, 180°, and 270°. The corresponding composite structuring elements are denoted

B1,\ldots,B8

.

For any i between 1 and 8, and any binary image X, define

XBi=X\setminus(X\odotBi),

where

\setminus

denotes the set-theoretical difference.

The thinning of an image A is obtained by cyclically iterating until convergence:

AB1 ⊗ B2 ⊗ \ldotsB8 ⊗ B1 ⊗ B2 ⊗ \ldots

Other applications

Bibliography