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
FaceLandmarker
from an absolute path to a TensorFlow Lite model file stored locally on the device and the defaultFaceLandmarker
.Declaration
Swift
convenience init(modelPath: String) throws
Parameters
modelPath
An absolute path to a TensorFlow Lite model file stored locally on the device.
Return Value
A new instance of
FaceLandmarker
with the given model path.nil
if there is an error in initializing the face landmaker. -
Creates a new instance of
FaceLandmarker
from the givenFaceLandmarkerOptions
.Declaration
Swift
init(options: FaceLandmarkerOptions) throws
Parameters
options
The options of type
FaceLandmarkerOptions
to use for configuring theFaceLandmarker
.Return Value
A new instance of
FaceLandmarker
with the given options.nil
if there is an error in initializing the face landmaker. -
Performs face landmark detection on the provided
MPImage
using the whole image as region of interest. Rotation will be applied according to theorientation
property of the providedMPImage
. Only use this method when theFaceLandmarker
is created with.image
.This method supports performing face landmark detection on RGBA images. If your
MPImage
has a source type of.pixelBuffer
or.sampleBuffer
, the underlying pixel buffer must usekCVPixelFormatType_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.Declaration
Swift
func detect(image: MPImage) throws -> FaceLandmarkerResult
Parameters
image
The
MPImage
on which face landmark detection is to be performed.