onFacePositionChanged property
Reports local face detection results.
After calling enableFaceDetection(true) to enable local face detection, you can use this callback to get the following face detection information in real time: Size of the image captured by the camera Position of the face in the view Distance of the face from the device screen The distance of the face from the screen is estimated by the SDK based on the image size and face position in the view. This callback is only available on Android and iOS platforms. When the face in front of the camera disappears, this callback is triggered immediately. When no face is detected, the callback frequency is reduced to save device power. When the face is too close to the screen, the SDK does not trigger this callback. On Android, the distance value has some error margin. Do not use it for precise calculations.
imageWidthWidth of the image captured by the camera (px).imageHeightHeight of the image captured by the camera (px).vecRectangleDetected face information. See Rectangle.vecDistanceDistance between the face and the device screen (cm).numFacesNumber of faces detected. If 0, no face is detected.
Implementation
final void Function(
int imageWidth,
int imageHeight,
List<Rectangle> vecRectangle,
List<int> vecDistance,
int numFaces)? onFacePositionChanged;