GrowCutComponents[image,{marker1,marker2,…}]
creates a segmentation from image by growing each markeri.
GrowCutComponents[video,…]
returns segmentation for each frame in video.
GrowCutComponents
GrowCutComponents[image,{marker1,marker2,…}]
creates a segmentation from image by growing each markeri.
GrowCutComponents[video,…]
returns segmentation for each frame in video.
Details and Options
- GrowCutComponents models the image using cellular automata where the automata evolution leads to an image segmentation.
- GrowCutComponents works with arbitrary 2D and 3D images.
- Each marker markeri can be given either as an image or a list of points in the standard image coordinate system.
- The following options can be specified:
-
CornerNeighbors True whether to include corner neighbors MaxIterations Automatic maximum number of iterations to use - With MaxIterations->Automatic the algorithm runs until convergence.
Examples
open all close allBasic Examples (1)
Scope (2)
Grow-cut binarization of a color image:
c = GrowCutComponents[i = [image], {[image], [image]}];
Colorize[c]Mask the image with the detected foreground area:
SetAlphaChannel[i, Image[c - 1]]img = [image];
m1 = Image3D[DiskMatrix[10, ImageDimensions[img]]];m2 = ImagePad[ConstantImage[0, ImageDimensions[img] - {2, 2, 1}], {{1, 1}, {1, 1}, {0, 1}}, 1];ArrayComponents[GrowCutComponents[img, {m2, m1}], 3, {1 -> 0, 2 -> 1}]//Image3DOptions (2)
CornerNeighbors (1)
By default, CornerNeighbors->True is used:
i = [image];
GrowCutComponents[i, {[image], [image]}]//ColorizeUse CornerNeighbors->False:
GrowCutComponents[i, {[image], [image]}, CornerNeighbors -> False]//ColorizeMaxIterations (1)
By default, the algorithm is iterated until convergence:
img = [image];m1 = [image];m2 = [image];
GrowCutComponents[img, {m1, m2}]//ColorizeSpecify the number of iterations:
img = [image];m1 = [image];m2 = [image];
GrowCutComponents[img, {m1, m2}, MaxIterations -> 10]//ColorizeApplications (3)
Use grow-cut segmentation to separate foreground and background in a complex image:
i = [image];markers = {[image], [image]};c = GrowCutComponents[i, markers];
SetAlphaChannel[i, Image[c - 1]]Separate foreground and background in an image:
i = [image];bg = [image];fg = [image];mask = Image[GrowCutComponents[i, {bg, fg}] - 1]Use the binary mask as an alpha channel:
SetAlphaChannel[i, mask]Blur the binary mask for a smoother separation of foreground and background:
SetAlphaChannel[i, Blur[mask]]Place the detected foreground on a different background:
i = [image];m1 = [image];m2 = [image];fg = SetAlphaChannel[i, Image[GrowCutComponents[i, {m1, m2}] - 1]]Compose image foreground to a new background:
background = [image];ImageCompose[background, fg]Properties & Relations (3)
Switching the foreground and background marker will result in the complement mask:
i = [image];m1 = [image];m2 = [image];GrowCutComponents[i, {m1, m2}]//ColorizeGrowCutComponents[i, {m2, m1}]//ColorizeNot all pixels are necessarily segmented:
i = [image];marker1 = [image];marker2 = [image];GrowCutComponents[i, {marker1, marker2}]//ColorizeUse ArrayComponents to relabel the array and convert the label matrix into an Image object:
c = GrowCutComponents[i = [image], {[image], [image]}];ArrayComponents[c, 2, {1 -> 0, 2 -> 1}]//ImageRelated Guides
Text
Wolfram Research (2014), GrowCutComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/GrowCutComponents.html (updated 2025).
CMS
Wolfram Language. 2014. "GrowCutComponents." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/GrowCutComponents.html.
APA
Wolfram Language. (2014). GrowCutComponents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GrowCutComponents.html
BibTeX
@misc{reference.wolfram_2026_growcutcomponents, author="Wolfram Research", title="{GrowCutComponents}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/GrowCutComponents.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_growcutcomponents, organization={Wolfram Research}, title={GrowCutComponents}, year={2025}, url={https://reference.wolfram.com/language/ref/GrowCutComponents.html}, note=[Accessed: 13-June-2026]}