@Namespace(value="cv") @Properties(inherit=opencv_objdetect.class) public class FaceDetectorYN extends Pointer
/** \brief DNN-based face detector
model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
FaceDetectorYN(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
static FaceDetectorYN |
create(BytePointer framework,
byte[] bufferModel,
byte[] bufferConfig,
Size input_size) |
static FaceDetectorYN |
create(BytePointer framework,
byte[] bufferModel,
byte[] bufferConfig,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id) |
static FaceDetectorYN |
create(BytePointer framework,
ByteBuffer bufferModel,
ByteBuffer bufferConfig,
Size input_size) |
static FaceDetectorYN |
create(BytePointer framework,
ByteBuffer bufferModel,
ByteBuffer bufferConfig,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id) |
static FaceDetectorYN |
create(BytePointer framework,
BytePointer bufferModel,
BytePointer bufferConfig,
Size input_size) |
static FaceDetectorYN |
create(BytePointer framework,
BytePointer bufferModel,
BytePointer bufferConfig,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id)
\overload
|
static FaceDetectorYN |
create(BytePointer model,
BytePointer config,
Size input_size) |
static FaceDetectorYN |
create(BytePointer model,
BytePointer config,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id)
\brief Creates an instance of face detector class with given parameters
|
static FaceDetectorYN |
create(String framework,
byte[] bufferModel,
byte[] bufferConfig,
Size input_size) |
static FaceDetectorYN |
create(String framework,
byte[] bufferModel,
byte[] bufferConfig,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id) |
static FaceDetectorYN |
create(String framework,
ByteBuffer bufferModel,
ByteBuffer bufferConfig,
Size input_size) |
static FaceDetectorYN |
create(String framework,
ByteBuffer bufferModel,
ByteBuffer bufferConfig,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id) |
static FaceDetectorYN |
create(String framework,
BytePointer bufferModel,
BytePointer bufferConfig,
Size input_size) |
static FaceDetectorYN |
create(String framework,
BytePointer bufferModel,
BytePointer bufferConfig,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id) |
static FaceDetectorYN |
create(String model,
String config,
Size input_size) |
static FaceDetectorYN |
create(String model,
String config,
Size input_size,
float score_threshold,
float nms_threshold,
int top_k,
int backend_id,
int target_id) |
int |
detect(GpuMat image,
GpuMat faces) |
int |
detect(Mat image,
Mat faces)
\brief Detects faces in the input image.
|
int |
detect(UMat image,
UMat faces) |
Size |
getInputSize() |
float |
getNMSThreshold() |
float |
getScoreThreshold() |
int |
getTopK() |
void |
setInputSize(Size input_size)
\brief Set the size for the network input, which overwrites the input size of creating model.
|
void |
setNMSThreshold(float nms_threshold)
\brief Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value
|
void |
setScoreThreshold(float score_threshold)
\brief Set the score threshold to filter out bounding boxes of score less than the given value
|
void |
setTopK(int top_k)
\brief Set the number of bounding boxes preserved before NMS
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public FaceDetectorYN(Pointer p)
Pointer(Pointer)
.public void setInputSize(@Const @ByRef Size input_size)
input_size
- the size of the input imagepublic void setScoreThreshold(float score_threshold)
score_threshold
- threshold for filtering out bounding boxespublic float getScoreThreshold()
public void setNMSThreshold(float nms_threshold)
nms_threshold
- threshold for NMS operationpublic float getNMSThreshold()
public void setTopK(int top_k)
top_k
- the number of bounding boxes to preserve from top rank based on scorepublic int getTopK()
public int detect(@ByVal Mat image, @ByVal Mat faces)
![image](pics/lena-face-detection.jpg)
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 score@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer model, @opencv_core.Str BytePointer config, @Const @ByRef 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 device@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer model, @opencv_core.Str BytePointer config, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String model, @opencv_core.Str String config, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String model, @opencv_core.Str String config, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer framework, @Cast(value="uchar*") @StdVector BytePointer bufferModel, @Cast(value="uchar*") @StdVector BytePointer bufferConfig, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
framework
- Name of origin frameworkbufferModel
- A buffer with a content of binary file with weightsbufferConfig
- A buffer with a content of text file contains network configurationinput_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 device@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer framework, @Cast(value="uchar*") @StdVector BytePointer bufferModel, @Cast(value="uchar*") @StdVector BytePointer bufferConfig, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String framework, @Cast(value="uchar*") @StdVector ByteBuffer bufferModel, @Cast(value="uchar*") @StdVector ByteBuffer bufferConfig, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String framework, @Cast(value="uchar*") @StdVector ByteBuffer bufferModel, @Cast(value="uchar*") @StdVector ByteBuffer bufferConfig, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer framework, @Cast(value="uchar*") @StdVector byte[] bufferModel, @Cast(value="uchar*") @StdVector byte[] bufferConfig, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer framework, @Cast(value="uchar*") @StdVector byte[] bufferModel, @Cast(value="uchar*") @StdVector byte[] bufferConfig, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String framework, @Cast(value="uchar*") @StdVector BytePointer bufferModel, @Cast(value="uchar*") @StdVector BytePointer bufferConfig, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String framework, @Cast(value="uchar*") @StdVector BytePointer bufferModel, @Cast(value="uchar*") @StdVector BytePointer bufferConfig, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer framework, @Cast(value="uchar*") @StdVector ByteBuffer bufferModel, @Cast(value="uchar*") @StdVector ByteBuffer bufferConfig, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str BytePointer framework, @Cast(value="uchar*") @StdVector ByteBuffer bufferModel, @Cast(value="uchar*") @StdVector ByteBuffer bufferConfig, @Const @ByRef Size input_size)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String framework, @Cast(value="uchar*") @StdVector byte[] bufferModel, @Cast(value="uchar*") @StdVector byte[] bufferConfig, @Const @ByRef Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
@opencv_core.Ptr public static FaceDetectorYN create(@opencv_core.Str String framework, @Cast(value="uchar*") @StdVector byte[] bufferModel, @Cast(value="uchar*") @StdVector byte[] bufferConfig, @Const @ByRef Size input_size)
Copyright © 2024. All rights reserved.