Face detector¶
To detect faces on an image the IDLive Face uses custom face detector. This detector is used when an image is submitted for analysis to ensure that not only a face is detected but also that the image is of sufficient quality for analysis (e.g., no cropped or big enough).
This detector can be used directly with the FaceDetector
class:
idliveface::FaceDetector detector = blueprint->CreateFaceDetector();
idliveface::FacetectionResult result = face_detector->DetectFaces(image);
std::cout << "Face detection result: " << result << std::endl;
detector = blueprint.create_face_detector()
result = detector.detect_faces(image)
print(f"result: {result}")
detector = blueprint.createFaceDetector();
FaceDetectionResult result = detector.detectFaces(image);
System.out.println("Result: " + result);
The result of the face detection contains the following:
- faces is a vector of all the detected faces. For each of one the following information is returned:
- A set of attributes of the face. See below for more details
- A list of validations that failed, if any. See below for more details
- image quality attributes Attributes of the analysed image, currently only holds
underexposure
which reflects how dark or light is the image. From 0 (normal) to 1 (too dark) - failed_validations Contains global failed validations and ones from all the faces.
The validations that can fail when detecting and image are the following
kFaceNotFound
No faces are found on the image.kTooManyFaces
There is more than one face on the image.kSmallFaceSize
The face box is too small.kSmallRelativeFaceSize
The face relative size is too small.kSmallPupillaryDistance
The distance between pupils on the face is too small.kLargeFaceRotationAngle
The rotation angle of the head (inc. roll, pitch an yaw) is too big.kFaceTooClose
The face is too close to the camera.kFaceCloseToBorder
The face is too close to one or more image borders.kFaceCropped
The face is cropped.kFaceOccluded
The face is occluded, for example with a medical mask.kEyesClosed
The eyes are closed.kDarkImage
The image is too dark.
For each detected image a set of attributes are returned:
box
is a bounding box that encapsulates the imagelandmarks
list the positions of different landmark points of the facehead_pose
The roll, pitch and yaw rotation angles of the headorientation
It's a roll angle rounded to a nearest multiply of 90. Can be -90, 0, 90 or 180.pupillary_distance
The distance between the centers of pupils, in pixels.occlusion
The probability that the face is occluded (for example with medical mask), from 0 (not occluded) to 1 (occluded).eyes_closed
The probability that the eyes are closed, from 0 (open) to 1 (closed).