public class FaceDetectorYN
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static FaceDetectorYN |
__fromPtr__(long addr) |
static FaceDetectorYN |
create(java.lang.String model,
java.lang.String config,
Size input_size)
Creates an instance of this class with given parameters
|
static FaceDetectorYN |
create(java.lang.String model,
java.lang.String config,
Size input_size,
float score_threshold)
Creates an instance of this class with given parameters
|
static FaceDetectorYN |
create(java.lang.String model,
java.lang.String config,
Size input_size,
float score_threshold,
float nms_threshold)
Creates an instance of this class with given parameters
|
static FaceDetectorYN |
create(java.lang.String model,
java.lang.String config,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k)
Creates an instance of this class with given parameters
|
static FaceDetectorYN |
create(java.lang.String model,
java.lang.String config,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id)
Creates an instance of this class with given parameters
|
static FaceDetectorYN |
create(java.lang.String model,
java.lang.String config,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id)
Creates an instance of this class with given parameters
|
int |
detect(Mat image,
Mat faces)
Detects faces in the input image.
|
Size |
getInputSize() |
long |
getNativeObjAddr() |
float |
getNMSThreshold() |
float |
getScoreThreshold() |
int |
getTopK() |
void |
setInputSize(Size input_size)
Set the size for the network input, which overwrites the input size of creating model.
|
void |
setNMSThreshold(float nms_threshold)
Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value
|
void |
setScoreThreshold(float score_threshold)
Set the score threshold to filter out bounding boxes of score less than the given value
|
void |
setTopK(int top_k)
Set the number of bounding boxes preserved before NMS
|
public static FaceDetectorYN __fromPtr__(long addr)
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size)
model - the path to the requested modelconfig - the path to the config file for compability, which is not requested for ONNX modelsinput_size - the size of the input imagepublic static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold)
model - the path to the requested modelconfig - the path to the config file for compability, which is not requested for ONNX modelsinput_size - the size of the input imagescore_threshold - the threshold to filter out bounding boxes of score smaller than the given valuepublic static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold)
model - the path to the requested modelconfig - the path to the config file for compability, which is not requested for ONNX modelsinput_size - the size of the input imagescore_threshold - the threshold to filter out bounding boxes of score smaller than the given valuenms_threshold - the threshold to suppress bounding boxes of IoU bigger than the given valuepublic static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k)
model - the path to the requested modelconfig - the path to the config file for compability, which is not requested for ONNX modelsinput_size - the size of the input imagescore_threshold - the threshold to filter out bounding boxes of score smaller than the given valuenms_threshold - the threshold to suppress bounding boxes of IoU bigger than the given valuetop_k - keep top K bboxes before NMSpublic static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)
model - the path to the requested modelconfig - the path to the config file for compability, which is not requested for ONNX modelsinput_size - the size of the input imagescore_threshold - the threshold to filter out bounding boxes of score smaller than the given valuenms_threshold - the threshold to suppress bounding boxes of IoU bigger than the given valuetop_k - keep top K bboxes before NMSbackend_id - the id of backendpublic static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
model - the path to the requested modelconfig - the path to the config file for compability, which is not requested for ONNX modelsinput_size - the size of the input imagescore_threshold - the threshold to filter out bounding boxes of score smaller than the given valuenms_threshold - the threshold to suppress bounding boxes of IoU bigger than the given valuetop_k - keep top K bboxes before NMSbackend_id - the id of backendtarget_id - the id of target devicepublic int detect(Mat image, Mat faces)
image - an image to detectfaces - detection 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 scorepublic Size getInputSize()
public long getNativeObjAddr()
public float getNMSThreshold()
public float getScoreThreshold()
public int getTopK()
public void setInputSize(Size input_size)
input_size - the size of the input imagepublic void setNMSThreshold(float nms_threshold)
nms_threshold - threshold for NMS operationpublic void setScoreThreshold(float score_threshold)
score_threshold - threshold for filtering out bounding boxespublic void setTopK(int top_k)
top_k - the number of bounding boxes to preserve from top rank based on scoreGenerated on 2023-06-28 12:47:21 / OpenCV 4.8.0