FaceLandmarker
class FaceLandmarker : NSObject@brief Class that performs face landmark detection on images.
The API expects a TFLite model with mandatory TFLite Model Metadata.
-
Creates a new instance of
FaceLandmarkerfrom an absolute path to a TensorFlow Lite model file stored locally on the device and the defaultFaceLandmarker.Declaration
Swift
convenience init(modelPath: String) throwsParameters
modelPathAn absolute path to a TensorFlow Lite model file stored locally on the device.
Return Value
A new instance of
FaceLandmarkerwith the given model path.nilif there is an error in initializing the face landmaker. -
Creates a new instance of
FaceLandmarkerfrom the givenFaceLandmarkerOptions.Declaration
Swift
init(options: FaceLandmarkerOptions) throwsParameters
optionsThe options of type
FaceLandmarkerOptionsto use for configuring theFaceLandmarker.Return Value
A new instance of
FaceLandmarkerwith the given options.nilif there is an error in initializing the face landmaker. -
Performs face landmark detection on the provided
MPImageusing the whole image as region of interest. Rotation will be applied according to theorientationproperty of the providedMPImage. Only use this method when theFaceLandmarkeris created with.image.This method supports performing face landmark 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 -> FaceLandmarkerResultParameters
imageThe
MPImageon which face landmark detection is to be performed.Return Value
An
FaceLandmarkerResultthat contains a list of landmarks.nilif there is an error in initializing the face landmaker. -
Performs face landmark 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 theFaceLandmarkeris created with running mode.video.This method supports performing face landmark 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 -> FaceLandmarkerResultParameters
imageThe
MPImageon which face landmark detection is to be performed.timestampInMillisecondsThe video frame’s timestamp (in milliseconds). The input timestamps must be monotonically increasing.
Return Value
An
FaceLandmarkerResultthat contains a list of landmarks.nilif there is an error in initializing the face landmaker. -
Sends live stream image data of type
MPImageto perform face landmark detection using the whole image as region of interest. Rotation will be applied according to theorientationproperty of the providedMPImage. Only use this method when theFaceLandmarkeris created with.liveStream.The object which needs to be continuously notified of the available results of face detection must confirm to
FaceLandmarkerLiveStreamDelegateprotocol and implement thefaceLandmarker(_:didFinishDetectionWithResult:timestampInMilliseconds:error:)delegate method.It’s required to provide a timestamp (in milliseconds) to indicate when the input image is sent to the face detector. The input timestamps must be monotonically increasing.
This method supports performing face landmark 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 classifying 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 face landmark detection is to be performed.timestampInMillisecondsThe timestamp (in milliseconds) which indicates when the input image is sent to the face detector. The input timestamps must be monotonically increasing.
Return Value
trueif the image was sent to the task successfully, otherwisefalse. -
Returns the connections between all the landmarks in the lips.
Declaration
Swift
class func lipsConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the lips.
-
Returns the connections between all the landmarks in the left eye.
Declaration
Swift
class func leftEyeConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the left eye.
-
Returns the connections between all the landmarks in the left eyebrow.
Declaration
Swift
class func leftEyebrowConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the left eyebrow.
-
Returns the connections between all the landmarks in the left iris.
Declaration
Swift
class func leftIrisConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the left iris.
-
Returns the connections between all the landmarks in the right eye.
Declaration
Swift
class func rightEyeConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the right eyr.
-
Returns the connections between all the landmarks in the right eyebrow.
Declaration
Swift
class func rightEyebrowConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the right eyebrow.
-
Returns the connections between all the landmarks in the right iris.
Declaration
Swift
class func rightIrisConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the right iris.
-
Returns the connections between all the landmarks of the face oval.
Declaration
Swift
class func faceOvalConnections() -> [Connection]Return Value
An array of connections between all the landmarks of the face oval.
-
Returns the connections between making up the contours of the face.
Declaration
Swift
class func contoursConnections() -> [Connection]Return Value
An array of connections between all the contours of the face.
-
Returns the connections between all the landmarks making up the tesselation of the face.
Declaration
Swift
class func tesselationConnections() -> [Connection]Return Value
An array of connections between all the landmarks making up the tesselation of the face.
-
Returns the connections between all the landmarks in the face.
Declaration
Swift
class func faceConnections() -> [Connection]Return Value
An array of connections between all the landmarks in the face.
-
Undocumented
-
Undocumented