OpenCV  4.6.0
Open Source Computer Vision
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cv::FaceRecognizerSF Class Referenceabstract

DNN-based face recognizer. More...

#include <opencv2/objdetect/face.hpp>

Public Types

enum  DisType {
  FR_COSINE =0,
  FR_NORM_L2 =1
}
 Definition of distance used for calculating the distance between two face features. More...
 

Public Member Functions

virtual ~FaceRecognizerSF ()
 
virtual void alignCrop (InputArray src_img, InputArray face_box, OutputArray aligned_img) const =0
 Aligning image to put face on the standard position. More...
 
virtual void feature (InputArray aligned_img, OutputArray face_feature)=0
 Extracting face feature from aligned image. More...
 
virtual double match (InputArray face_feature1, InputArray face_feature2, int dis_type=FaceRecognizerSF::FR_COSINE) const =0
 Calculating the distance between two face features. More...
 

Static Public Member Functions

static Ptr< FaceRecognizerSFcreate (const String &model, const String &config, int backend_id=0, int target_id=0)
 Creates an instance of this class with given parameters. More...
 

Detailed Description

DNN-based face recognizer.

model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_recognition_sface

Member Enumeration Documentation

◆ DisType

Definition of distance used for calculating the distance between two face features.

Enumerator
FR_COSINE 
FR_NORM_L2 

Constructor & Destructor Documentation

◆ ~FaceRecognizerSF()

virtual cv::FaceRecognizerSF::~FaceRecognizerSF ( )
inlinevirtual

Member Function Documentation

◆ alignCrop()

virtual void cv::FaceRecognizerSF::alignCrop ( InputArray  src_img,
InputArray  face_box,
OutputArray  aligned_img 
) const
pure virtual
Python:
cv.FaceRecognizerSF.alignCrop(src_img, face_box[, aligned_img]) -> aligned_img

Aligning image to put face on the standard position.

Parameters
src_imginput image
face_boxthe detection result used for indicate face in input image
aligned_imgoutput aligned image

◆ create()

static Ptr<FaceRecognizerSF> cv::FaceRecognizerSF::create ( const String model,
const String config,
int  backend_id = 0,
int  target_id = 0 
)
static
Python:
cv.FaceRecognizerSF.create(model, config[, backend_id[, target_id]]) -> retval
cv.FaceRecognizerSF_create(model, config[, backend_id[, target_id]]) -> retval

Creates an instance of this class with given parameters.

Parameters
modelthe path of the onnx model used for face recognition
configthe path to the config file for compability, which is not requested for ONNX models
backend_idthe id of backend
target_idthe id of target device

◆ feature()

virtual void cv::FaceRecognizerSF::feature ( InputArray  aligned_img,
OutputArray  face_feature 
)
pure virtual
Python:
cv.FaceRecognizerSF.feature(aligned_img[, face_feature]) -> face_feature

Extracting face feature from aligned image.

Parameters
aligned_imginput aligned image
face_featureoutput face feature

◆ match()

virtual double cv::FaceRecognizerSF::match ( InputArray  face_feature1,
InputArray  face_feature2,
int  dis_type = FaceRecognizerSF::FR_COSINE 
) const
pure virtual
Python:
cv.FaceRecognizerSF.match(face_feature1, face_feature2[, dis_type]) -> retval

Calculating the distance between two face features.

Parameters
face_feature1the first input feature
face_feature2the second input feature of the same size and the same type as face_feature1
dis_typedefining the similarity with optional values "FR_OSINE" or "FR_NORM_L2"

The documentation for this class was generated from the following file: