MLKitPoseDetectionCommon Framework Reference

MLKPoseDetector


@interface MLKPoseDetector : NSObject

A detector for performing body-pose estimation.

  • Returns a pose detector with the given options.

    Declaration

    Objective-C

    + (nonnull instancetype)poseDetectorWithOptions:
        (nonnull MLKCommonPoseDetectorOptions *)options;

    Parameters

    options

    Options for configuring the pose detector.

    Return Value

    A pose detector configured with the given options.

  • Unavailable. Use the class methods.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Processes the given image for pose detection.

    Declaration

    Objective-C

    - (void)processImage:(nonnull id<MLKCompatibleImage>)image
              completion:(nonnull MLKPoseDetectionCallback)completion;

    Parameters

    image

    The image to process.

    completion

    Handler to call back on the main thread with pose detected or error.

  • Returns the pose results in the given image. The pose detection 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.

    Declaration

    Objective-C

    - (nullable NSArray<MLKPose *> *)
        resultsInImage:(nonnull id<MLKCompatibleImage>)image
                 error:(NSError *_Nullable *_Nullable)error;

    Parameters

    image

    The image to get results in.

    error

    An optional error parameter populated when there is an error getting results.

    Return Value

    The array of poses detected in the given image or nil if there was an error. If no poses are detected, then an empty array will be returned.