image = | hitAndMiss2dImg (inBinImg,inForegroundSEXY,inBackgroundSEXY) |
Look for particular patterns of foreground and background given as structuring elements.
The Hit and Miss, also known as Hit or Miss, is a binary morphological operation used to find a particular pattern. This algorithm generates a binary image where pixels with the value 1 (or true) match the pattern given by the foreground and background structuring elements.
The foreground structuring element contains relative coordinates in the current pixel neighbourhood whith an intensity of 1, whereas the background structuring element determines the pixels that must have an intensity of 0. If a pixel can indefferently equal 0 or 1, its coordinate is not specified. Obviously, a pixel coordinate can not appear in both structuring elements.
The figure below illustrate an example where two patterns can be accepted by the algorithm. The object must describe a 3x3 cross but allows the top-right neigbhour to either belong to the foreground or the background since it is absent in both structuring elements.
Here is the result of the hit and miss operation applied to a binary input image (we are here looking for top left corners) :