HitMissTransform [image,ker]
gives the hit-or-miss transform of image with respect to the composite structuring element ker.
HitMissTransform [image,{ker1,ker2,…}]
gives the union of the hit-or-miss transforms for all the structuring elements keri.
HitMissTransform [image,{ker1,ker2,…},t]
treats values above t as foreground.
HitMissTransform
HitMissTransform [image,ker]
gives the hit-or-miss transform of image with respect to the composite structuring element ker.
HitMissTransform [image,{ker1,ker2,…}]
gives the union of the hit-or-miss transforms for all the structuring elements keri.
HitMissTransform [image,{ker1,ker2,…},t]
treats values above t as foreground.
Details and Options
- HitMissTransform is an image morphology operation that is commonly used to detect positions where a specific pattern such as a corner or an endpoint occurs in the image.
- HitMissTransform works with arbitrary 2D and 3D images.
- The composite structuring element ker is a matrix containing (foreground), (background), and (don't care) elements.
- The structuring element is automatically padded with zeros to have odd dimensions.
- HitMissTransform takes a Padding option. The default setting is Padding->1.
Examples
open all close allBasic Examples (5)
Find all foreground pixels that are below a background pixel:
Find runs of three foreground pixels below three background pixels:
Find bottom-right corners:
Find all corners by specifying four structuring elements:
Find the larger disks:
Scope (9)
Data (4)
Find background pixels on top of foreground pixels:
On a grayscale image, all values above 0 are treated as foreground:
Specify a different foreground/background threshold:
On a color image, all values above 0 are treated as foreground:
Specify a different foreground/background threshold:
Hit-or-miss transformation of a 3D image:
Kernel (5)
Find all foreground locations that fit a uniform structuring element:
Find all background locations that fit a uniform structuring element:
Find a specific pattern of foreground and background pixels:
Find corners using four structuring elements:
Use a 3D composite structuring element that exactly matches the shape and size of a foreground object:
Related Guides
Text
Wolfram Research (2008), HitMissTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/HitMissTransform.html (updated 2012).
CMS
Wolfram Language. 2008. "HitMissTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/HitMissTransform.html.
APA
Wolfram Language. (2008). HitMissTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HitMissTransform.html
BibTeX
@misc{reference.wolfram_2025_hitmisstransform, author="Wolfram Research", title="{HitMissTransform}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/HitMissTransform.html}", note=[Accessed: 06-January-2026]}
BibLaTeX
@online{reference.wolfram_2025_hitmisstransform, organization={Wolfram Research}, title={HitMissTransform}, year={2012}, url={https://reference.wolfram.com/language/ref/HitMissTransform.html}, note=[Accessed: 06-January-2026]}