Trait FaceDetectorYNTrait

Source
pub trait FaceDetectorYNTrait: FaceDetectorYNTraitConst {
    // Required method
    fn as_raw_mut_FaceDetectorYN(&mut self) -> *mut c_void;

    // Provided methods
    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: &impl ToInputArray,
        faces: &mut impl ToOutputArray,
    ) -> Result<i32> { ... }
}
Expand description

Required Methods§

Provided Methods§

Source

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
Source

fn get_input_size(&mut self) -> Result<Size>

Source

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
Source

fn get_score_threshold(&mut self) -> Result<f32>

Source

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
Source

fn get_nms_threshold(&mut self) -> Result<f32>

Source

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
Source

fn get_top_k(&mut self) -> Result<i32>

Source

fn detect( &mut self, image: &impl ToInputArray, faces: &mut impl ToOutputArray, ) -> Result<i32>

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

  • image
§Parameters
  • image: an image to detect
  • faces: 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§