written 8.4 years ago by |
The Hit or Miss Transform is the morphological operator used for finding local patterns of pixels i.e. the size of the structuring element.
Method:
Method is quite simple .A small odd sized mask(structuring element ),typically 3x3 is scanned over a binary image. If the binary-valued pattern of the structuring element matches the state of the pixels under the structuring element(HIT),the output pixel in spatial correspondence to the center pixel of the structuring element is set to some desired binary state (usually 1).If the binary pattern of the structuring element does not match the state of the pixels under the structuring element(MISS), the output pixel in the spatial correspondence to the center pixel of the structuring element is set to the opposite binary state(usually 0).
Let $B = (B_1,B_2)$ be the structuring element.Here $B_1$ is a set formed from elements of B Associated with the objects and $B_2$ is a set of elements of B associated with the corresponding background.$B = (B_1,B_2)$ is called a composite structuring element.The HIT and MISS transformation of a set A with structuring element B is given by the equation
$A \otimes B={a|B_1ЄA and B_2ЄA^c}$
Where A is the image set ,$A^c$ is the complement of the image set and B is the structuring elements.
Example: Consider a 10x10 image, apply Hit or Miss transform.
Using the following structuring elements:
Note: Here, 1 represents foreground,0 represents background and x represents ‘don’t care ‘.
Solution:
Original Image:
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Hit or Miss using $B_1: I_1$
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
---|---|---|---|---|---|---|---|---|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0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: If the foreground and background pixels in the structuring element exactly match the foreground and background pixels in the image, then the pixels underneath the origin of the structuring element is set to foreground colour. If it doesn’t match, that pixel is set to background colour.