pub trait BackgroundSubtractorMOG2Trait: BackgroundSubtractorMOG2TraitConst + BackgroundSubtractorTrait {
Show 15 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: &impl ToInputArray,
fgmask: &mut impl ToOutputArray,
learning_rate: f64,
) -> Result<()> { ... }
fn apply_def(
&mut self,
image: &impl ToInputArray,
fgmask: &mut impl ToOutputArray,
) -> Result<()> { ... }
}
Expand description
Mutable methods for crate::video::BackgroundSubtractorMOG2
Required Methods§
fn as_raw_mut_BackgroundSubtractorMOG2(&mut self) -> *mut c_void
Provided Methods§
Sourcefn set_history(&mut self, history: i32) -> Result<()>
fn set_history(&mut self, history: i32) -> Result<()>
Sets the number of last frames that affect the background model
Sourcefn set_n_mixtures(&mut self, nmixtures: i32) -> Result<()>
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.
Sourcefn set_background_ratio(&mut self, ratio: f64) -> Result<()>
fn set_background_ratio(&mut self, ratio: f64) -> Result<()>
Sets the “background ratio” parameter of the algorithm
Sourcefn set_var_threshold(&mut self, var_threshold: f64) -> Result<()>
fn set_var_threshold(&mut self, var_threshold: f64) -> Result<()>
Sets the variance threshold for the pixel-model match
Sourcefn set_var_threshold_gen(&mut self, var_threshold_gen: f64) -> Result<()>
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
Sourcefn set_var_init(&mut self, var_init: f64) -> Result<()>
fn set_var_init(&mut self, var_init: f64) -> Result<()>
Sets the initial variance of each gaussian component
fn set_var_min(&mut self, var_min: f64) -> Result<()>
fn set_var_max(&mut self, var_max: f64) -> Result<()>
Sourcefn set_complexity_reduction_threshold(&mut self, ct: f64) -> Result<()>
fn set_complexity_reduction_threshold(&mut self, ct: f64) -> Result<()>
Sets the complexity reduction threshold
Sourcefn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()>
fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()>
Enables or disables shadow detection
Sourcefn set_shadow_value(&mut self, value: i32) -> Result<()>
fn set_shadow_value(&mut self, value: i32) -> Result<()>
Sets the shadow value
Sourcefn set_shadow_threshold(&mut self, threshold: f64) -> Result<()>
fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()>
Sets the shadow threshold
Sourcefn apply(
&mut self,
image: &impl ToInputArray,
fgmask: &mut impl ToOutputArray,
learning_rate: f64,
) -> Result<()>
fn apply( &mut self, image: &impl ToInputArray, fgmask: &mut impl 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
.
- 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
Sourcefn apply_def(
&mut self,
image: &impl ToInputArray,
fgmask: &mut impl ToOutputArray,
) -> Result<()>
fn apply_def( &mut self, image: &impl ToInputArray, fgmask: &mut impl ToOutputArray, ) -> Result<()>
Computes a foreground mask.
§Parameters
- image: Next video frame. Floating point frame will be used without scaling and should be in range
.
- 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.
§Note
This alternative version of BackgroundSubtractorMOG2Trait::apply function uses the following default values for its arguments:
- learning_rate: -1
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.