MediaPipeTasksVision Framework Reference

MPPImageSegmenterLiveStreamDelegate

@protocol MPPImageSegmenterLiveStreamDelegate <NSObject>

This protocol defines an interface for the delegates of ImageSegmenter object to receive results of performing asynchronous segmentation on images (i.e, when runningMode = liveStream).

The delegate of ImageSegmenter must adopt ImageSegmenterLiveStreamDelegate protocol. The methods in this protocol are optional.

  • This method notifies a delegate that the results of asynchronous segmentation of an image submitted to the ImageSegmenter is available.

    This method is called on a private serial dispatch queue created by the ImageSegmenter for performing the asynchronous delegates calls.

    Declaration

    Objective-C

    - (void)imageSegmenter:(nonnull MPPImageSegmenter *)imageSegmenter
        didFinishSegmentationWithResult:(nullable MPPImageSegmenterResult *)result
                timestampInMilliseconds:(NSInteger)timestampInMilliseconds
                                  error:(nullable NSError *)error;

    Parameters

    imageSegmenter

    The image segmenter which performed the segmentation. This is useful to test equality when there are multiple instances of ImageSegmenter.

    result

    The ImageSegmenterResult object that contains a list of category or confidence masks and optional quality scores.

    timestampInMilliseconds

    The timestamp (in milliseconds) which indicates when the input image was sent to the image segmenter.

    error

    An optional error parameter populated when there is an error in performing segmentation on the input live stream image data.