Question

I have Problem understanding all Parameter of backgroundsubtractormog2.

I looked in the code (located in bfgf_gaussmix2.cpp), but don't see the connection to the mentioned paper. For exmaple is Tb = varThreshold, but what is the name of Tb in the paper?

I am especially interested in the fat marked parameter.

Let's start with the easy parameter [my remarks]:

  • int nmixtures

    Maximum allowed number of mixture components. Actual number is determined dynamically per pixel. [set 0 for GMG]

  • uchar nShadowDetection

    The value for marking shadow pixels in the output foreground mask. Default value is 127.

  • float fTau

    Shadow threshold. The shadow is detected if the pixel is a darker version of the background. Tau 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.

Now to the ones i don't understand:

  • float backgroundRatio

    Threshold defining whether the component is significant enough to be included into the background model ( corresponds to TB=1-cf from the paper??which paper??). cf=0.1 => TB=0.9 is default. For alpha=0.001, it means that the mode should exist for approximately 105 frames before it is considered foreground.

  • float varThresholdGen

    Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to Tg). If it is not close to any component, a new component is generated. 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. [i don't understand a word of this]

  • In the Constructor the variable varThreshold is used. Is it the same as varThresholdGen?

    Threshold on the squared Mahalanobis distance to decide whether it is well described by the background model (see Cthr??). This parameter does not affect the background update. A typical value could be 4 sigma, that is, varThreshold=4*4=16; (see Tb??).

  • float fVarInit

    Initial variance for the newly generated components. It affects the speed of adaptation. The parameter value is based on your estimate of the typical standard deviation from the images. OpenCV uses 15 as a reasonable value.

  • float fVarMin

    Parameter used to further control the variance.

  • float fVarMax

    Parameter used to further control the variance.

  • float fCT

    Complexity reduction parameter. 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.

Someone asked pretty much the same question on the OpenCV website, but without an answer.

Was it helpful?

Solution

Well, I don't think anyone could tell you which parameter is what if you don't know the details of the algorithm that you are using. Besides, you should not need anyone to tell you which parameter is what if you know the details of the algorithm. I'm telling this for detailed parameters (fCT, fVarMax, etc.) not for straightforward ones (nmixtures, nShadowDetection, etc.).

So, I think you should read the papers referenced in the documentation. Here are the links for the papers 1, 2, 3.

And also you should read this paper as well, which is the beginning of background estimation.

After reading these papers and checking out the code with, I'm sure you will understand what those parameters are.

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top