HIT_MISS Function (PV-WAVE Extreme Advantage)

Performs the morphologic hit-or-miss transform for shape processing.

Usage

result = HIT_MISS(image, hit_structure, miss_structure
[, xhit, yhit][, xmiss, ymiss])

Input Parameters

image—A 2D array.

hit_structure—A 1D or 2D array containing the structuring element to apply to the original (un-complemented) image. The structuring elements are considered to be binary values (either 0 or nonzero), unless the Gray keyword is specified.

miss_structure—A 1D or 2D array containing the structuring element to apply to the complemented image. The structuring elements are considered to be binary values (either 0 or nonzero), unless the Gray keyword is specified.

xhit—(optional) The x-coordinate of the origin of hit_structure.

yhit—(optional) The y-coordinate of the origin of hit_structure.

xmiss—(optional) The x-coordinate of the origin of miss_structure.

ymiss—(optional) The y-coordinate of the origin of miss_structure.

Returned Value

result—The hit-or-miss transformed image, a byte array of the same size and dimensions as image.

Keywords

Gray—If set, grayscale erosion is used rather than binary erosion.

Hit_Values—An array of the same dimensions and number of elements as hit_structure, containing the hit-structuring element values.

Miss_Values—An array of the same dimensions and number of elements as miss_structure, containing the miss-structuring element values.

Discussion

Morphological operations are defined for grayscale byte images. If image is not originally of type byte, PV‑WAVE makes a temporary copy of image that is of type byte before using it for the morphological processing.

The morphological hit-or-miss transform is useful for object and character recognition, because it can be used to identify features of a binary object. The hit-or-miss operator is defined as the intersection between the eroded image (eroded using the hit_structure parameter) with the eroded image complement (using the miss_structure parameter). Optimum results are obtained when hit_structure and miss_structure are disjoint. In other words, nonzero values of hit_structure are zero in miss_structure, and vice-versa.

Example

hit_struct = BYTARR(5, 5)
hit_struct(*) = 1B
hit_struct(1:3, 1:3) = 0B
miss_struct = NOT(hit_struct) - 254B
test_image = IMAGE_READ(!IP_Data + 'squares.tif')
hitmiss_image = HIT_MISS(test_image('pixels'), hit_struct, $
miss_struct)

See Also

MORPH_CLOSE, MORPH_OPEN, MORPH_OUTLINE, SKELETONIZE, TOP_HAT

In the PV‑WAVE Reference:  DILATE,  ERODE