Appery Face Detection
Face detection
FaceRecognizer.recognizeFace
Parameters
- {string} filePath - path to image
- {function} success - callback function which takes a parameter data which will be invoked on success
- {function} error - callback function which takes a parameter err which will be invoked on failure
- {object} options - options for face detector
Supported Options
property | value | description |
---|---|---|
performanceMode | FAST (default) / ACCURATE | Favor speed or accuracy when detecting faces. |
landmarksDetection | NO_LANDMARKS (default) / ALL_LANDMARKS | Whether to attempt to identify facial "landmarks": eyes, ears, nose, cheeks, mouth, and so on. |
contoursDetection | NO_CONTOURS (default) / ALL_CONTOURS | Whether to detect the contours of facial features. Contours are detected for only the most prominent face in an image. |
facesClassification | NO_CLASSIFICATIONS (default) / ALL_CLASSIFICATIONS | Whether or not to classify faces into categories such as "smiling", and "eyes open". |
minimumFaceSize | double (default: 0.1) | The minimum size, relative to the image, of faces to detect. |
enableFaceTracking | false (default) / true | Whether or not to assign faces an ID, which can be used to track faces across images. |
useBase64 | false (default) / true | Whether or not filePath is a base64 encoded string. |
detectedFaceImageData | true (default) / false | return or not cropped face image data in base64 format depends on detectedFaceImageResultType option value for every detected face; if true, each item of response "faces" array contains "faceImage" field with the data |
encodingType | EncodingType.JPEG (default) / EncodingType.PNG | format of output cropped face image |
detectedFaceImageResultType | CameraResultType.BASE64_STRING (default) / CameraResultType.DATA_URL | include captured photo as only base64 string or as full data url |
Example:
window.ApperyioMLCordovaPlugin.FaceRecognizer.recognizeFace('filePath', successCallback, errorCallback, {
landmarksDetection: ApperyioMLCordovaPlugin.FaceDetectorOptions.LandmarksDetection.ALL_LANDMARKS,
facesClassification: ApperyioMLCordovaPlugin.FaceDetectorOptions.FacesClassification.ALL_CLASSIFICATIONS,
useBase64: true,
detectedFaceImageData: true,
encodingType: ApperyioMLCordovaPlugin.FaceDetectorOptions.EncodingType.PNG,
detectedFaceImageResultType: ApperyioMLCordovaPlugin.FaceDetectorOptions.CameraResultType.DATA_URL
})
Sample JSON callback: face_recognition.json
FaceRecognizer.startRealTimeFaceDetection
Parameters
- {function} success - callback function which takes a parameter data which will be invoked on success
- {function} error - callback function which takes a parameter err which will be invoked on failure
- {object} options - options for face detector
Supported Options
property | value | description |
---|---|---|
performanceMode | FAST (default) / ACCURATE | Favor speed or accuracy when detecting faces. |
landmarksDetection | NO_LANDMARKS (default) / ALL_LANDMARKS | Whether to attempt to identify facial "landmarks": eyes, ears, nose, cheeks, mouth, and so on. |
contoursDetection | NO_CONTOURS (default) / ALL_CONTOURS | Whether to detect the contours of facial features. Contours are detected for only the most prominent face in an image. |
facesClassification | NO_CLASSIFICATIONS (default) / ALL_CLASSIFICATIONS | Whether or not to classify faces into categories such as "smiling", and "eyes open". |
minimumFaceSize | double (default: 0.1) | The minimum size, relative to the image, of faces to detect. |
enableFaceTracking | false (default) / true | Whether or not to assign faces an ID, which can be used to track faces across images. |
showFaceBoundingBox | true (default) / false | Whether or not show green rectangle around a detected face |
showFaceContours | false (default) / true | Whether or not show dots contour on a detected face (face border, eyes, nose and mouth) |
frameImageData | true (default) / false | Whether include base64 of captured photo or not |
frameImageResultType | CameraResultType.BASE64_STRING (default) / CameraResultType.DATA_URL | include captured photo as only base64 string or as full data url |
encodingType | EncodingType.JPEG (default) / EncodingType.PNG | format of output photo base64 |
cameraDirection | CameraDirection.BACK (default) / CameraDirection.FRONT | Use back or front camera of device during face detection |
delay | 500 (default) | Time interval in msec, for performing detection each interval value |
detectedFaceImageData | true (default) / false | return or not cropped face image data in base64 format depends on frameImageResultType option value for every detected face; if true, each item of response "faces" array contains "faceImage" field with the data |
Example:
window.ApperyioMLCordovaPlugin.FaceRecognizer.startRealTimeFaceDetection(successCallback, errorCallback, {
landmarksDetection: ApperyioMLCordovaPlugin.FaceDetectorOptions.LandmarksDetection.ALL_LANDMARKS,
contoursDetection: ApperyioMLCordovaPlugin.FaceDetectorOptions.ContoursDetections.ALL_CONTOURS,
facesClassification: ApperyioMLCordovaPlugin.FaceDetectorOptions.FacesClassification.ALL_CLASSIFICATIONS,
enableFaceTracking: false,
showFaceBoundingBox: true,
showFaceContours: false,
frameImageData: true,
frameImageResultType: CameraResultType.DATA_URL,
delay: 100,
encodingType: this.window.ApperyioMLCordovaPlugin.FaceDetectorOptions.EncodingType.PNG,
cameraDirection: this.window.ApperyioMLCordovaPlugin.FaceDetectorOptions.CameraDirection.BACK
});
FaceRecognizer.stopRealTimeFaceDetection
Parameters
- {function} success - callback function which takes a parameter data which will be invoked on success
- {function} error - callback function which takes a parameter err which will be invoked on failure
Example:
window.ApperyioMLCordovaPlugin.FaceRecognizer.stopRealTimeFaceDetection(successCallback, errorCallback)
Updated 2 months ago