[Solved] Background MOG Substractor unreferenced - OpenCV 3.1.0

asked 2016-02-29 05:01:05 -0500

ClementD gravatar image

updated 2016-03-02 07:14:44 -0500

Hi ,

I am here because i do not come up to use a MOG background substractor with OpendCV 3.1.0

I don't know if it is an include probleme or anything else.

I followed this official tutorial :http://docs.opencv.org/3.1.0/d1/dc5/tutorial_background_subtraction.html#gsc.tab=0

But when i try to create a MOG background substractor like this:

Ptr<BackgroundSubtractor> pMOG; //MOG Background subtractor
Ptr<BackgroundSubtractor> pMOG2; //MOG2 Background subtractor
...
//create Background Subtractor objects
pMOG = createBackgroundSubtractorMOG(); //MOG approach
pMOG2 = createBackgroundSubtractorMOG2(); //MOG2 approach

i get the error: cv has no member named "createBackgroundSubtractorMOG"

Can someone help me?

Edit: I write my own code, i can use the MOG2 but i can't find the simple MOG background substractor.

Solution: Thanks to berak: MOG was moved to opencv_contrib

Importing Contrib to OpenCV: Thanks to the Readme.md in github, i saw that the best way to improt contrib is to rebuild openCV using special option on CMake.

As a temporrary solution i copied the files in an external folder and i included them in my project.

As berak pointed out, the background substractor is in a new namespace, cv::bgsegm::createBackgroundSubtractorMOG(..)

edit retag flag offensive close merge delete

Comments

did you try to compile bg_sub.cpp or write a code yourself

sturkmen gravatar imagesturkmen ( 2016-02-29 05:52:18 -0500 )edit

I write my own code, i can use the MOG2 but i can't find the simple MOG background substractor

ClementD gravatar imageClementD ( 2016-02-29 05:59:48 -0500 )edit
2

MOG was moved to opencv_contrib

berak gravatar imageberak ( 2016-02-29 06:25:26 -0500 )edit

Thanks you berak . Then i have new question, How can i add this to my current project? just copy the .cpp and . hpp i need into my current opencv? or do i have to rebuild opencv? or just add in my .pro file a way to the include folder of the opencv_Contrib

ClementD gravatar imageClementD ( 2016-02-29 07:03:22 -0500 )edit

@ClementD, please take a look at the readme there, it's called "readme" for a reason ...

berak gravatar imageberak ( 2016-02-29 07:05:24 -0500 )edit

"I keep this subject open if i have question on the importing of opencv contrib" -- yes, sure.

berak gravatar imageberak ( 2016-02-29 07:41:09 -0500 )edit
1

also note, that it's in a new namespace, cv::bgsegm::createBackgroundSubtractorMOG(..)

berak gravatar imageberak ( 2016-02-29 08:01:06 -0500 )edit