pub struct FaceDetectorYN { /* private fields */ }
Expand description
DNN-based face detector
model download link: https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet
Implementations§
Source§impl FaceDetectorYN
impl FaceDetectorYN
Sourcepub fn create(
model: &str,
config: &str,
input_size: Size,
score_threshold: f32,
nms_threshold: f32,
top_k: i32,
backend_id: i32,
target_id: i32,
) -> Result<Ptr<FaceDetectorYN>>
pub fn create( model: &str, config: &str, input_size: Size, score_threshold: f32, nms_threshold: f32, top_k: i32, backend_id: i32, target_id: i32, ) -> Result<Ptr<FaceDetectorYN>>
Creates an instance of face detector class with given parameters
§Parameters
- model: the path to the requested model
- config: the path to the config file for compability, which is not requested for ONNX models
- input_size: the size of the input image
- score_threshold: the threshold to filter out bounding boxes of score smaller than the given value
- nms_threshold: the threshold to suppress bounding boxes of IoU bigger than the given value
- top_k: keep top K bboxes before NMS
- backend_id: the id of backend
- target_id: the id of target device
§C++ default parameters
- score_threshold: 0.9f
- nms_threshold: 0.3f
- top_k: 5000
- backend_id: 0
- target_id: 0
Sourcepub fn create_def(
model: &str,
config: &str,
input_size: Size,
) -> Result<Ptr<FaceDetectorYN>>
pub fn create_def( model: &str, config: &str, input_size: Size, ) -> Result<Ptr<FaceDetectorYN>>
Creates an instance of face detector class with given parameters
§Parameters
- model: the path to the requested model
- config: the path to the config file for compability, which is not requested for ONNX models
- input_size: the size of the input image
- score_threshold: the threshold to filter out bounding boxes of score smaller than the given value
- nms_threshold: the threshold to suppress bounding boxes of IoU bigger than the given value
- top_k: keep top K bboxes before NMS
- backend_id: the id of backend
- target_id: the id of target device
§Note
This alternative version of FaceDetectorYN::create function uses the following default values for its arguments:
- score_threshold: 0.9f
- nms_threshold: 0.3f
- top_k: 5000
- backend_id: 0
- target_id: 0
Sourcepub fn create_1(
framework: &str,
buffer_model: &Vector<u8>,
buffer_config: &Vector<u8>,
input_size: Size,
score_threshold: f32,
nms_threshold: f32,
top_k: i32,
backend_id: i32,
target_id: i32,
) -> Result<Ptr<FaceDetectorYN>>
pub fn create_1( framework: &str, buffer_model: &Vector<u8>, buffer_config: &Vector<u8>, input_size: Size, score_threshold: f32, nms_threshold: f32, top_k: i32, backend_id: i32, target_id: i32, ) -> Result<Ptr<FaceDetectorYN>>
Creates an instance of face detector class with given parameters
§Parameters
- model: the path to the requested model
- config: the path to the config file for compability, which is not requested for ONNX models
- input_size: the size of the input image
- score_threshold: the threshold to filter out bounding boxes of score smaller than the given value
- nms_threshold: the threshold to suppress bounding boxes of IoU bigger than the given value
- top_k: keep top K bboxes before NMS
- backend_id: the id of backend
- target_id: the id of target device
§Overloaded parameters
- framework: Name of origin framework
- bufferModel: A buffer with a content of binary file with weights
- bufferConfig: A buffer with a content of text file contains network configuration
- input_size: the size of the input image
- score_threshold: the threshold to filter out bounding boxes of score smaller than the given value
- nms_threshold: the threshold to suppress bounding boxes of IoU bigger than the given value
- top_k: keep top K bboxes before NMS
- backend_id: the id of backend
- target_id: the id of target device
§C++ default parameters
- score_threshold: 0.9f
- nms_threshold: 0.3f
- top_k: 5000
- backend_id: 0
- target_id: 0
Sourcepub fn create_def_1(
framework: &str,
buffer_model: &Vector<u8>,
buffer_config: &Vector<u8>,
input_size: Size,
) -> Result<Ptr<FaceDetectorYN>>
pub fn create_def_1( framework: &str, buffer_model: &Vector<u8>, buffer_config: &Vector<u8>, input_size: Size, ) -> Result<Ptr<FaceDetectorYN>>
@overload
§Parameters
- framework: Name of origin framework
- bufferModel: A buffer with a content of binary file with weights
- bufferConfig: A buffer with a content of text file contains network configuration
- input_size: the size of the input image
- score_threshold: the threshold to filter out bounding boxes of score smaller than the given value
- nms_threshold: the threshold to suppress bounding boxes of IoU bigger than the given value
- top_k: keep top K bboxes before NMS
- backend_id: the id of backend
- target_id: the id of target device
§Note
This alternative version of FaceDetectorYN::create function uses the following default values for its arguments:
- score_threshold: 0.9f
- nms_threshold: 0.3f
- top_k: 5000
- backend_id: 0
- target_id: 0
Trait Implementations§
Source§impl Boxed for FaceDetectorYN
impl Boxed for FaceDetectorYN
Source§unsafe fn from_raw(
ptr: <FaceDetectorYN as OpenCVFromExtern>::ExternReceive,
) -> Self
unsafe fn from_raw( ptr: <FaceDetectorYN as OpenCVFromExtern>::ExternReceive, ) -> Self
Wrap the specified raw pointer Read more
Source§fn into_raw(
self,
) -> <FaceDetectorYN as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw( self, ) -> <FaceDetectorYN as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying raw pointer while consuming this wrapper. Read more
Source§fn as_raw(&self) -> <FaceDetectorYN as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <FaceDetectorYN as OpenCVTypeExternContainer>::ExternSend
Return the underlying raw pointer. Read more
Source§fn as_raw_mut(
&mut self,
) -> <FaceDetectorYN as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut( &mut self, ) -> <FaceDetectorYN as OpenCVTypeExternContainer>::ExternSendMut
Return the underlying mutable raw pointer Read more
Source§impl Debug for FaceDetectorYN
impl Debug for FaceDetectorYN
Source§impl Drop for FaceDetectorYN
impl Drop for FaceDetectorYN
Source§impl FaceDetectorYNTrait for FaceDetectorYN
impl FaceDetectorYNTrait for FaceDetectorYN
fn as_raw_mut_FaceDetectorYN(&mut self) -> *mut c_void
Source§fn set_input_size(&mut self, input_size: Size) -> Result<()>
fn set_input_size(&mut self, input_size: Size) -> Result<()>
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 Read more
fn get_input_size(&mut self) -> Result<Size>
Source§fn set_score_threshold(&mut self, score_threshold: f32) -> Result<()>
fn set_score_threshold(&mut self, score_threshold: f32) -> Result<()>
Set the score threshold to filter out bounding boxes of score less than the given value Read more
fn get_score_threshold(&mut self) -> Result<f32>
Source§fn set_nms_threshold(&mut self, nms_threshold: f32) -> Result<()>
fn set_nms_threshold(&mut self, nms_threshold: f32) -> Result<()>
Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value Read more
fn get_nms_threshold(&mut self) -> Result<f32>
Source§fn set_top_k(&mut self, top_k: i32) -> Result<()>
fn set_top_k(&mut self, top_k: i32) -> Result<()>
Set the number of bounding boxes preserved before NMS Read more
fn get_top_k(&mut self) -> Result<i32>
Source§fn detect(
&mut self,
image: &impl ToInputArray,
faces: &mut impl ToOutputArray,
) -> Result<i32>
fn detect( &mut self, image: &impl ToInputArray, faces: &mut impl ToOutputArray, ) -> Result<i32>
Detects faces in the input image. Following is an example output. Read more
Source§impl FaceDetectorYNTraitConst for FaceDetectorYN
impl FaceDetectorYNTraitConst for FaceDetectorYN
fn as_raw_FaceDetectorYN(&self) -> *const c_void
impl Send for FaceDetectorYN
Auto Trait Implementations§
impl Freeze for FaceDetectorYN
impl RefUnwindSafe for FaceDetectorYN
impl !Sync for FaceDetectorYN
impl Unpin for FaceDetectorYN
impl UnwindSafe for FaceDetectorYN
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
Source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res,
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res
Helper function to call OpenCV functions that allow in-place modification of a
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data,
but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place
modification is imgproc::threshold
. Read more