CascadeClassifier

Struct CascadeClassifier 

Source
pub struct CascadeClassifier { /* private fields */ }
Expand description

@example samples/cpp/facedetect.cpp This program demonstrates usage of the Cascade classifier class \image html Cascade_Classifier_Tutorial_Result_Haar.jpg “Sample screenshot” width=321 height=254

Cascade classifier class for object detection.

Implementations§

Source§

impl CascadeClassifier

Source

pub fn default() -> Result<CascadeClassifier>

Source

pub fn new(filename: &str) -> Result<CascadeClassifier>

Loads a classifier from a file.

§Parameters
  • filename: Name of the file from which the classifier is loaded.
Source

pub fn convert(oldcascade: &str, newcascade: &str) -> Result<bool>

Trait Implementations§

Source§

impl Boxed for CascadeClassifier

Source§

unsafe fn from_raw( ptr: <CascadeClassifier as OpenCVFromExtern>::ExternReceive, ) -> Self

Wrap the specified raw pointer Read more
Source§

fn into_raw( self, ) -> <CascadeClassifier as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
Source§

fn as_raw(&self) -> <CascadeClassifier as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
Source§

fn as_raw_mut( &mut self, ) -> <CascadeClassifier as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
Source§

impl CascadeClassifierTrait for CascadeClassifier

Source§

fn as_raw_mut_CascadeClassifier(&mut self) -> *mut c_void

Source§

fn cc(&mut self) -> Ptr<BaseCascadeClassifier>

Source§

fn set_cc(&mut self, val: Ptr<BaseCascadeClassifier>)

Source§

fn load(&mut self, filename: &str) -> Result<bool>

Loads a classifier from a file. Read more
Source§

fn read(&mut self, node: &impl FileNodeTraitConst) -> Result<bool>

Reads a classifier from a FileStorage node. Read more
Source§

fn detect_multi_scale( &mut self, image: &impl ToInputArray, objects: &mut Vector<Rect>, scale_factor: f64, min_neighbors: i32, flags: i32, min_size: Size, max_size: Size, ) -> Result<()>

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Read more
Source§

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

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Read more
Source§

fn detect_multi_scale2( &mut self, image: &impl ToInputArray, objects: &mut Vector<Rect>, num_detections: &mut Vector<i32>, scale_factor: f64, min_neighbors: i32, flags: i32, min_size: Size, max_size: Size, ) -> Result<()>

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Read more
Source§

fn detect_multi_scale2_def( &mut self, image: &impl ToInputArray, objects: &mut Vector<Rect>, num_detections: &mut Vector<i32>, ) -> Result<()>

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Read more
Source§

fn detect_multi_scale3( &mut self, image: &impl ToInputArray, objects: &mut Vector<Rect>, reject_levels: &mut Vector<i32>, level_weights: &mut Vector<f64>, scale_factor: f64, min_neighbors: i32, flags: i32, min_size: Size, max_size: Size, output_reject_levels: bool, ) -> Result<()>

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Read more
Source§

fn detect_multi_scale3_def( &mut self, image: &impl ToInputArray, objects: &mut Vector<Rect>, reject_levels: &mut Vector<i32>, level_weights: &mut Vector<f64>, ) -> Result<()>

Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles. Read more
Source§

fn get_old_cascade(&mut self) -> Result<*mut c_void>

Source§

fn set_mask_generator( &mut self, mask_generator: &Ptr<BaseCascadeClassifier_MaskGenerator>, ) -> Result<()>

Source§

fn get_mask_generator( &mut self, ) -> Result<Ptr<BaseCascadeClassifier_MaskGenerator>>

Source§

impl CascadeClassifierTraitConst for CascadeClassifier

Source§

fn as_raw_CascadeClassifier(&self) -> *const c_void

Source§

fn empty(&self) -> Result<bool>

Checks whether the classifier has been loaded.
Source§

fn is_old_format_cascade(&self) -> Result<bool>

Source§

fn get_original_window_size(&self) -> Result<Size>

Source§

fn get_feature_type(&self) -> Result<i32>

Source§

impl Debug for CascadeClassifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CascadeClassifier

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for CascadeClassifier

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Mat> ModifyInplace for Mat
where Mat: Boxed,

Source§

unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res, ) -> Res

Helper function to call OpenCV functions that allow in-place modification of a Mat or another similar object. By passing a mutable reference to the Mat to this function your closure will get called with the read reference and a write references to the same Mat. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data, but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.