performs a global segmentation of image and returns a label matrix of components.


segments an image into components based on the given spec.

Details and Options

  • ImageSegmentationComponents is a high-level image segmentation that can either segment the whole image or segment specified objects and components in an image.
  • The following specifications spec can be given:
  • possegments a component specified by an {x,y} coordinate
    {pos1,pos2,}attempts to segment the image into components corresponding to every posi
    {{pos11,pos12,},{pos21,},}specify each component with a list of positions
    Rectangle[]specify each component with a bounding box
    {Rectangle[],Rectangle[],}a list of bounding boxes, one for each component
  • When multiple positions or rectangles are provided, a segment is computed for every marker. If different markers generate significantly overlapping components, the less dominant segment will be suppressed.
  • The following options can be given:
  • PerformanceGoal Automaticaspects of performance to try to optimize
    TargetDevice"CPU"the target device on which to perform training
  • Possible settings for PerformanceGoal include:
  • Automaticautomatic tradeoff between speed and quality
    "Quality"optimize for quality of final results
    "Speed"optimize for speed of getting results


open allclose all

Basic Examples  (1)

Segment an image:

Scope  (3)

Segment an image and colorize the label matrix:

Highlight segments on the image:

Generate a mask for a segment indicated by a list of positions:

Highlight the specified target points as well as the segmentation on the image:

Generate a mask for a segment inside a bounding box:

Highlight the bounding box as well as the segmentation on the image:

Options  (1)

PerformanceGoal  (1)

By default, a medium-speed model with moderate quality is used:

Aim for speed, but this typically results in lower quality:

Aim for high quality, but this typically leads to slower results:

Applications  (3)

Segment repeating components in an image:

Segment an x-ray or other image modalities:

Segment a region selected by points:

Wolfram Research (2023), ImageSegmentationComponents, Wolfram Language function,


Wolfram Research (2023), ImageSegmentationComponents, Wolfram Language function,


Wolfram Language. 2023. "ImageSegmentationComponents." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2023). ImageSegmentationComponents. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_imagesegmentationcomponents, author="Wolfram Research", title="{ImageSegmentationComponents}", year="2023", howpublished="\url{}", note=[Accessed: 12-July-2024 ]}


@online{reference.wolfram_2024_imagesegmentationcomponents, organization={Wolfram Research}, title={ImageSegmentationComponents}, year={2023}, url={}, note=[Accessed: 12-July-2024 ]}