EstervQrCode 1.1.1
Library for qr code manipulation
Public Member Functions | Static Public Member Functions | List of all members
cv::FaceDetectorYN Class Referenceabstract

DNN-based face detector. More...

#include <face.hpp>

Public Member Functions

virtual ~FaceDetectorYN ()
 
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. Call this method when the size of input image does not match the input size when creating model. More...
 
virtual CV_WRAP Size getInputSize ()=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. More...
 
virtual CV_WRAP float getScoreThreshold ()=0
 
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 given value. More...
 
virtual CV_WRAP float getNMSThreshold ()=0
 
virtual CV_WRAP void setTopK (int top_k)=0
 Set the number of bounding boxes preserved before NMS. More...
 
virtual CV_WRAP int getTopK ()=0
 
virtual CV_WRAP int detect (InputArray image, OutputArray faces)=0
 Detects faces in the input image. Following is an example output. More...
 

Static Public Member Functions

static CV_WRAP Ptr< FaceDetectorYNcreate (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. More...
 
static CV_WRAP Ptr< FaceDetectorYNcreate (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)
 

Detailed Description

DNN-based face detector.

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

Constructor & Destructor Documentation

◆ ~FaceDetectorYN()

virtual cv::FaceDetectorYN::~FaceDetectorYN ( )
inlinevirtual

Member Function Documentation

◆ create() [1/2]

static CV_WRAP Ptr<FaceDetectorYN> cv::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 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
frameworkName of origin framework
bufferModelA buffer with a content of binary file with weights
bufferConfigA buffer with a content of text file contains network configuration
input_sizethe size of the input image
score_thresholdthe threshold to filter out bounding boxes of score smaller than the given value
nms_thresholdthe threshold to suppress bounding boxes of IoU bigger than the given value
top_kkeep top K bboxes before NMS
backend_idthe id of backend
target_idthe id of target device

◆ create() [2/2]

static CV_WRAP Ptr<FaceDetectorYN> cv::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 
)
static

Creates an instance of face detector class with given parameters.

Parameters
modelthe path to the requested model
configthe path to the config file for compability, which is not requested for ONNX models
input_sizethe size of the input image
score_thresholdthe threshold to filter out bounding boxes of score smaller than the given value
nms_thresholdthe threshold to suppress bounding boxes of IoU bigger than the given value
top_kkeep top K bboxes before NMS
backend_idthe id of backend
target_idthe id of target device

◆ detect()

virtual CV_WRAP int cv::FaceDetectorYN::detect ( InputArray  image,
OutputArray  faces 
)
pure virtual

Detects faces in the input image. Following is an example output.

image

Parameters
imagean image to detect
facesdetection results stored in a 2D cv::Mat of shape [num_faces, 15]
  • 0-1: x, y of bbox top left corner
  • 2-3: width, height of bbox
  • 4-5: x, y of right eye (blue point in the example image)
  • 6-7: x, y of left eye (red point in the example image)
  • 8-9: x, y of nose tip (green point in the example image)
  • 10-11: x, y of right corner of mouth (pink point in the example image)
  • 12-13: x, y of left corner of mouth (yellow point in the example image)
  • 14: face score

◆ getInputSize()

virtual CV_WRAP Size cv::FaceDetectorYN::getInputSize ( )
pure virtual

◆ getNMSThreshold()

virtual CV_WRAP float cv::FaceDetectorYN::getNMSThreshold ( )
pure virtual

◆ getScoreThreshold()

virtual CV_WRAP float cv::FaceDetectorYN::getScoreThreshold ( )
pure virtual

◆ getTopK()

virtual CV_WRAP int cv::FaceDetectorYN::getTopK ( )
pure virtual

◆ setInputSize()

virtual CV_WRAP void cv::FaceDetectorYN::setInputSize ( const Size input_size)
pure virtual

Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model.

Parameters
input_sizethe size of the input image

◆ setNMSThreshold()

virtual CV_WRAP void cv::FaceDetectorYN::setNMSThreshold ( float  nms_threshold)
pure virtual

Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value.

Parameters
nms_thresholdthreshold for NMS operation

◆ setScoreThreshold()

virtual CV_WRAP void cv::FaceDetectorYN::setScoreThreshold ( float  score_threshold)
pure virtual

Set the score threshold to filter out bounding boxes of score less than the given value.

Parameters
score_thresholdthreshold for filtering out bounding boxes

◆ setTopK()

virtual CV_WRAP void cv::FaceDetectorYN::setTopK ( int  top_k)
pure virtual

Set the number of bounding boxes preserved before NMS.

Parameters
top_kthe number of bounding boxes to preserve from top rank based on score

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