Package org.opencv.objdetect
Class FaceRecognizerSF
java.lang.Object
org.opencv.objdetect.FaceRecognizerSF
DNN-based face recognizer
model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_recognition_sface
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic FaceRecognizerSF__fromPtr__(long addr) voidAligns detected face with the source input image and crops itstatic FaceRecognizerSFCreates an instance of this class with given parametersstatic FaceRecognizerSFCreates an instance of this class with given parametersstatic FaceRecognizerSFCreates an instance of this class with given parametersstatic FaceRecognizerSFCreates an instance of this class from a buffer containing the model weights and configuration.static FaceRecognizerSFCreates an instance of this class from a buffer containing the model weights and configuration.static FaceRecognizerSFcreate(String framework, MatOfByte bufferModel, MatOfByte bufferConfig, int backend_id, int target_id) Creates an instance of this class from a buffer containing the model weights and configuration.voidExtracts face feature from aligned imagelongdoubleCalculates the distance between two face featuresdoubleCalculates the distance between two face features
-
Field Details
-
FR_COSINE
public static final int FR_COSINE- See Also:
-
FR_NORM_L2
public static final int FR_NORM_L2- See Also:
-
-
Method Details
-
getNativeObjAddr
public long getNativeObjAddr() -
__fromPtr__
-
alignCrop
Aligns detected face with the source input image and crops it- Parameters:
src_img- input imageface_box- the detected face result from the input imagealigned_img- output aligned image
-
feature
Extracts face feature from aligned image- Parameters:
aligned_img- input aligned imageface_feature- output face feature
-
match
Calculates the distance between two face features- Parameters:
face_feature1- the first input featureface_feature2- the second input feature of the same size and the same type as face_feature1dis_type- defines how to calculate the distance between two face features with optional values "FR_COSINE" or "FR_NORM_L2"- Returns:
- automatically generated
-
match
Calculates the distance between two face features- Parameters:
face_feature1- the first input featureface_feature2- the second input feature of the same size and the same type as face_feature1- Returns:
- automatically generated
-
create
Creates an instance of this class with given parameters- Parameters:
model- the path of the onnx model used for face recognitionconfig- the path to the config file for compability, which is not requested for ONNX modelsbackend_id- the id of backendtarget_id- the id of target device- Returns:
- automatically generated
-
create
Creates an instance of this class with given parameters- Parameters:
model- the path of the onnx model used for face recognitionconfig- the path to the config file for compability, which is not requested for ONNX modelsbackend_id- the id of backend- Returns:
- automatically generated
-
create
Creates an instance of this class with given parameters- Parameters:
model- the path of the onnx model used for face recognitionconfig- the path to the config file for compability, which is not requested for ONNX models- Returns:
- automatically generated
-
create
public static FaceRecognizerSF create(String framework, MatOfByte bufferModel, MatOfByte bufferConfig, int backend_id, int target_id) Creates an instance of this class from a buffer containing the model weights and configuration.- Parameters:
framework- Name of the framework (ONNX, etc.)bufferModel- A buffer containing the binary model weights.bufferConfig- A buffer containing the network configuration.backend_id- The id of the backend.target_id- The id of the target device.- Returns:
- A pointer to the created instance of FaceRecognizerSF.
-
create
public static FaceRecognizerSF create(String framework, MatOfByte bufferModel, MatOfByte bufferConfig, int backend_id) Creates an instance of this class from a buffer containing the model weights and configuration.- Parameters:
framework- Name of the framework (ONNX, etc.)bufferModel- A buffer containing the binary model weights.bufferConfig- A buffer containing the network configuration.backend_id- The id of the backend.- Returns:
- A pointer to the created instance of FaceRecognizerSF.
-
create
public static FaceRecognizerSF create(String framework, MatOfByte bufferModel, MatOfByte bufferConfig) Creates an instance of this class from a buffer containing the model weights and configuration.- Parameters:
framework- Name of the framework (ONNX, etc.)bufferModel- A buffer containing the binary model weights.bufferConfig- A buffer containing the network configuration.- Returns:
- A pointer to the created instance of FaceRecognizerSF.
-