Ask Your Question

BackgroundSubtractorMOG 1 with OpenCV 3?

asked 2015-11-06 08:59:32 -0600

joanmanel gravatar image

So I have some code using BackgroundSubtractorMOG with opencv 2.10, it works OK.

I ported this code to OpenCV3, and the only change I needed to perform was to use BackgroundSubtractorMOG2 instead of the first one. The code runs OK, but the results are slightly different. I collected a lot of data with the first version, so now continuing the experiments with the second version is creating some consistency problems. The results are very similar, but not the same.

Long story short, I need to use the first version of MOG with OpenCV3, but I don't know how to do it (I don't know the name, or if it is even implemented). Otherwise I will need to rollback to OpenCV2, but I'd like to keep working with OpenCV.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-06 09:02:33 -0600

berak gravatar image

updated 2015-11-06 09:03:28 -0600

BackgroundSubtractorMOG was moved to the (seperate) opencv_contrib repo , in the bgsegm module.

edit flag offensive delete link more


Sorry for the question, but how can I use that module? I just copied the cv2 from the installation folder to my python path, and it doesn't seem to be loaded (bgsegm)

joanmanel gravatar imagejoanmanel ( 2015-11-06 09:55:10 -0600 )edit

oh, python. how did you install that ?

basically, it means, you have to build from src, download the contrib repo, add it to the main opencv one (see readme) , then re-run cmake, make, make install.

berak gravatar imageberak ( 2015-11-06 09:58:46 -0600 )edit

I didn't install "OpenCV" (I am running Windows and Python2). I downloaded the zip file with OpenCV3, and then I copied the file called cv2.pyd into the python folder. Basically the first guide here:

By what you said, and the tests I am running, it seems that didn't include the new module I need, am I right?

joanmanel gravatar imagejoanmanel ( 2015-11-06 10:08:44 -0600 )edit

yea, damn. the prebuilt win things do not come with any of the contrib modules.

berak gravatar imageberak ( 2015-11-06 10:18:31 -0600 )edit

Question Tools

1 follower


Asked: 2015-11-06 08:59:32 -0600

Seen: 669 times

Last updated: Nov 06 '15