Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

What is the history parameter in BackgroundSubtractorMOG2?

$
0
0
I'm on OpenCV for java. I have read and understood the Zivkovic paper about the algorithm. I can't seem to understand what the `history` param in the `BackgroundSubtractorMOG2` constructor is about. From here, https://github.com/Itseez/opencv/blob/master/modules/video/src/bgfg_gaussmix2.cpp , line 106, it is said that `alpha = 1/ history`. That would mean that `history` is namely the T parameter inside the paper, i.e. (more or less) the number of frames that constitute the training set. However it doesn't seem so. Changing the value in the constructor, from 10 to 500 or beyond, has no effect on the final result. Mat result = new Mat(); int history = 10; //or 50, or 500, or whatever BackgroundSubtractorMOG2 sub = new BackgroundSubtractorMOG2(history, 16, false); for (....) { sub.apply(frame[i], result); } //here result is the same no matter what "history" I have set Where as, I can change the `alpha` value in the `apply()` call, and that is *really* effective: Mat result = new Mat(); float alpha = 0.1; BackgroundSubtractorMOG2 sub = new BackgroundSubtractorMOG2(whatever, 16, false); for (....) { sub.apply(frame[i], result, alpha); } //if I change alpha here, result changes a lot, which is understandable. So, either `history` **is not** equal to 1/alpha (or there's a bug in the java wrapper which make `history` useless). But then, what is it?

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>