Trait opencv::hub_prelude::FaceDetectorYN
source · [−]pub trait FaceDetectorYN: FaceDetectorYNConst {
fn as_raw_mut_FaceDetectorYN(&mut self) -> *mut c_void;
fn set_input_size(&mut self, input_size: Size) -> Result<()> { ... }
fn get_input_size(&mut self) -> Result<Size> { ... }
fn set_score_threshold(&mut self, score_threshold: f32) -> Result<()> { ... }
fn get_score_threshold(&mut self) -> Result<f32> { ... }
fn set_nms_threshold(&mut self, nms_threshold: f32) -> Result<()> { ... }
fn get_nms_threshold(&mut self) -> Result<f32> { ... }
fn set_top_k(&mut self, top_k: i32) -> Result<()> { ... }
fn get_top_k(&mut self) -> Result<i32> { ... }
fn detect(
&mut self,
image: &dyn ToInputArray,
faces: &mut dyn ToOutputArray
) -> Result<i32> { ... }
}
Required Methods
fn as_raw_mut_FaceDetectorYN(&mut self) -> *mut c_void
Provided Methods
sourcefn 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
Parameters
- input_size: the size of the input image
fn get_input_size(&mut self) -> Result<Size>
sourcefn 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
Parameters
- score_threshold: threshold for filtering out bounding boxes
fn get_score_threshold(&mut self) -> Result<f32>
sourcefn 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
Parameters
- nms_threshold: threshold for NMS operation
fn get_nms_threshold(&mut self) -> Result<f32>
sourcefn 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
Parameters
- top_k: the number of bounding boxes to preserve from top rank based on score
fn get_top_k(&mut self) -> Result<i32>
sourcefn detect(
&mut self,
image: &dyn ToInputArray,
faces: &mut dyn ToOutputArray
) -> Result<i32>
fn detect(
&mut self,
image: &dyn ToInputArray,
faces: &mut dyn ToOutputArray
) -> Result<i32>
A simple interface to detect face from given image
Parameters
- image: an image to detect
- faces: detection results stored in a cv::Mat
Implementations
sourceimpl dyn FaceDetectorYN + '_
impl dyn 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<dyn 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<dyn FaceDetectorYN>>
Creates an instance of this 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