AI Effects
  • iOS : Objective-C
  • Android
  • Overview
  • Release notes
  • SDK downloads
  • Demo app
  • Sample codes
  • Getting started
    • Integrate the SDK
    • Import resources and models
    • Online authentication
    • Implement basic image processing
  • Guides
    • Face beautification
    • Face shape retouch
    • Beauty makeups
    • Background segmentation
    • Face detection
    • Stickers
    • Filters
  • Tutorials
  • Error codes

Face detection

Last updated:2022-04-19 16:17

The ZegoEffects SDK provides a face detection function, which can detect all faces in a video and the positions of the faces in the video images.


Before you begin to use the SDK's face detection feature in your project, make sure you complete the following steps:

  1. Integrate the ZegoEffects SDK into your project. For details, see Integration.
  2. Implement the basic image processing functionality. For details, see Implementation.
  3. Import the FaceDetectionModel. For details, see Import models.

Enable face detection

To use the face detection feature, import the model file FaceDetectionModel first; otherwise, this feature can't take effect. For details, see Import resources and models.

  1. Call the setEventHandler method to set the callback to return the face detection result.

    // Set the callback to return the face detection result.
    [self.effects setEventHandler:self]
  2. Call the enableFaceDetection method to enable the face detection feature.

    // Enable face detection.
    [self.effects enableFaceDetection:YES];
    -(void)effects:(ZegoEffects *)effects faceDetectionResults:(NSArray<ZegoEffectsFaceDetectionResult *> *)results{
        // Obtain the face detection result, including the number of faces, the confidence level of each detected face and its position.