Background subtraction with or without opencv for installations

Hi all,
i am fiddling around with opencv provided background subtractors (MOG, MOG2 and GMG) to find a suitable one for tracking people. I want to use it in closed spaces with variable lighting.

I am not sure about what values to set in any of the given subtractors to slow down the transition of a stationary tracked object (say a person who stands still for a while) into part of the background.

It now takes about 4 seconds between a tracked person stops moving, until the algorithm assumes that he is part of the background and stops considering them as part of the foreground.

Do you know in which way I can prolong this time (in any of the 3 subtractors). I am fiddling with decisionThreshold, and learningRate as my 2 dynamic parameters.

thank you.

there should be a history parameter

Here is the documentation, where the “history” is a construction argument to the class.

I recommend the GPU version of MOG2 which is quite fast.

Hi @bbogart , yes I am oin the process of switching to gpu for these intensive operations.
I installed cuda on ubuntu 14.04, and recompiled opencv static libs so as to replace the ones that come bundled with OF.

Do you know of any tutorial about what to use the gpu background subtractors?


I don’t know of a tutorial; I just used the example that comes with opencv as a basis: samples/gpu/bgfg_segm.cpp


Does anyone had implemented and teste this MOG2 method with kinect to detect blobs?
Is there an exemple?