ImageForestingComponents

ImageForestingComponents[image]
finds a segmentation of image, returning an integer matrix in which positive integers label different components.

ImageForestingComponents[image, marker]
tries to find a segmentation into components that include pixels indicated by marker.

ImageForestingComponents[image, marker, r]
finds components that are connected at a pixel scale given by r.

DetailsDetails

  • ImageForestingComponents[image, marker] generates a graph-based segmentation of image, starting with the pixels specified by marker.
  • In ImageForestingComponents[image, marker], marker can be given either as an image, a graphics object, or a list of points in the standard image coordinate system, where x runs from 0 to image width and y runs from 0 to image height, and position corresponds to the bottom-left corner of the image.
  • Nonzero elements of marker are treated as weighted seeds for the segmentation.
  • ImageForestingComponents produces a complete segmentation, assigning each pixel to a foreground component.
  • ImageForestingComponents works with binary, grayscale, and arbitrary multichannel images.
  • ImageForestingComponents[image, marker, r] generates a segmentation where pixels in each component are connected within the radius r. The default radius setting is 2.
  • ImageForestingComponents[image, marker, {r1, r2}] specifies different radii in vertical and horizontal directions.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

Segment a color image:

In[1]:=
Click for copyable input
Out[1]=

Find a binary segmentation by specifying two seed points:

In[1]:=
Click for copyable input
Out[1]=

Use a rectangular neighborhood to segment lines of a text:

In[1]:=
Click for copyable input
Out[1]=
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »