gives a version of image with all extended minima filled.


fills extended minima in regions where at least one corresponding element of marker is nonzero.


fills only extended minima of depth h or less.

Details and Options

  • 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:
  • CornerNeighborsTruewhether to include corner neighbors
    Padding0padding method to use
  • For grayscale images, FillingTransform[image,h,Padding->1] effectively computes the h-minima transform.


open allclose all

Basic Examples  (2)

Fill holes in a binary image:

Fill a hole in a 3D image:

Scope  (3)

Fill all image holes:

Use a marker to specify the holes to be filled:

Compute the h-minima transform of a grayscale image by filling shallow, dark regions:

Applications  (4)

Fill the holes of objects in an image:

Find the innermost components in a binary image:

Use the dilated innermost components to fill the innermost holes:

Use hole-filling as a preprocessing step for image segmentation:

Remove background features from an astronomical image:

Neat Examples  (1)

Create an artistic effect by extracting areas that have local minima:

Wolfram Research (2010), FillingTransform, Wolfram Language function, (updated 2012).


Wolfram Research (2010), FillingTransform, Wolfram Language function, (updated 2012).


Wolfram Language. 2010. "FillingTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012.


Wolfram Language. (2010). FillingTransform. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_fillingtransform, author="Wolfram Research", title="{FillingTransform}", year="2012", howpublished="\url{}", note=[Accessed: 22-May-2024 ]}


@online{reference.wolfram_2024_fillingtransform, organization={Wolfram Research}, title={FillingTransform}, year={2012}, url={}, note=[Accessed: 22-May-2024 ]}