pub trait BackgroundSubtractorMOG2: BackgroundSubtractor + BackgroundSubtractorMOG2Const {
Show 14 methods // Required method fn as_raw_mut_BackgroundSubtractorMOG2(&mut self) -> *mut c_void; // Provided methods 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<()> { ... }
}
Expand description

Gaussian Mixture-based Background/Foreground Segmentation Algorithm.

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

Required Methods§

Provided Methods§

source

fn set_history(&mut self, history: i32) -> Result<()>

Sets the number of last frames that affect the background model

source

fn set_n_mixtures(&mut self, nmixtures: i32) -> Result<()>

Sets the number of gaussian components in the background model.

The model needs to be reinitalized to reserve memory.

source

fn set_background_ratio(&mut self, ratio: f64) -> Result<()>

Sets the “background ratio” parameter of the algorithm

source

fn set_var_threshold(&mut self, var_threshold: f64) -> Result<()>

Sets the variance threshold for the pixel-model match

source

fn set_var_threshold_gen(&mut self, var_threshold_gen: f64) -> Result<()>

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

source

fn set_var_init(&mut self, var_init: f64) -> Result<()>

Sets the initial variance of each gaussian component

source

fn set_var_min(&mut self, var_min: f64) -> Result<()>

source

fn set_var_max(&mut self, var_max: f64) -> Result<()>

source

fn set_complexity_reduction_threshold(&mut self, ct: f64) -> Result<()>

Sets the complexity reduction threshold

source

fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()>

Enables or disables shadow detection

source

fn set_shadow_value(&mut self, value: i32) -> Result<()>

Sets the shadow value

source

fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()>

Sets the shadow threshold

source

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

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§