Face Detection

API Interface of the iOS Framework

Define face detection model variable

private var faceDetectionModel: FaceDetectionModel?

Configure and Instantiate the model with FaceDetectionModelBuilder

@interface FaceDetectionModelBuilder : NSObject

- (instancetype _Nonnull)init;

/**
 * \brief Sets the preferred model to use based on the use-case.
 *
 * \param type One of the available \a FaceDetectionModelType.
 *             Default is \a FaceDetectionModelType_ShortRange.
 * \returns Pointer to the \a FaceDetectionModelBuilder
 */
- (FaceDetectionModelBuilder* _Nonnull)setFaceDetectionModelType:(FaceDetectionModelType)type;

/**
 * \brief Creates a new instance of \a FaceDetectionModel.
 *
 * \param error Object containing error information if model instantiation fails.
 *
 * \returns Pointer to the new instance of \a FaceDetectionModel if instantiation
 * is successful, \a nil otherwise.
 *
 * \note Model instantiation is a blocking call which can take some time, therefore
 * this should be done on a separate serial dispatch queue.
 * That won't block the main queue which keeps the UI responsive.
 */
- (FaceDetectionModel* _Nullable)build:(NSError* _Nullable* _Nonnull)error;

@end

Example:

Model instantiation is a blocking call that can take some time, therefore this should be done on a separate serial dispatch queue. That won't block the main queue which keeps the UI responsive.

Schedule the task with FaceDetectionModel.detect method when the model is instantiated

FaceDetectionModel returns its results through the FaceDetectionDelegate

Example:

Each FaceDetection instance is represented with the following class

Last updated