opencv::dnn

Trait DetectionModelTrait

Source
pub trait DetectionModelTrait: DetectionModelTraitConst + ModelTrait {
    // Required method
    fn as_raw_mut_DetectionModel(&mut self) -> *mut c_void;

    // Provided methods
    fn set_nms_across_classes(&mut self, value: bool) -> Result<DetectionModel> { ... }
    fn get_nms_across_classes(&mut self) -> Result<bool> { ... }
    fn detect(
        &mut self,
        frame: &impl ToInputArray,
        class_ids: &mut Vector<i32>,
        confidences: &mut Vector<f32>,
        boxes: &mut Vector<Rect>,
        conf_threshold: f32,
        nms_threshold: f32,
    ) -> Result<()> { ... }
    fn detect_def(
        &mut self,
        frame: &impl ToInputArray,
        class_ids: &mut Vector<i32>,
        confidences: &mut Vector<f32>,
        boxes: &mut Vector<Rect>,
    ) -> Result<()> { ... }
}
Expand description

Mutable methods for crate::dnn::DetectionModel

Required Methods§

Provided Methods§

Source

fn set_nms_across_classes(&mut self, value: bool) -> Result<DetectionModel>

nmsAcrossClasses defaults to false, such that when non max suppression is used during the detect() function, it will do so per-class. This function allows you to toggle this behaviour.

§Parameters
  • value: The new value for nmsAcrossClasses
Source

fn get_nms_across_classes(&mut self) -> Result<bool>

Getter for nmsAcrossClasses. This variable defaults to false, such that when non max suppression is used during the detect() function, it will do so only per-class

Source

fn detect( &mut self, frame: &impl ToInputArray, class_ids: &mut Vector<i32>, confidences: &mut Vector<f32>, boxes: &mut Vector<Rect>, conf_threshold: f32, nms_threshold: f32, ) -> Result<()>

Given the @p input frame, create input blob, run net and return result detections.

§Parameters
  • frame: The input image.
  • classIds:[out] Class indexes in result detection.
  • confidences:[out] A set of corresponding confidences.
  • boxes:[out] A set of bounding boxes.
  • confThreshold: A threshold used to filter boxes by confidences.
  • nmsThreshold: A threshold used in non maximum suppression.
§C++ default parameters
  • conf_threshold: 0.5f
  • nms_threshold: 0.0f
Source

fn detect_def( &mut self, frame: &impl ToInputArray, class_ids: &mut Vector<i32>, confidences: &mut Vector<f32>, boxes: &mut Vector<Rect>, ) -> Result<()>

Given the @p input frame, create input blob, run net and return result detections.

§Parameters
  • frame: The input image.
  • classIds:[out] Class indexes in result detection.
  • confidences:[out] A set of corresponding confidences.
  • boxes:[out] A set of bounding boxes.
  • confThreshold: A threshold used to filter boxes by confidences.
  • nmsThreshold: A threshold used in non maximum suppression.
§Note

This alternative version of DetectionModelTrait::detect function uses the following default values for its arguments:

  • conf_threshold: 0.5f
  • nms_threshold: 0.0f

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§