HolisticLandmarker
class HolisticLandmarker: NSObjectPerforms holistic landmarks detection on images.
This API expects a pre-trained holistic landmarks model asset bundle.
-
Creates a new instance of
HolisticLandmarkerfrom an absolute path to a model asset bundle stored locally on the device and the defaultHolisticLandmarkerOptions.Declaration
Swift
convenience init(modelPath: String) throwsParameters
modelPathAn absolute path to a model asset bundle stored locally on the device.
errorAn optional error parameter populated when there is an error in initializing the holistic landmarker.
Return Value
A new instance of
HolisticLandmarkerwith the given model path.nilif there is an error in initializing the holistic landmarker. -
Creates a new instance of
HolisticLandmarkerfrom the givenHolisticLandmarkerOptions.Declaration
Swift
init(options: HolisticLandmarkerOptions) throwsParameters
optionsThe options of type
HolisticLandmarkerOptionsto use for configuring theHolisticLandmarker.errorAn optional error parameter populated when there is an error in initializing the holistic landmarker.
Return Value
A new instance of
HolisticLandmarkerwith the given options.nilif there is an error in initializing the holistic landmarker. -
Performs holistic landmarks detection on the provided
MPImageusing the whole image as region ofinterest. Rotation will be applied according to theorientationproperty of the providedmMPImage. Only use this method when theHolisticLandmarkeris created with running mode,.image.This method supports performing holistic landmarks detection on RGBA images. If your
MPImagehas a source type of.pixelBufferor.sampleBuffer, the underlying pixel buffer must usekCVPixelFormatType_32BGRAas its pixel format.If your
MPImagehas a source type of.imageensure that the color space is RGB with an Alpha channel.Declaration
Swift
func detect(image: MPImage) throws -> HolisticLandmarkerResultParameters
imageThe
MPImageon which holistic landmarks detection is to be performed.errorAn optional error parameter populated when there is an error in performing holistic landmarks detection on the input image.
Return Value
An
HolisticLandmarkerResultobject that contains the holistic landmarks detection results. -
Performs holistic landmarks detection on the provided video frame of type
MPImageusing the whole image as region of interest. Rotation will be applied according to theorientationproperty of the providedMPImage. Only use this method when theHolisticLandmarkeris 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 holistic landmarks detection on RGBA images. If your
MPImagehas a source type of.pixelBufferor.sampleBuffer, the underlying pixel buffer must usekCVPixelFormatType_32BGRAas its pixel format.If your
MPImagehas a source type of.imageensure that the color space is RGB with an Alpha channel.Declaration
Swift
func detect(videoFrame image: MPImage, timestampInMilliseconds: Int) throws -> HolisticLandmarkerResultParameters
imageThe
MPImageon which holistic landmarks detection is to be performed.timestampInMillisecondsThe video frame's timestamp (in milliseconds). The input timestamps must be monotonically increasing.
errorAn optional error parameter populated when there is an error in performing holistic landmarks detection on the input video frame.
Return Value
An
HolisticLandmarkerResultobject that contains the holistic landmarks detection results. -
Sends live stream image data of type
MPImageto perform holistic landmarks detection using the whole image as region of interest. Rotation will be applied according to theorientationproperty of the providedMPImage. Only use this method when theHolisticLandmarkeris created with running mode,.liveStream.The object which needs to be continuously notified of the available results of holistic landmarks detection must confirm to
HolisticLandmarkerLiveStreamDelegateprotocol and implement theholisticLandmarker(_:didFinishDetectionWithResult:timestampInMilliseconds:error:)delegate method.It's required to provide a timestamp (in milliseconds) to indicate when the input image is sent to the holistic landmarker. The input timestamps must be monotonically increasing.
This method supports performing holistic landmarks detection on RGBA images. If your
MPImagehas a source type of.pixelBufferor.sampleBuffer, the underlying pixel buffer must usekCVPixelFormatType_32BGRAas its pixel format.If the input
MPImagehas a source type of.imageensure that the color space is RGB with an Alpha channel.If this method is used for performing holistic landmarks detection on live camera frames using
AVFoundation, ensure that you requestAVCaptureVideoDataOutputto output frames inkCMPixelFormat_32BGRAusing itsvideoSettingsproperty.Declaration
Swift
func detectAsync(image: MPImage, timestampInMilliseconds: Int) throwsParameters
imageA live stream image data of type
MPImageon which holistic landmarks detection is to be performed.timestampInMillisecondsThe timestamp (in milliseconds) which indicates when the input image is sent to the holistic landmarker. The input timestamps must be monotonically increasing.
errorAn optional error parameter populated when there is an error in performing holistic landmarks detection on the input live stream image data.
Return Value
YESif the image was sent to the task successfully, otherwiseNO.