Package org.opencv.objdetect
Class FaceRecognizerSF
- java.lang.Object
-
- org.opencv.objdetect.FaceRecognizerSF
-
public class FaceRecognizerSF extends java.lang.ObjectDNN-based face recognizer, model download link: https://drive.google.com/file/d/1ClK9WiB492c5OZFKveF3XiHCejoOxINW/view.
-
-
Field Summary
Fields Modifier and Type Field Description static intFR_COSINEstatic intFR_NORM_L2protected longnativeObj
-
Constructor Summary
Constructors Modifier Constructor Description protectedFaceRecognizerSF(long addr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FaceRecognizerSF__fromPtr__(long addr)voidalignCrop(Mat src_img, Mat face_box, Mat aligned_img)Aligning image to put face on the standard positionstatic FaceRecognizerSFcreate(java.lang.String model, java.lang.String config)Creates an instance of this class with given parametersstatic FaceRecognizerSFcreate(java.lang.String model, java.lang.String config, int backend_id)Creates an instance of this class with given parametersstatic FaceRecognizerSFcreate(java.lang.String model, java.lang.String config, int backend_id, int target_id)Creates an instance of this class with given parametersvoidfeature(Mat aligned_img, Mat face_feature)Extracting face feature from aligned imageprotected voidfinalize()longgetNativeObjAddr()doublematch(Mat _face_feature1, Mat _face_feature2)Calculating the distance between two face featuresdoublematch(Mat _face_feature1, Mat _face_feature2, int dis_type)Calculating the distance between two face features
-
-
-
Field Detail
-
nativeObj
protected final long nativeObj
-
FR_COSINE
public static final int FR_COSINE
- See Also:
- Constant Field Values
-
FR_NORM_L2
public static final int FR_NORM_L2
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNativeObjAddr
public long getNativeObjAddr()
-
__fromPtr__
public static FaceRecognizerSF __fromPtr__(long addr)
-
alignCrop
public void alignCrop(Mat src_img, Mat face_box, Mat aligned_img)
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
public void feature(Mat aligned_img, Mat face_feature)
Extracting face feature from aligned image- Parameters:
aligned_img- input aligned imageface_feature- output face feature
-
match
public double match(Mat _face_feature1, Mat _face_feature2, int dis_type)
Calculating the distance between two face features- Parameters:
_face_feature1- the first input feature_face_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
public double match(Mat _face_feature1, Mat _face_feature2)
Calculating the distance between two face features- Parameters:
_face_feature1- the first input feature_face_feature2- the second input feature of the same size and the same type as _face_feature1- Returns:
- automatically generated
-
create
public static FaceRecognizerSF create(java.lang.String model, java.lang.String config, int backend_id, int target_id)
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
public static FaceRecognizerSF create(java.lang.String model, java.lang.String config, int backend_id)
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
public static FaceRecognizerSF create(java.lang.String model, java.lang.String config)
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
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-