pub trait BackgroundSubtractorMOG2: BackgroundSubtractor + BackgroundSubtractorMOG2Const {
Show 14 methods fn as_raw_mut_BackgroundSubtractorMOG2(&mut self) -> *mut c_void; fn set_history(&mut self, history: i32) -> Result<()> { ... } fn set_n_mixtures(&mut self, nmixtures: i32) -> Result<()> { ... } fn set_background_ratio(&mut self, ratio: f64) -> Result<()> { ... } fn set_var_threshold(&mut self, var_threshold: f64) -> Result<()> { ... } fn set_var_threshold_gen(&mut self, var_threshold_gen: f64) -> Result<()> { ... } fn set_var_init(&mut self, var_init: f64) -> Result<()> { ... } fn set_var_min(&mut self, var_min: f64) -> Result<()> { ... } fn set_var_max(&mut self, var_max: f64) -> Result<()> { ... } fn set_complexity_reduction_threshold(&mut self, ct: f64) -> Result<()> { ... } fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()> { ... } fn set_shadow_value(&mut self, value: i32) -> Result<()> { ... } fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()> { ... } fn apply(
        &mut self,
        image: &dyn ToInputArray,
        fgmask: &mut dyn ToOutputArray,
        learning_rate: f64
    ) -> Result<()> { ... }
}

Required Methods

Provided Methods

Sets the number of last frames that affect the background model

Sets the number of gaussian components in the background model.

The model needs to be reinitalized to reserve memory.

Sets the “background ratio” parameter of the algorithm

Sets the variance threshold for the pixel-model match

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

Sets the initial variance of each gaussian component

Sets the complexity reduction threshold

Enables or disables shadow detection

Sets the shadow value

Sets the shadow threshold

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

Implementors