[][src]Trait opencv::video::prelude::BackgroundSubtractorKNN

pub trait BackgroundSubtractorKNN: BackgroundSubtractor {
    pub fn as_raw_BackgroundSubtractorKNN(&self) -> *const c_void;
pub fn as_raw_mut_BackgroundSubtractorKNN(&mut self) -> *mut c_void; pub fn get_history(&self) -> Result<i32> { ... }
pub fn set_history(&mut self, history: i32) -> Result<()> { ... }
pub fn get_n_samples(&self) -> Result<i32> { ... }
pub fn set_n_samples(&mut self, _n_n: i32) -> Result<()> { ... }
pub fn get_dist2_threshold(&self) -> Result<f64> { ... }
pub fn set_dist2_threshold(&mut self, _dist2_threshold: f64) -> Result<()> { ... }
pub fn getk_nn_samples(&self) -> Result<i32> { ... }
pub fn setk_nn_samples(&mut self, _nk_nn: i32) -> Result<()> { ... }
pub fn get_detect_shadows(&self) -> Result<bool> { ... }
pub fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()> { ... }
pub fn get_shadow_value(&self) -> Result<i32> { ... }
pub fn set_shadow_value(&mut self, value: i32) -> Result<()> { ... }
pub fn get_shadow_threshold(&self) -> Result<f64> { ... }
pub fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()> { ... } }

K-nearest neighbours - based Background/Foreground Segmentation Algorithm.

The class implements the K-nearest neighbours background subtraction described in Zivkovic2006 . Very efficient if number of foreground pixels is low.

Required methods

Loading content...

Provided methods

pub fn get_history(&self) -> Result<i32>[src]

Returns the number of last frames that affect the background model

pub fn set_history(&mut self, history: i32) -> Result<()>[src]

Sets the number of last frames that affect the background model

pub fn get_n_samples(&self) -> Result<i32>[src]

Returns the number of data samples in the background model

pub fn set_n_samples(&mut self, _n_n: i32) -> Result<()>[src]

Sets the number of data samples in the background model.

The model needs to be reinitalized to reserve memory.

pub fn get_dist2_threshold(&self) -> Result<f64>[src]

Returns the threshold on the squared distance between the pixel and the sample

The threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to a data sample.

pub fn set_dist2_threshold(&mut self, _dist2_threshold: f64) -> Result<()>[src]

Sets the threshold on the squared distance

pub fn getk_nn_samples(&self) -> Result<i32>[src]

Returns the number of neighbours, the k in the kNN.

K is the number of samples that need to be within dist2Threshold in order to decide that that pixel is matching the kNN background model.

pub fn setk_nn_samples(&mut self, _nk_nn: i32) -> Result<()>[src]

Sets the k in the kNN. How many nearest neighbours need to match.

pub fn get_detect_shadows(&self) -> Result<bool>[src]

Returns the shadow detection flag

If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for details.

pub fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()>[src]

Enables or disables shadow detection

pub fn get_shadow_value(&self) -> Result<i32>[src]

Returns the shadow value

Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0 in the mask always means background, 255 means foreground.

pub fn set_shadow_value(&mut self, value: i32) -> Result<()>[src]

Sets the shadow value

pub fn get_shadow_threshold(&self) -> Result<f64>[src]

Returns the shadow threshold

A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, Detecting Moving Shadows..., IEEE PAMI,2003.

pub fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()>[src]

Sets the shadow threshold

Loading content...

Implementors

Loading content...