Ask Your Question

Has createBackgroundSubtractorMOG been removed?

asked 2015-09-25 02:01:35 -0500

RVQ gravatar image

updated 2015-09-25 03:31:28 -0500


I did the openCV Background Subtraction tutorial, which is described here.

First the complete source code is listed, in which createBackgroundSubtractorMOG is not used. But in the Explanation part it is described.

That's obviously an error, but it didn`t take me long to figure it out. Hower now I want to use createBackgroundSubtractorMOG instead of createBackgroundSubtractorMOG2, but it seems that this method has been complitly removed.

Does somybody know if this is true and if it is, why the method has been removed?

PS: I am using opencv 3.0.0

Thanks and Greets



I had some errors building opencv_contrib. However I just wanted to try BackgroundSubtractorMOG. So I just copied the .cpp and header files in my Project and builded it again, which worked fine.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-09-25 02:06:32 -0500

berak gravatar image

updated 2015-09-25 02:06:59 -0500

BackgroundSubtractorMOG was moved to contrib

please see readme there, on how to add it to your opencv libs, rebuild, and then:

  #include "opencv2/bgsegm.hpp"

  Ptr<bgsegm::BackgroundSubtractorMOG> mog = bgsegm::createBackgroundSubtractorMOG();
edit flag offensive delete link more


Thank you!

RVQ gravatar imageRVQ ( 2015-09-25 02:30:07 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-09-25 02:00:39 -0500

Seen: 1,526 times

Last updated: Sep 25 '15