I am studying the GMG background subtraction algorithm as described in this paper. As OpenCV 3.0 also has an implementation of the GMG algorithm (as the additional package opencv_contrib), I try to study the two together. However, I am not quite sure about the meaning of the two parameters maxFeatures
and quantizationLevels
, as I want to map them to the descriptions in the paper.
Quoting the source code in OpenCV 3.0 (file modules\bgsegm\src\bgfg_gmg.cpp):
//! Total number of distinct colors to maintain in histogram.
int maxFeatures;
and
//! Number of discrete levels in each channel to be used in histograms.
int quantizationLevels;
And quoting the paper (Section II B) (with some mathematical symbol and variable names modified since LaTex is not supported here):
"... Of the T observed features, select the F_tot <= F_max most recently observed unique features; let I is a subset of {1, 2, ... T}, where |I| = F_tot, be the corresponding time index set. (If T > F_max, it is possible that F_tot, the number of distinct features observed, exceeds the limit F_max. In that case, we throw away the oldest observations so that F_tot <= F_max). Then, we calculate an average to generate the initial histogram: H(T) = (1/F_tot)∑f(r). This puts equal weight, 1/F_tot, in F_tot unique bins of the histogram."
From the above description, I was originally convinced that maxFeatures
in OpenCV 3.0 refers to F_max in the paper, and quantizationLevels
refers to F_tot. However, this does not sound right for two reasons: (1) The paper mentions "F_tot is the number of distinct features observed", and (2) the OpenCV source code does not pose any relationship between maxFeatures
and quantizationLevels
, while the paper clearly suggests that the former should be larger than or equal to the latter.
So, what are the meaning of maxFeatures
and quantizationLevels
? And is quantizationLevels
a parameter introduced by OpenCV for the calculation of histogram?