OpenCV 5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::FaceRecognizerSF Class Referenceabstract

DNN-based face recognizer. More...

#include <opencv2/objdetect/face.hpp>

Collaboration diagram for cv::FaceRecognizerSF:

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
 Aligns detected face with the source input image and crops it.
 
virtual void feature (InputArray aligned_img, OutputArray face_feature)=0
 Extracts face feature from aligned image.
 
virtual double match (InputArray face_feature1, InputArray face_feature2, int dis_type=FaceRecognizerSF::FR_COSINE) const =0
 Calculates the distance between two face features.
 

Static Public Member Functions

static Ptr< FaceRecognizerSFcreate (const String &framework, const std::vector< uchar > &bufferModel, const std::vector< uchar > &bufferConfig, int backend_id=0, int target_id=0)
 Creates an instance of this class from a buffer containing the model weights and configuration.
 
static Ptr< FaceRecognizerSFcreate (CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config, int backend_id=0, int target_id=0)
 Creates an instance of this class with given parameters.
 

Detailed Description

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

Aligns detected face with the source input image and crops it.

Parameters
src_imginput image
face_boxthe detected face result from the input image
aligned_imgoutput aligned image

◆ create() [1/2]

static Ptr< FaceRecognizerSF > cv::FaceRecognizerSF::create ( const String & framework,
const std::vector< uchar > & bufferModel,
const std::vector< uchar > & bufferConfig,
int backend_id = 0,
int target_id = 0 )
static
Python:
cv.FaceRecognizerSF.create(model, config[, backend_id[, target_id]]) -> retval
cv.FaceRecognizerSF.create(framework, bufferModel, bufferConfig[, backend_id[, target_id]]) -> retval
cv.FaceRecognizerSF_create(model, config[, backend_id[, target_id]]) -> retval
cv.FaceRecognizerSF_create(framework, bufferModel, bufferConfig[, backend_id[, target_id]]) -> retval

Creates an instance of this class from a buffer containing the model weights and configuration.

Parameters
frameworkName of the framework (ONNX, etc.)
bufferModelA buffer containing the binary model weights.
bufferConfigA buffer containing the network configuration.
backend_idThe id of the backend.
target_idThe id of the target device.
Returns
A pointer to the created instance of FaceRecognizerSF.

◆ create() [2/2]

static Ptr< FaceRecognizerSF > cv::FaceRecognizerSF::create ( CV_WRAP_FILE_PATH const String & model,
CV_WRAP_FILE_PATH 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(framework, bufferModel, bufferConfig[, backend_id[, target_id]]) -> retval
cv.FaceRecognizerSF_create(model, config[, backend_id[, target_id]]) -> retval
cv.FaceRecognizerSF_create(framework, bufferModel, bufferConfig[, 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

Extracts 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

Calculates 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_typedefines how to calculate the distance between two face features with optional values "FR_COSINE" or "FR_NORM_L2"

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