facial_recognition_functions.php
Table of Contents
Functions
- initFacialRecognition() : bool
- Initialize facial recognition functionality.
- prepareFaceImage() : bool
- Crops out a selected area of an image and makes it ready to be used by FaceRecognizer.
- faceRecognizerPredict() : bool|array<string|int, mixed>
- Use FaceRecognizer to predict the association between a face and a label (i.e person name)
Functions
initFacialRecognition()
Initialize facial recognition functionality.
initFacialRecognition() : bool
IMPORTANT: only one field can be setup for the annotation side and it also MUST be a dynamic keywords list
Tags
Return values
boolprepareFaceImage()
Crops out a selected area of an image and makes it ready to be used by FaceRecognizer.
prepareFaceImage(string $image_path, string $prepared_image_path, float $x, float $y, float $width, float $height[, bool $overwrite_existing = false ]) : bool
Note: The selected area should follow the normalized coordinate system.
Parameters
- $image_path : string
-
Path of the source image
- $prepared_image_path : string
-
Path of the prepared image
- $x : float
-
X position
- $y : float
-
Y position
- $width : float
-
Width
- $height : float
-
Height
- $overwrite_existing : bool = false
-
Set to TRUE to overwrite existing prepared image (if any exists)
Tags
Return values
boolfaceRecognizerPredict()
Use FaceRecognizer to predict the association between a face and a label (i.e person name)
faceRecognizerPredict(string $model_file_path, string $test_image_path) : bool|array<string|int, mixed>
Parameters
- $model_file_path : string
-
Path to the FaceRecognizer model state file
- $test_image_path : string
-
Path to the prepared image we are testing
Return values
bool|array<string|int, mixed> —Return the label ID and probability on successful prediction or FALSE on error