Package org.opencv.objdetect
Class FaceRecognizerSF
java.lang.Object
org.opencv.objdetect.FaceRecognizerSF
public class FaceRecognizerSF extends Object
DNN-based face recognizer
model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_recognition_sface
-
Field Summary
Fields Modifier and Type Field Description static int
FR_COSINE
static int
FR_NORM_L2
protected long
nativeObj
-
Constructor Summary
Constructors Modifier Constructor Description protected
FaceRecognizerSF(long addr)
-
Method Summary
Modifier and Type Method Description static FaceRecognizerSF
__fromPtr__(long addr)
void
alignCrop(Mat src_img, Mat face_box, Mat aligned_img)
Aligning image to put face on the standard positionstatic FaceRecognizerSF
create(String model, String config)
Creates an instance of this class with given parametersstatic FaceRecognizerSF
create(String model, String config, int backend_id)
Creates an instance of this class with given parametersstatic FaceRecognizerSF
create(String model, String config, int backend_id, int target_id)
Creates an instance of this class with given parametersvoid
feature(Mat aligned_img, Mat face_feature)
Extracting face feature from aligned imageprotected void
finalize()
long
getNativeObjAddr()
double
match(Mat face_feature1, Mat face_feature2)
Calculating the distance between two face featuresdouble
match(Mat face_feature1, Mat face_feature2, int dis_type)
Calculating the distance between two face features
-
Field Details
-
nativeObj
-
FR_COSINE
- See Also:
- Constant Field Values
-
FR_NORM_L2
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
getNativeObjAddr
-
__fromPtr__
-
alignCrop
Aligning image to put face on the standard position- Parameters:
src_img
- input imageface_box
- the detection result used for indicate face in input imagealigned_img
- output aligned image
-
feature
Extracting face feature from aligned image- Parameters:
aligned_img
- input aligned imageface_feature
- output face feature
-
match
Calculating 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
- defining the similarity with optional values "FR_OSINE" or "FR_NORM_L2"- Returns:
- automatically generated
-
match
Calculating 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
-
finalize
-