Face detection
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.
Prerequisites
Before you begin to use the SDK's face detection feature in your project, make sure you complete the following steps:
- Integrate the ZegoEffects SDK into your project. For details, see Integration.
- Implement the basic image processing functionality. For details, see Implementation.
- Import the
FaceDetectionModel
. For details, see Import resources and models.
Enable face detection
Warning
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.
-
Call the
setEventHandler
method to set the callback to return the face detection result.Untitled// Set the callback to return the face detection result. mEffects.setEventHandler(new ZegoEffectsEventHandler() { @Override public void onFaceDetectionResult(ZegoEffectsFaceDetectionResult[] results, ZegoEffects handle) { // Obtain the face detection result, including the number of faces, the confidence level of each detected face and its position. } });
1 -
Call the
enableFaceDetection
method to enable the face detection feature.Untitled// Enable face detection. mEffects.enableFaceDetection(true);
1