({{, (RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents])[image] 
finds a segmentation of image, returning an integer matrix in which positive integers label different components.}, {, (RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents])[image,marker]
tries to find a segmentation into components that include pixels indicated by marker.}, {, (RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents])[image,marker,r]
finds components that are connected at a pixel scale given by r.}})

OpenersNotesSection(Spacer1)Details

(RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents])[image,marker] generates a graph-based segmentation of image, starting with the pixels specified by marker.

(RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents]) works with arbitrary 2D and 3D images.

The target region marker can be any of the following:

Positions (Subscript[pos, i]) are assumed to be in the standard image coordinate system.

Nonzero elements of marker are treated as weighted seeds for the segmentation.

(RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents]) produces a complete segmentation, assigning each pixel to a foreground component.

(RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents])[image,marker,r] generates a segmentation where pixels in each component are connected within the radius r. The default radius setting is 2.

(RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents])[image,marker,{(Subscript[r, 1]),(Subscript[r, 2])}] specifies different radii in vertical and horizontal directions.

OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Segment a color image:

ImageForestingComponents[]//Colorize

Segment components in a 3D volume:

if=ImageForestingComponents[ExampleData[{"TestImage3D","CTengine"}]];
Colorize[if-1]

OpenersExampleSection1(Spacer1)Scope  (2)

Use a set of marker positions as the marker:

ImageForestingComponents[,{{10,10},{150,150}}]//Colorize

Use a marker image:

ImageForestingComponents[,]//Colorize

Separate objects in an image:

i=;

ImageForestingComponents[i]//Colorize

Use a larger connectivity radius:

ImageForestingComponents[i,Automatic,10]//Colorize

Use a horizontally long connectivity:

ImageForestingComponents[i,Automatic,{10,1}]//Colorize

Use a vertically long connectivity:

ImageForestingComponents[i,Automatic,{1,10}]//Colorize

OpenersExampleSection3(Spacer1)Applications  (4)

Segment an image using a set of seeds:

ImageForestingComponents[,{{84,102},{56,104},{14,99},{4,99}}]//Colorize

Determine a region of interest in a 3D image with (RefLink[ImageForestingComponents, paclet:ref/ImageForestingComponents]) using markers:

vol=;mask=ImageForestingComponents[vol,{{1,1,124},{102,1,1}}];

Use this mask to highlight the organs in the image:

vol2=ImageMultiply[Image3D[Erosion[mask-1,2]],vol];
seg1=MorphologicalComponents[vol2,0.075];
Colorize[seg1]

Use a rectangular neighborhood to segment lines of a text:

ImageForestingComponents[,Automatic,{20,5}]//Colorize

Segment different words in a group of text:

ImageForestingComponents[,Automatic,{10,5}]//Colorize

Segment lines of text:

ImageForestingComponents[,Automatic,{30,5}]//Colorize

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ClusteringComponents, paclet:ref/ClusteringComponents])  ▪  (RefLink[WatershedComponents, paclet:ref/WatershedComponents])  ▪  (RefLink[MorphologicalComponents, paclet:ref/MorphologicalComponents])  ▪  (RefLink[ComponentMeasurements, paclet:ref/ComponentMeasurements])  ▪  (RefLink[Colorize, paclet:ref/Colorize])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Segmentation Analysis, paclet:guide/SegmentationAnalysis])}, {▪(RefLinkPlain[Cluster Analysis, paclet:guide/ClusterAnalysis])}, {▪(RefLinkPlain[Computational Photography, paclet:guide/ComputationalPhotography])}})}})