Trait opencv::cudaobjdetect::CascadeClassifier[][src]

pub trait CascadeClassifier: AlgorithmTrait + CascadeClassifierConst {
    fn as_raw_mut_CascadeClassifier(&mut self) -> *mut c_void;

    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: &dyn ToInputArray,
        objects: &mut dyn ToOutputArray,
        stream: &mut Stream
    ) -> Result<()> { ... }
fn convert(
        &mut self,
        gpu_objects: &mut dyn ToOutputArray,
        objects: &mut Vector<Rect>
    ) -> Result<()> { ... } }

Required methods

Provided methods

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

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

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

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

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()

Converts objects array from internal representation to standard vector.

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

Implementations

Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.

Parameters
  • filename: Name of the file from which the classifier is loaded. Only the old haar classifier (trained by the haar training application) and NVIDIA’s nvbin are supported for HAAR and only new type of OpenCV XML cascade supported for LBP. The working haar models can be found at opencv_folder/data/haarcascades_cuda/

Loads the classifier from a file. Cascade type is detected automatically by constructor parameter.

Parameters
  • filename: Name of the file from which the classifier is loaded. Only the old haar classifier (trained by the haar training application) and NVIDIA’s nvbin are supported for HAAR and only new type of OpenCV XML cascade supported for LBP. The working haar models can be found at opencv_folder/data/haarcascades_cuda/
Overloaded parameters

Implementors