MLKitSegmentationCommon Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
Segmenter
class Segmenter : NSObject
A detector that performs segmentation on input images.
-
Returns a segmenter with the given options.
Declaration
Swift
class func segmenter(options: MLKCommonSegmenterOptions) -> Self
Parameters
options
|
Options for configuring the segmenter.
|
Return Value
A segmenter configured with the given options.
-
Unavailable. Use the class methods.
-
Processes the given image for segmentation.
Parameters
image
|
|
completion
|
Handler to call back on the main thread with the segmentation mask or error.
|
-
Returns the segmentation mask in the given image or nil
if there was an error. The segmentation
is performed synchronously on the calling thread.
It is advised to call this method off the main thread to avoid blocking the UI. As a
result, an NSException
is raised if this method is called on the main thread.
Parameters
image
|
The image to get results in.
|
error
|
An optional error parameter populated when there is an error getting results.
|
Return Value
The segmentation mask in the given image or nil
if there was an error.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["The `Segmenter` class performs segmentation on input images to identify different regions or objects."],["It provides methods for asynchronous and synchronous processing of images for segmentation."],["You can configure the segmenter using `MLKCommonSegmenterOptions` when initializing."],["Results are provided as an `MLKSegmentationMask` object which can be used to understand the identified segments."],["Direct instantiation with `init` is unavailable; use the provided class methods like `segmenter(options:)` instead."]]],["The `Segmenter` class performs image segmentation. It's initialized using `segmenter(options:)` with `MLKCommonSegmenterOptions`. Segmentation is achieved via `process(_:)`, which asynchronously processes an image and returns an `MLKSegmentationMask`. Alternatively, `results(in:)` synchronously returns the segmentation mask, but it must be called off the main thread to prevent UI blocking; it also takes an image as an input and return a `MLKSegmentationMask`. Direct initialization via `init` is unavailable.\n"]]