EstervQrCode 1.1.1
Library for qr code manipulation
face.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4 
5 #ifndef OPENCV_OBJDETECT_FACE_HPP
6 #define OPENCV_OBJDETECT_FACE_HPP
7 
8 #include <opencv2/core.hpp>
9 
10 namespace cv
11 {
12 
15 
21 {
22 public:
23  virtual ~FaceDetectorYN() {}
24 
29  CV_WRAP virtual void setInputSize(const Size& input_size) = 0;
30 
31  CV_WRAP virtual Size getInputSize() = 0;
32 
37  CV_WRAP virtual void setScoreThreshold(float score_threshold) = 0;
38 
39  CV_WRAP virtual float getScoreThreshold() = 0;
40 
45  CV_WRAP virtual void setNMSThreshold(float nms_threshold) = 0;
46 
47  CV_WRAP virtual float getNMSThreshold() = 0;
48 
53  CV_WRAP virtual void setTopK(int top_k) = 0;
54 
55  CV_WRAP virtual int getTopK() = 0;
56 
72  CV_WRAP virtual int detect(InputArray image, OutputArray faces) = 0;
73 
86  CV_WRAP_FILE_PATH const String& config,
87  const Size& input_size,
88  float score_threshold = 0.9f,
89  float nms_threshold = 0.3f,
90  int top_k = 5000,
91  int backend_id = 0,
92  int target_id = 0);
93 
106  CV_WRAP static Ptr<FaceDetectorYN> create(const String& framework,
107  const std::vector<uchar>& bufferModel,
108  const std::vector<uchar>& bufferConfig,
109  const Size& input_size,
110  float score_threshold = 0.9f,
111  float nms_threshold = 0.3f,
112  int top_k = 5000,
113  int backend_id = 0,
114  int target_id = 0);
115 
116 };
117 
123 {
124 public:
125  virtual ~FaceRecognizerSF() {}
126 
129  enum DisType { FR_COSINE=0, FR_NORM_L2=1 };
130 
136  CV_WRAP virtual void alignCrop(InputArray src_img, InputArray face_box, OutputArray aligned_img) const = 0;
137 
142  CV_WRAP virtual void feature(InputArray aligned_img, OutputArray face_feature) = 0;
143 
149  CV_WRAP virtual double match(InputArray face_feature1, InputArray face_feature2, int dis_type = FaceRecognizerSF::FR_COSINE) const = 0;
150 
157  CV_WRAP static Ptr<FaceRecognizerSF> create(CV_WRAP_FILE_PATH const String& model, CV_WRAP_FILE_PATH const String& config, int backend_id = 0, int target_id = 0);
158 };
159 
161 } // namespace cv
162 
163 #endif
DNN-based face detector.
Definition: face.hpp:21
static CV_WRAP Ptr< FaceDetectorYN > create(const String &framework, const std::vector< uchar > &bufferModel, const std::vector< uchar > &bufferConfig, const Size &input_size, float score_threshold=0.9f, float nms_threshold=0.3f, int top_k=5000, int backend_id=0, int target_id=0)
virtual CV_WRAP void setScoreThreshold(float score_threshold)=0
Set the score threshold to filter out bounding boxes of score less than the given value.
virtual CV_WRAP void setTopK(int top_k)=0
Set the number of bounding boxes preserved before NMS.
virtual CV_WRAP float getNMSThreshold()=0
virtual CV_WRAP Size getInputSize()=0
virtual CV_WRAP int getTopK()=0
virtual CV_WRAP float getScoreThreshold()=0
virtual CV_WRAP int detect(InputArray image, OutputArray faces)=0
Detects faces in the input image. Following is an example output.
virtual CV_WRAP void setInputSize(const Size &input_size)=0
Set the size for the network input, which overwrites the input size of creating model....
virtual CV_WRAP void setNMSThreshold(float nms_threshold)=0
Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the g...
virtual ~FaceDetectorYN()
Definition: face.hpp:23
static CV_WRAP Ptr< FaceDetectorYN > create(CV_WRAP_FILE_PATH const String &model, CV_WRAP_FILE_PATH const String &config, const Size &input_size, float score_threshold=0.9f, float nms_threshold=0.3f, int top_k=5000, int backend_id=0, int target_id=0)
Creates an instance of face detector class with given parameters.
DNN-based face recognizer.
Definition: face.hpp:123
virtual CV_WRAP void feature(InputArray aligned_img, OutputArray face_feature)=0
Extracting face feature from aligned image.
DisType
Definition of distance used for calculating the distance between two face features.
Definition: face.hpp:129
@ FR_COSINE
Definition: face.hpp:129
static CV_WRAP Ptr< FaceRecognizerSF > create(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.
virtual ~FaceRecognizerSF()
Definition: face.hpp:125
virtual CV_WRAP double match(InputArray face_feature1, InputArray face_feature2, int dis_type=FaceRecognizerSF::FR_COSINE) const =0
Calculating the distance between two face features.
virtual CV_WRAP void alignCrop(InputArray src_img, InputArray face_box, OutputArray aligned_img) const =0
Aligning image to put face on the standard position.
Template class for specifying the size of an image or rectangle.
Definition: types.hpp:335
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:296
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition: mat.hpp:442
#define CV_EXPORTS_W
Definition: cvdef.h:472
#define CV_WRAP_FILE_PATH
Definition: cvdef.h:487
#define CV_WRAP
Definition: cvdef.h:481
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
Definition: cvstd_wrapper.hpp:74