This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


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.
  • An extended minimum is a connected set of pixels surrounded by pixels which 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.
  • FillingTransform by default treats all eight pixels surrounding a given pixel as adjacent.
  • In FillingTransform, marker can be given as a matrix or an image of the same dimensions as image.
  • The option setting CornerNeighbors->False treats only the four pixels in the coordinate directions as adjacent.
Fill holes in a binary image:
Fill holes in a binary image:
Click for copyable input
Use a marker to specify the holes to be filled:
Compute the h-min transform of a grayscale image by filling shallow dark regions:
Use hole-filling as a preprocessing step for image segmentation:
Remove background features from an astronomical image:
Find the innermost components in a binary image:
Use dilated innermost components to fill the innermost holes:
Create an artistic effect by extracting areas that have local minima:
New in 8