MORPH_HITORMISS
Syntax | Return Value | Arguments | Keywords | Example | Version History | See Also
The MORPH_HITORMISS function applies the hit-or-miss operator to a binary image. The hit-or-miss operator is implemented by first applying an erosion operator with a hit structuring element to the original image. Then an erosion operator is applied to the complement of the original image with a secondary miss structuring element. The result is the intersection of the two results.
This routine is written in the IDL language. Its source code can be found in the file morph_hitormiss.pro in the lib subdirectory of the IDL distribution.
Syntax
Result = MORPH_HITORMISS (Image, HitStructure, MissStructure)
Return Value
The resulting image corresponds to the positions where the hit structuring element lies within the image, and the miss structure lies completely outside the image. The two structures must not overlap.
Arguments
Image
A one-, two-, or three-dimensional array upon which the morphological operation is to be performed. The image is treated as a binary image with all nonzero pixels considered as 1.
HitStructure
A one-, two-, or three-dimensional array to be used as the hit structuring element. The elements are interpreted as binary values — either zero or nonzero. This structuring element must have the same number of dimensions as the Image argument.
MissStructure
A one-, two-, or three-dimensional array to be used as the miss structuring element. The elements are interpreted as binary values — either zero or nonzero. This structuring element must have the same number of dimensions as the Image argument.
Note
It is assumed that the HitStructure and the MissStructure arguments are disjoint.
Keywords
None.
Example
Note
Also see Selecting Specific Image Objects (Image Processing in IDL).
The following code snippet identifies blobs with a radius of at least 2, but less than 4 in the pollen image. These regions totally enclose a disc of radius 2, contained in the 5 x 5 kernel named "hit", and in turn, fit within a hole of radius 4, contained in the 9 x 9 array named "miss". Executing this specific example identifies four blobs in the image with these attributes.
The example code is broken into several sections; click on all the sections to execute the code in IDL.
Next, display the original image:
Display the thresholded image and compute the matches and display them:
Version History
See Also
DILATE, ERODE, MORPH_CLOSE, MORPH_DISTANCE, MORPH_GRADIENT, MORPH_OPEN, MORPH_THIN, MORPH_TOPHAT