Creates a new instance of PoseLandmarker from an absolute path to a model asset bundle stored
locally on the device and the default PoseLandmarkerOptions.
Declaration
Swift
convenienceinit(modelPath:String)throws
Parameters
modelPath
An absolute path to a model asset bundle stored locally on the device.
error
An optional error parameter populated when there is an error in initializing the
pose landmarker.
Return Value
A new instance of PoseLandmarker with the given model path. nil if there is an error
in initializing the pose landmarker.
Performs pose landmarks detection on the provided MPImage using the whole image as region of
interest. Rotation will be applied according to the orientation property of the provided
MPImage. Only use this method when the PoseLandmarker is created with running mode .image.
This method supports performing pose landmarks detection on RGBA images. If your MPImage has a
source type of .pixelBuffer or .sampleBuffer, the underlying pixel buffer must use
kCVPixelFormatType_32BGRA as its pixel format.
If your MPImage has a source type of .image ensure that the color space is RGB with an Alpha
channel.
Performs pose landmarks detection on the provided video frame of type MPImage using the whole
image as region of interest. Rotation will be applied according to the orientation property of
the provided MPImage. Only use this method when the PoseLandmarker is created with running
mode .video.
It’s required to provide the video frame’s timestamp (in milliseconds). The input timestamps must
be monotonically increasing.
This method supports performing pose landmarks detection on RGBA images. If your MPImage has a
source type of .pixelBuffer or .sampleBuffer, the underlying pixel buffer must use
kCVPixelFormatType_32BGRA as its pixel format.
If your MPImage has a source type of .image ensure that the color space is RGB with an Alpha
channel.
Sends live stream image data of type MPImage to perform pose landmarks detection using the
whole image as region of interest. Rotation will be applied according to the orientation
property of the provided MPImage. Only use this method when the PoseLandmarker is created
with running mode.liveStream.
The object which needs to be continuously notified of the available results of pose landmark
detection must confirm to PoseLandmarkerLiveStreamDelegate protocol and implement the
poseLandmarker(_:didFinishDetectionWithResult:timestampInMilliseconds:error:) delegate method.
It’s required to provide a timestamp (in milliseconds) to indicate when the input image is sent
to the pose landmarker. The input timestamps must be monotonically increasing.
This method supports performing pose landmarks detection on RGBA images. If your MPImage has a
source type of .pixelBuffer or .sampleBuffer, the underlying pixel buffer must use
kCVPixelFormatType_32BGRA as its pixel format.
If the input MPImage has a source type of .image ensure that the color space is RGB with an
Alpha channel.
If this method is used for performing pose landmarks detection on live camera frames using
AVFoundation, ensure that you request AVCaptureVideoDataOutput to output frames in
kCMPixelFormat_32BGRA using its videoSettings property.
A live stream image data of type MPImage on which pose landmarks detection is to
be performed.
timestampInMilliseconds
The timestamp (in milliseconds) which indicates when the input
image is sent to the pose landmarker. The input timestamps must be monotonically increasing.
error
An optional error parameter populated when there is an error in performing pose
landmark detection on the input live stream image data.
Return Value
YES if the image was sent to the task successfully, otherwise NO.
[[["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-05-08 UTC."],[],[],null,["# MediaPipeTasksVision Framework Reference\n\nPoseLandmarker\n==============\n\n class PoseLandmarker : NSObject\n\n@brief Performs pose landmarks detection on images.\n\nThis API expects a pre-trained pose landmarks model asset bundle.\n- `\n ``\n ``\n `\n\n ### [poseLandmarks](#/c:objc(cs)MPPPoseLandmarker(cpy)poseLandmarks)\n\n `\n ` \n The array of connections between all the landmarks in the detected pose. \n\n #### Declaration\n\n Swift \n\n class var poseLandmarks: [../Classes/Connection.html] { get }\n\n- `\n ``\n ``\n `\n\n ### [init(modelPath:)](#/c:objc(cs)MPPPoseLandmarker(im)initWithModelPath:error:)\n\n `\n ` \n Creates a new instance of `PoseLandmarker` from an absolute path to a model asset bundle stored\n locally on the device and the default [PoseLandmarkerOptions](../Classes/PoseLandmarkerOptions.html). \n\n #### Declaration\n\n Swift \n\n convenience init(modelPath: String) throws\n\n #### Parameters\n\n |-------------------|---------------------------------------------------------------------------------------------------|\n | ` `*modelPath*` ` | An absolute path to a model asset bundle stored locally on the device. |\n | ` `*error*` ` | An optional error parameter populated when there is an error in initializing the pose landmarker. |\n\n #### Return Value\n\n A new instance of `PoseLandmarker` with the given model path. `nil` if there is an error\n in initializing the pose landmarker.\n- `\n ``\n ``\n `\n\n ### [init(options:)](#/c:objc(cs)MPPPoseLandmarker(im)initWithOptions:error:)\n\n `\n ` \n Creates a new instance of `PoseLandmarker` from the given [PoseLandmarkerOptions](../Classes/PoseLandmarkerOptions.html). \n\n #### Declaration\n\n Swift \n\n init(options: ../Classes/PoseLandmarkerOptions.html) throws\n\n #### Parameters\n\n |-----------------|---------------------------------------------------------------------------------------------------------------------------------|\n | ` `*options*` ` | The options of type [PoseLandmarkerOptions](../Classes/PoseLandmarkerOptions.html) to use for configuring the `PoseLandmarker`. |\n | ` `*error*` ` | An optional error parameter populated when there is an error in initializing the pose landmarker. |\n\n #### Return Value\n\n A new instance of `PoseLandmarker` with the given options. `nil` if there is an error in\n initializing the pose landmarker.\n- `\n ``\n ``\n `\n\n ### [detect(image:)](#/c:objc(cs)MPPPoseLandmarker(im)detectImage:error:)\n\n `\n ` \n Performs pose landmarks detection on the provided [MPImage](../Classes/MPImage.html) using the whole image as region of\n interest. Rotation will be applied according to the `orientation` property of the provided\n [MPImage](../Classes/MPImage.html). Only use this method when the `PoseLandmarker` is created with running mode [.image](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeImage).\n\n This method supports performing pose landmarks detection on RGBA images. If your [MPImage](../Classes/MPImage.html) has a\n source type of [.pixelBuffer](../Constants.html#/c:MPPImage.h@MPPImageSourceTypePixelBuffer) or [.sampleBuffer](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeSampleBuffer), the underlying pixel buffer must use\n `kCVPixelFormatType_32BGRA` as its pixel format.\n\n If your [MPImage](../Classes/MPImage.html) has a source type of [.image](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeImage) ensure that the color space is RGB with an Alpha\n channel. \n\n #### Declaration\n\n Swift \n\n func detect(image: ../Classes/MPImage.html) throws -\u003e ../Classes/PoseLandmarkerResult.html\n\n #### Parameters\n\n |---------------|------------------------------------------------------------------------------------------------------------------------|\n | ` `*image*` ` | The [MPImage](../Classes/MPImage.html) on which pose landmarks detection is to be performed. |\n | ` `*error*` ` | An optional error parameter populated when there is an error in performing pose landmark detection on the input image. |\n\n #### Return Value\n\n An [PoseLandmarkerResult](../Classes/PoseLandmarkerResult.html) object that contains the pose landmarks detection\n results.\n- `\n ``\n ``\n `\n\n ### [detect(videoFrame:timestampInMilliseconds:)](#/c:objc(cs)MPPPoseLandmarker(im)detectVideoFrame:timestampInMilliseconds:error:)\n\n `\n ` \n Performs pose landmarks detection on the provided video frame of type [MPImage](../Classes/MPImage.html) using the whole\n image as region of interest. Rotation will be applied according to the `orientation` property of\n the provided [MPImage](../Classes/MPImage.html). Only use this method when the `PoseLandmarker` is created with running\n mode `.video`.\n\n It's required to provide the video frame's timestamp (in milliseconds). The input timestamps must\n be monotonically increasing.\n\n This method supports performing pose landmarks detection on RGBA images. If your [MPImage](../Classes/MPImage.html) has a\n source type of [.pixelBuffer](../Constants.html#/c:MPPImage.h@MPPImageSourceTypePixelBuffer) or [.sampleBuffer](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeSampleBuffer), the underlying pixel buffer must use\n `kCVPixelFormatType_32BGRA` as its pixel format.\n\n If your [MPImage](../Classes/MPImage.html) has a source type of [.image](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeImage) ensure that the color space is RGB with an Alpha\n channel. \n\n #### Declaration\n\n Swift \n\n func detect(videoFrame image: ../Classes/MPImage.html, timestampInMilliseconds: Int) throws -\u003e ../Classes/PoseLandmarkerResult.html\n\n #### Parameters\n\n |---------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n | ` `*image*` ` | The [MPImage](../Classes/MPImage.html) on which pose landmarks detection is to be performed. |\n | ` `*timestampInMilliseconds*` ` | The video frame's timestamp (in milliseconds). The input timestamps must be monotonically increasing. |\n | ` `*error*` ` | An optional error parameter populated when there is an error in performing pose landmark detection on the input video frame. |\n\n #### Return Value\n\n An [PoseLandmarkerResult](../Classes/PoseLandmarkerResult.html) object that contains the pose landmarks detection\n results.\n- `\n ``\n ``\n `\n\n ### [detectAsync(image:timestampInMilliseconds:)](#/c:objc(cs)MPPPoseLandmarker(im)detectAsyncImage:timestampInMilliseconds:error:)\n\n `\n ` \n Sends live stream image data of type [MPImage](../Classes/MPImage.html) to perform pose landmarks detection using the\n whole image as region of interest. Rotation will be applied according to the `orientation`\n property of the provided [MPImage](../Classes/MPImage.html). Only use this method when the `PoseLandmarker` is created\n with running mode`.liveStream`.\n\n The object which needs to be continuously notified of the available results of pose landmark\n detection must confirm to [PoseLandmarkerLiveStreamDelegate](../Protocols/PoseLandmarkerLiveStreamDelegate.html) protocol and implement the\n `poseLandmarker(_:didFinishDetectionWithResult:timestampInMilliseconds:error:)` delegate method.\n\n It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent\n to the pose landmarker. The input timestamps must be monotonically increasing.\n\n This method supports performing pose landmarks detection on RGBA images. If your [MPImage](../Classes/MPImage.html) has a\n source type of [.pixelBuffer](../Constants.html#/c:MPPImage.h@MPPImageSourceTypePixelBuffer) or [.sampleBuffer](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeSampleBuffer), the underlying pixel buffer must use\n `kCVPixelFormatType_32BGRA` as its pixel format.\n\n If the input [MPImage](../Classes/MPImage.html) has a source type of [.image](../Constants.html#/c:MPPImage.h@MPPImageSourceTypeImage) ensure that the color space is RGB with an\n Alpha channel.\n\n If this method is used for performing pose landmarks detection on live camera frames using\n `AVFoundation`, ensure that you request `AVCaptureVideoDataOutput` to output frames in\n `kCMPixelFormat_32BGRA` using its `videoSettings` property. \n\n #### Declaration\n\n Swift \n\n func detectAsync(image: ../Classes/MPImage.html, timestampInMilliseconds: Int) throws\n\n #### Parameters\n\n |---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*image*` ` | A live stream image data of type [MPImage](../Classes/MPImage.html) on which pose landmarks detection is to be performed. |\n | ` `*timestampInMilliseconds*` ` | The timestamp (in milliseconds) which indicates when the input image is sent to the pose landmarker. The input timestamps must be monotonically increasing. |\n | ` `*error*` ` | An optional error parameter populated when there is an error in performing pose landmark detection on the input live stream image data. |\n\n #### Return Value\n\n `YES` if the image was sent to the task successfully, otherwise `NO`.\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)MPPPoseLandmarker(im)init)\n\n `\n ` \n Undocumented\n- `\n ``\n ``\n `\n\n ### [+new](#/c:objc(cs)MPPPoseLandmarker(cm)new)\n\n `\n ` \n Undocumented"]]