TopHatTransform[image,ker]
gives the morphological top-hat transform of image with respect to structuring element ker.
TopHatTransform[image,r]
gives the top-hat transform with respect to a range-r square.
TopHatTransform[data,…]
applies top-hat transform to an array of data.


TopHatTransform
TopHatTransform[image,ker]
gives the morphological top-hat transform of image with respect to structuring element ker.
TopHatTransform[image,r]
gives the top-hat transform with respect to a range-r square.
TopHatTransform[data,…]
applies top-hat transform to an array of data.
Details

- Top-hat transform is a morphological operation used for enhancing small bright regions in an image, and can be used to remove uneven background illumination or extract features.
- BottomHatTransform is effectively the same as subtracting the morphologically opened image from the image.
- TopHatTransform works with binary, grayscale, and other images.
- TopHatTransform works with 3D as well as 2D images, and also with data arrays of any rank.
- The structuring element ker is a matrix containing 0s and 1s.
- TopHatTransform automatically pads structuring elements to have odd dimensions.
- TopHatTransform[image,r] is equivalent to TopHatTransform[image,BoxMatrix[r]].
- If multiple image channels are present, TopHatTransform operates on each of them separately.
- TopHatTransform preserves regions smaller than the structuring element whose channel values are larger than their surroundings.
Examples
open all close allBasic Examples (4)
Applications (4)
Interactive Examples (1)
Use Manipulate to extract successively larger objects:
See Also
Related Guides
Text
Wolfram Research (2008), TopHatTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/TopHatTransform.html (updated 2012).
CMS
Wolfram Language. 2008. "TopHatTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/TopHatTransform.html.
APA
Wolfram Language. (2008). TopHatTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TopHatTransform.html
BibTeX
@misc{reference.wolfram_2025_tophattransform, author="Wolfram Research", title="{TopHatTransform}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/TopHatTransform.html}", note=[Accessed: 08-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_tophattransform, organization={Wolfram Research}, title={TopHatTransform}, year={2012}, url={https://reference.wolfram.com/language/ref/TopHatTransform.html}, note=[Accessed: 08-August-2025]}