FillingTransform[image]
gives a version of image with all extended minima filled.
FillingTransform[image,marker]
fills extended minima in regions where at least one corresponding element of marker is nonzero.
FillingTransform[image,h]
fills only extended minima of depth h or less.
FillingTransform
FillingTransform[image]
gives a version of image with all extended minima filled.
FillingTransform[image,marker]
fills extended minima in regions where at least one corresponding element of marker is nonzero.
FillingTransform[image,h]
fills only extended minima of depth h or less.
Details and Options
- FillingTransform, also known as morphological filling, can fill holes in binary images or local extended minima in grayscale and color images.
- An extended minimum is a connected set of pixels surrounded by pixels that all have a greater value than the pixels in the set.
- FillingTransform[image] fills all extended minima by lifting their values to the lowest value found among the surrounding pixels.
- The marker can be given as a matrix or an image of the same dimensions as image.
- FillingTransform works with arbitrary 2D and 3D images.
- The following options can be given:
-
CornerNeighbors True whether to include corner neighbors Padding 0 padding method to use - For grayscale images, FillingTransform[image,h,Padding->1] effectively computes the h-minima transform.
Examples
open all close allBasic Examples (2)
Scope (3)
FillingTransform[[image]]Use a marker to specify the holes to be filled:
FillingTransform[[image], [image]]Compute the h-minima transform of a grayscale image by filling shallow, dark regions:
FillingTransform[[image], .5, Padding -> 1]Applications (5)
Fill the holes of objects in an image:
i = [image];FillingTransform[i]Find the innermost components in a binary image:
i = [image];
m = SelectComponents[i, Length[#EmbeddedComponents] === 0&]Use the dilated innermost components to fill the innermost holes:
FillingTransform[i, Dilation[m, 1]]Use hole-filling as a preprocessing step for image segmentation:
WatershedComponents[FillingTransform[[image], .3]]//ColorizeRemove background features from an astronomical image:
img = [image];
ImageSubtract[img, ColorNegate@FillingTransform@ColorNegate[img]]Negate the image to fill bright holes (local maxima):
ColorNegate[FillingTransform[ColorNegate[[image]]]]Properties & Relations (1)
FillingTransform will not fill holes touching the borders of the image.
FillingTransform[[image]]Related Guides
Text
Wolfram Research (2010), FillingTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/FillingTransform.html (updated 2012).
CMS
Wolfram Language. 2010. "FillingTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/FillingTransform.html.
APA
Wolfram Language. (2010). FillingTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FillingTransform.html
BibTeX
@misc{reference.wolfram_2026_fillingtransform, author="Wolfram Research", title="{FillingTransform}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/FillingTransform.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_fillingtransform, organization={Wolfram Research}, title={FillingTransform}, year={2012}, url={https://reference.wolfram.com/language/ref/FillingTransform.html}, note=[Accessed: 12-June-2026]}