Operator Library: Filter
The operator HitOrMiss performs a morphological hit-or-miss operation of the binary image, which can be used to identify structures or objects. The input is a kernel-stream (see e.g. FIRkernelNxM). The output link gives the calculated value for the center pixel. A structuring element for the hit-or-miss operation is given by a parameterizable matrix. The matrix has the size of the input kernel.
The output is set to '1' for a pixel if the kernel neighborhood of the pixel exactly matches with the pattern defined in the parameter StructElement. The output is set to '0' if there are one or more mismatches. The search pattern defined with parameter StructElement can be either 0 or 1 to define the match. Moreover, value -1 is allowed, too. It defines a don't care value for ignored parts in the structuring element. If all values in the search pattern are '-1' the behaviour depends on the static/dynamic property of StructElement. In the static case the result will always be 'miss'. In the dynamic case the result will always be 'hit'.
Let's have a look at an example. The following struct element is given.

We will match it with the following image I

If we match the structuring element with the image the output O is

To generate the required input kernel use operators such as FIRkernelNxM, LineNeighboursNx1 or PixelNeighbours1xM.
Link Parameter | Input Link I | Output Link O |
---|---|---|
Bit Width | 1 | as I |
Arithmetic | unsigned | as I |
Parallelism | any | as I |
Kernel Columns | any | 1 |
Kernel Rows | any | 1 |
Img Protocol | {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} | as I |
Color Format | VAF_GRAY | as I |
Color Flavor | FL_NONE | as I |
Max. Img Width | any | as I |
Max. Img Height | any | as I |
StructElement | |
---|---|
Type | static/dynamic read/write parameter |
Default | -1 |
Range | {-1, 0, 1} |
This parameter defines the shape of the structuring element.
If the input kernel size of the operator is changed, the coefficients will also change. Check the coefficients after changing the input kernel size. If the parameter is set to Static, the values are selected at design time. If the parameter is Dynamic, it is possible to alter the values during runtime. Changes during runtime take effect immediately, they are not synchronized to end of frame or end of line. |
The use of operator HitOrMiss is shown in the following examples:
-
Examples - The implementation can detect four simple patterns in a binary image. For every match, the output will be set to one.