[][src]Trait opencv::hub_prelude::BackgroundSubtractorMOG2

pub trait BackgroundSubtractorMOG2: BackgroundSubtractor {
    pub fn as_raw_BackgroundSubtractorMOG2(&self) -> *const c_void;
pub fn as_raw_mut_BackgroundSubtractorMOG2(&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_mixtures(&self) -> Result<i32> { ... }
pub fn set_n_mixtures(&mut self, nmixtures: i32) -> Result<()> { ... }
pub fn get_background_ratio(&self) -> Result<f64> { ... }
pub fn set_background_ratio(&mut self, ratio: f64) -> Result<()> { ... }
pub fn get_var_threshold(&self) -> Result<f64> { ... }
pub fn set_var_threshold(&mut self, var_threshold: f64) -> Result<()> { ... }
pub fn get_var_threshold_gen(&self) -> Result<f64> { ... }
pub fn set_var_threshold_gen(
        &mut self,
        var_threshold_gen: f64
    ) -> Result<()> { ... }
pub fn get_var_init(&self) -> Result<f64> { ... }
pub fn set_var_init(&mut self, var_init: f64) -> Result<()> { ... }
pub fn get_var_min(&self) -> Result<f64> { ... }
pub fn set_var_min(&mut self, var_min: f64) -> Result<()> { ... }
pub fn get_var_max(&self) -> Result<f64> { ... }
pub fn set_var_max(&mut self, var_max: f64) -> Result<()> { ... }
pub fn get_complexity_reduction_threshold(&self) -> Result<f64> { ... }
pub fn set_complexity_reduction_threshold(&mut self, ct: f64) -> 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<()> { ... }
pub fn apply(
        &mut self,
        image: &dyn ToInputArray,
        fgmask: &mut dyn ToOutputArray,
        learning_rate: f64
    ) -> Result<()> { ... } }

Gaussian Mixture-based Background/Foreground Segmentation Algorithm.

The class implements the Gaussian mixture model background subtraction described in Zivkovic2004 and Zivkovic2006 .

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_mixtures(&self) -> Result<i32>[src]

Returns the number of gaussian components in the background model

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

Sets the number of gaussian components in the background model.

The model needs to be reinitalized to reserve memory.

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

Returns the "background ratio" parameter of the algorithm

If a foreground pixel keeps semi-constant value for about backgroundRatio*history frames, it's considered background and added to the model as a center of a new component. It corresponds to TB parameter in the paper.

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

Sets the "background ratio" parameter of the algorithm

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

Returns the variance threshold for the pixel-model match

The main threshold on the squared Mahalanobis distance to decide if the sample is well described by the background model or not. Related to Cthr from the paper.

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

Sets the variance threshold for the pixel-model match

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

Returns the variance threshold for the pixel-model match used for new mixture component generation

Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it is considered foreground or added as a new component. 3 sigma => Tg=3*3=9 is default. A smaller Tg value generates more components. A higher Tg value may result in a small number of components but they can grow too large.

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

Sets the variance threshold for the pixel-model match used for new mixture component generation

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

Returns the initial variance of each gaussian component

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

Sets the initial variance of each gaussian component

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

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

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

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

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

Returns the complexity reduction threshold

This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05 is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the standard Stauffer&Grimson algorithm.

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

Sets the complexity reduction threshold

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

Returns the shadow detection flag

If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 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

pub fn apply(
    &mut self,
    image: &dyn ToInputArray,
    fgmask: &mut dyn ToOutputArray,
    learning_rate: f64
) -> Result<()>
[src]

Computes a foreground mask.

Parameters

  • image: Next video frame. Floating point frame will be used without scaling and should be in range inline formula.
  • fgmask: The output foreground mask as an 8-bit binary image.
  • learningRate: The value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.

C++ default parameters

  • learning_rate: -1
Loading content...

Implementors

Loading content...