FirebaseMLVision Framework Reference

FIRVisionFaceDetector


@interface FIRVisionFaceDetector : NSObject

A face detector that detects faces in an image.

  • Unavailable. Use Vision factory methods.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Processes the given image for face detection. The detection is performed asynchronously and calls back the completion handler with the detected face results or error on the main thread.

    Declaration

    Objective-C

    - (void)processImage:(nonnull FIRVisionImage *)image
              completion:(nonnull FIRVisionFaceDetectionCallback)completion;

    Parameters

    image

    The vision image to use for detecting faces.

    completion

    Handler to call back on the main thread with faces detected or error.

  • Returns detected face results in the given image or nil if there was an error. The detection is performed synchronously on the calling thread.

    It is advised to call this method off the main thread to avoid blocking the UI. As a result, an NSException is raised if this method is called on the main thread.

    Declaration

    Objective-C

    - (nullable NSArray<FIRVisionFace *> *)
        resultsInImage:(nonnull FIRVisionImage *)image
                 error:(NSError *_Nullable *_Nullable)error;

    Parameters

    image

    The vision image to use for detecting faces.

    error

    An optional error parameter populated when there is an error during detection.

    Return Value

    Array of faces detected in the given image or nil if there was an error.