Trait CUDA_CascadeClassifierTrait

Source
pub trait CUDA_CascadeClassifierTrait: AlgorithmTrait + CUDA_CascadeClassifierTraitConst {
    // Required method
    fn as_raw_mut_CUDA_CascadeClassifier(&mut self) -> *mut c_void;

    // Provided methods
    fn set_max_object_size(&mut self, max_object_size: Size) -> Result<()> { ... }
    fn set_min_object_size(&mut self, min_size: Size) -> Result<()> { ... }
    fn set_scale_factor(&mut self, scale_factor: f64) -> Result<()> { ... }
    fn set_min_neighbors(&mut self, min_neighbors: i32) -> Result<()> { ... }
    fn set_find_largest_object(
        &mut self,
        find_largest_object: bool,
    ) -> Result<()> { ... }
    fn get_find_largest_object(&mut self) -> Result<bool> { ... }
    fn set_max_num_objects(&mut self, max_num_objects: i32) -> Result<()> { ... }
    fn detect_multi_scale(
        &mut self,
        image: &impl ToInputArray,
        objects: &mut impl ToOutputArray,
        stream: &mut impl StreamTrait,
    ) -> Result<()> { ... }
    fn detect_multi_scale_def(
        &mut self,
        image: &impl ToInputArray,
        objects: &mut impl ToOutputArray,
    ) -> Result<()> { ... }
    fn convert(
        &mut self,
        gpu_objects: &mut impl ToOutputArray,
        objects: &mut Vector<Rect>,
    ) -> Result<()> { ... }
}
Expand description

Required Methods§

Provided Methods§

Source

fn set_max_object_size(&mut self, max_object_size: Size) -> Result<()>

Maximum possible object size. Objects larger than that are ignored. Used for second signature and supported only for LBP cascades.

Source

fn set_min_object_size(&mut self, min_size: Size) -> Result<()>

Minimum possible object size. Objects smaller than that are ignored.

Source

fn set_scale_factor(&mut self, scale_factor: f64) -> Result<()>

Parameter specifying how much the image size is reduced at each image scale.

Source

fn set_min_neighbors(&mut self, min_neighbors: i32) -> Result<()>

Parameter specifying how many neighbors each candidate rectangle should have to retain it.

Source

fn set_find_largest_object(&mut self, find_largest_object: bool) -> Result<()>

Source

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

Source

fn set_max_num_objects(&mut self, max_num_objects: i32) -> Result<()>

Source

fn detect_multi_scale( &mut self, image: &impl ToInputArray, objects: &mut impl ToOutputArray, stream: &mut impl StreamTrait, ) -> Result<()>

Detects objects of different sizes in the input image.

§Parameters
  • image: Matrix of type CV_8U containing an image where objects should be detected.
  • objects: Buffer to store detected objects (rectangles).
  • stream: CUDA stream.

To get final array of detected objects use CascadeClassifier::convert method.

   Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);

   Mat image_cpu = imread(...)
   GpuMat image_gpu(image_cpu);

   GpuMat objbuf;
   cascade_gpu->detectMultiScale(image_gpu, objbuf);

   std::vector<Rect> faces;
   cascade_gpu->convert(objbuf, faces);

   for(int i = 0; i < detections_num; ++i)
       cv::rectangle(image_cpu, faces[i], Scalar(255));

   imshow("Faces", image_cpu);
§See also

CascadeClassifier::detectMultiScale

§C++ default parameters
  • stream: Stream::Null()
Source

fn detect_multi_scale_def( &mut self, image: &impl ToInputArray, objects: &mut impl ToOutputArray, ) -> Result<()>

Detects objects of different sizes in the input image.

§Parameters
  • image: Matrix of type CV_8U containing an image where objects should be detected.
  • objects: Buffer to store detected objects (rectangles).
  • stream: CUDA stream.

To get final array of detected objects use CascadeClassifier::convert method.

   Ptr<cuda::CascadeClassifier> cascade_gpu = cuda::CascadeClassifier::create(...);

   Mat image_cpu = imread(...)
   GpuMat image_gpu(image_cpu);

   GpuMat objbuf;
   cascade_gpu->detectMultiScale(image_gpu, objbuf);

   std::vector<Rect> faces;
   cascade_gpu->convert(objbuf, faces);

   for(int i = 0; i < detections_num; ++i)
       cv::rectangle(image_cpu, faces[i], Scalar(255));

   imshow("Faces", image_cpu);
§See also

CascadeClassifier::detectMultiScale

§Note

This alternative version of CUDA_CascadeClassifierTrait::detect_multi_scale function uses the following default values for its arguments:

  • stream: Stream::Null()
Source

fn convert( &mut self, gpu_objects: &mut impl ToOutputArray, objects: &mut Vector<Rect>, ) -> Result<()>

Converts objects array from internal representation to standard vector.

§Parameters
  • gpu_objects: Objects array in internal representation.
  • objects: Resulting array.

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§