OpenCV  4.6.0
Open Source Computer Vision
Classes | Enumerations | Functions
Improved Background-Foreground Segmentation Methods

Classes

class  cv::bgsegm::BackgroundSubtractorCNT
 Background subtraction based on counting. More...
 
class  cv::bgsegm::BackgroundSubtractorGMG
 Background Subtractor module based on the algorithm given in [94] . More...
 
class  cv::bgsegm::BackgroundSubtractorGSOC
 Implementation of the different yet better algorithm which is called GSOC, as it was implemented during GSOC and was not originated from any paper. More...
 
class  cv::bgsegm::BackgroundSubtractorLSBP
 Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at [103]. More...
 
class  cv::bgsegm::BackgroundSubtractorLSBPDesc
 This is for calculation of the LSBP descriptors. More...
 
class  cv::bgsegm::BackgroundSubtractorMOG
 Gaussian Mixture-based Background/Foreground Segmentation Algorithm. More...
 
class  cv::bgsegm::SyntheticSequenceGenerator
 Synthetic frame sequence generator for testing background subtraction algorithms. More...
 

Enumerations

enum  cv::bgsegm::LSBPCameraMotionCompensation {
  cv::bgsegm::LSBP_CAMERA_MOTION_COMPENSATION_NONE = 0,
  cv::bgsegm::LSBP_CAMERA_MOTION_COMPENSATION_LK
}
 

Functions

Ptr< BackgroundSubtractorCNTcv::bgsegm::createBackgroundSubtractorCNT (int minPixelStability=15, bool useHistory=true, int maxPixelStability=15 *60, bool isParallel=true)
 Creates a CNT Background Subtractor. More...
 
Ptr< BackgroundSubtractorGMGcv::bgsegm::createBackgroundSubtractorGMG (int initializationFrames=120, double decisionThreshold=0.8)
 Creates a GMG Background Subtractor. More...
 
Ptr< BackgroundSubtractorGSOCcv::bgsegm::createBackgroundSubtractorGSOC (int mc=LSBP_CAMERA_MOTION_COMPENSATION_NONE, int nSamples=20, float replaceRate=0.003f, float propagationRate=0.01f, int hitsThreshold=32, float alpha=0.01f, float beta=0.0022f, float blinkingSupressionDecay=0.1f, float blinkingSupressionMultiplier=0.1f, float noiseRemovalThresholdFacBG=0.0004f, float noiseRemovalThresholdFacFG=0.0008f)
 Creates an instance of BackgroundSubtractorGSOC algorithm. More...
 
Ptr< BackgroundSubtractorLSBPcv::bgsegm::createBackgroundSubtractorLSBP (int mc=LSBP_CAMERA_MOTION_COMPENSATION_NONE, int nSamples=20, int LSBPRadius=16, float Tlower=2.0f, float Tupper=32.0f, float Tinc=1.0f, float Tdec=0.05f, float Rscale=10.0f, float Rincdec=0.005f, float noiseRemovalThresholdFacBG=0.0004f, float noiseRemovalThresholdFacFG=0.0008f, int LSBPthreshold=8, int minCount=2)
 Creates an instance of BackgroundSubtractorLSBP algorithm. More...
 
Ptr< BackgroundSubtractorMOGcv::bgsegm::createBackgroundSubtractorMOG (int history=200, int nmixtures=5, double backgroundRatio=0.7, double noiseSigma=0)
 Creates mixture-of-gaussian background subtractor. More...
 
Ptr< SyntheticSequenceGeneratorcv::bgsegm::createSyntheticSequenceGenerator (InputArray background, InputArray object, double amplitude=2.0, double wavelength=20.0, double wavespeed=0.2, double objspeed=6.0)
 Creates an instance of SyntheticSequenceGenerator. More...
 

Detailed Description

Enumeration Type Documentation

◆ LSBPCameraMotionCompensation

#include <opencv2/bgsegm.hpp>

Enumerator
LSBP_CAMERA_MOTION_COMPENSATION_NONE 
Python: cv.bgsegm.LSBP_CAMERA_MOTION_COMPENSATION_NONE
LSBP_CAMERA_MOTION_COMPENSATION_LK 
Python: cv.bgsegm.LSBP_CAMERA_MOTION_COMPENSATION_LK

Function Documentation

◆ createBackgroundSubtractorCNT()

Ptr<BackgroundSubtractorCNT> cv::bgsegm::createBackgroundSubtractorCNT ( int  minPixelStability = 15,
bool  useHistory = true,
int  maxPixelStability = 15 *60,
bool  isParallel = true 
)
Python:
cv.bgsegm.createBackgroundSubtractorCNT([, minPixelStability[, useHistory[, maxPixelStability[, isParallel]]]]) -> retval

#include <opencv2/bgsegm.hpp>

Creates a CNT Background Subtractor.

Parameters
minPixelStabilitynumber of frames with same pixel color to consider stable
useHistorydetermines if we're giving a pixel credit for being stable for a long time
maxPixelStabilitymaximum allowed credit for a pixel in history
isParalleldetermines if we're parallelizing the algorithm

◆ createBackgroundSubtractorGMG()

Ptr<BackgroundSubtractorGMG> cv::bgsegm::createBackgroundSubtractorGMG ( int  initializationFrames = 120,
double  decisionThreshold = 0.8 
)
Python:
cv.bgsegm.createBackgroundSubtractorGMG([, initializationFrames[, decisionThreshold]]) -> retval

#include <opencv2/bgsegm.hpp>

Creates a GMG Background Subtractor.

Parameters
initializationFramesnumber of frames used to initialize the background models.
decisionThresholdThreshold value, above which it is marked foreground, else background.

◆ createBackgroundSubtractorGSOC()

Ptr<BackgroundSubtractorGSOC> cv::bgsegm::createBackgroundSubtractorGSOC ( int  mc = LSBP_CAMERA_MOTION_COMPENSATION_NONE,
int  nSamples = 20,
float  replaceRate = 0.003f,
float  propagationRate = 0.01f,
int  hitsThreshold = 32,
float  alpha = 0.01f,
float  beta = 0.0022f,
float  blinkingSupressionDecay = 0.1f,
float  blinkingSupressionMultiplier = 0.1f,
float  noiseRemovalThresholdFacBG = 0.0004f,
float  noiseRemovalThresholdFacFG = 0.0008f 
)
Python:
cv.bgsegm.createBackgroundSubtractorGSOC([, mc[, nSamples[, replaceRate[, propagationRate[, hitsThreshold[, alpha[, beta[, blinkingSupressionDecay[, blinkingSupressionMultiplier[, noiseRemovalThresholdFacBG[, noiseRemovalThresholdFacFG]]]]]]]]]]]) -> retval

#include <opencv2/bgsegm.hpp>

Creates an instance of BackgroundSubtractorGSOC algorithm.

Implementation of the different yet better algorithm which is called GSOC, as it was implemented during GSOC and was not originated from any paper.

Parameters
mcWhether to use camera motion compensation.
nSamplesNumber of samples to maintain at each point of the frame.
replaceRateProbability of replacing the old sample - how fast the model will update itself.
propagationRateProbability of propagating to neighbors.
hitsThresholdHow many positives the sample must get before it will be considered as a possible replacement.
alphaScale coefficient for threshold.
betaBias coefficient for threshold.
blinkingSupressionDecayBlinking supression decay factor.
blinkingSupressionMultiplierBlinking supression multiplier.
noiseRemovalThresholdFacBGStrength of the noise removal for background points.
noiseRemovalThresholdFacFGStrength of the noise removal for foreground points.

◆ createBackgroundSubtractorLSBP()

Ptr<BackgroundSubtractorLSBP> cv::bgsegm::createBackgroundSubtractorLSBP ( int  mc = LSBP_CAMERA_MOTION_COMPENSATION_NONE,
int  nSamples = 20,
int  LSBPRadius = 16,
float  Tlower = 2.0f,
float  Tupper = 32.0f,
float  Tinc = 1.0f,
float  Tdec = 0.05f,
float  Rscale = 10.0f,
float  Rincdec = 0.005f,
float  noiseRemovalThresholdFacBG = 0.0004f,
float  noiseRemovalThresholdFacFG = 0.0008f,
int  LSBPthreshold = 8,
int  minCount = 2 
)
Python:
cv.bgsegm.createBackgroundSubtractorLSBP([, mc[, nSamples[, LSBPRadius[, Tlower[, Tupper[, Tinc[, Tdec[, Rscale[, Rincdec[, noiseRemovalThresholdFacBG[, noiseRemovalThresholdFacFG[, LSBPthreshold[, minCount]]]]]]]]]]]]]) -> retval

#include <opencv2/bgsegm.hpp>

Creates an instance of BackgroundSubtractorLSBP algorithm.

Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at [103]

Parameters
mcWhether to use camera motion compensation.
nSamplesNumber of samples to maintain at each point of the frame.
LSBPRadiusLSBP descriptor radius.
TlowerLower bound for T-values. See [103] for details.
TupperUpper bound for T-values. See [103] for details.
TincIncrease step for T-values. See [103] for details.
TdecDecrease step for T-values. See [103] for details.
RscaleScale coefficient for threshold values.
RincdecIncrease/Decrease step for threshold values.
noiseRemovalThresholdFacBGStrength of the noise removal for background points.
noiseRemovalThresholdFacFGStrength of the noise removal for foreground points.
LSBPthresholdThreshold for LSBP binary string.
minCountMinimal number of matches for sample to be considered as foreground.

◆ createBackgroundSubtractorMOG()

Ptr<BackgroundSubtractorMOG> cv::bgsegm::createBackgroundSubtractorMOG ( int  history = 200,
int  nmixtures = 5,
double  backgroundRatio = 0.7,
double  noiseSigma = 0 
)
Python:
cv.bgsegm.createBackgroundSubtractorMOG([, history[, nmixtures[, backgroundRatio[, noiseSigma]]]]) -> retval

#include <opencv2/bgsegm.hpp>

Creates mixture-of-gaussian background subtractor.

Parameters
historyLength of the history.
nmixturesNumber of Gaussian mixtures.
backgroundRatioBackground ratio.
noiseSigmaNoise strength (standard deviation of the brightness or each color channel). 0 means some automatic value.

◆ createSyntheticSequenceGenerator()

Ptr<SyntheticSequenceGenerator> cv::bgsegm::createSyntheticSequenceGenerator ( InputArray  background,
InputArray  object,
double  amplitude = 2.0,
double  wavelength = 20.0,
double  wavespeed = 0.2,
double  objspeed = 6.0 
)
Python:
cv.bgsegm.createSyntheticSequenceGenerator(background, object[, amplitude[, wavelength[, wavespeed[, objspeed]]]]) -> retval

#include <opencv2/bgsegm.hpp>

Creates an instance of SyntheticSequenceGenerator.

Parameters
backgroundBackground image for object.
objectObject image which will move slowly over the background.
amplitudeAmplitude of wave distortion applied to background.
wavelengthLength of waves in distortion applied to background.
wavespeedHow fast waves will move.
objspeedHow fast object will fly over background.