Ask Your Question
1

background detection tutorial: error using MOG pointers

asked 2013-10-09 16:16:32 -0500

rickzor gravatar image

Hi everyone, I was trying to go through this background detection tutorial:

http://docs.opencv.org/trunk/doc/tutorials/video/background_subtraction/background_subtraction.html#background-subtraction

The MOG pointer is initialized as

Ptr<BackgroundSubtractor> pMOG; //MOG Background subtractor

and in main, it is used in the following manner:

pMOG = createBackgroundSubtractorMOG();

However, this yields the following error:

Error: Identifier "createBackgroundSubtractorMOG" is undefined

Also, when the background model is to be updated, the following command is used:

pMOG->apply(frame, fgMaskMOG);

Which in turn yields the following error:

Error: class "cv::BackgroundSubtractor" has no member "apply"

Any idea of what can be done about this?

Many thanks in advance!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2013-10-10 01:20:04 -0500

Vladislav Vinogradov gravatar image

Which version of OpenCV do you use? createBackgroundSubtractorMOG was added in master branch and will be available in the next major release. In 2.4 version BackgroundSubtractorMOG is used that way:

BackgroundSubtractorMOG mog;
mog(frame, fgMaskMOG);

And don't forget to include opencv2/video/video.hpp header.

edit flag offensive delete link more

Comments

@VladislavVinogradov Is it true some version of OpenCV doesn't have MOG? I'm using version 3.0.0 rc1. When I check background_segm.hpp, there is only for MOG2 & KNN method.

Aj-611 gravatar imageAj-611 ( 2016-02-15 00:53:57 -0500 )edit

Yes, it looks like MOG was removed from 3.0.

Vladislav Vinogradov gravatar imageVladislav Vinogradov ( 2016-03-03 01:05:17 -0500 )edit
0

answered 2016-08-31 15:33:16 -0500

mhaghighat gravatar image

If you want the MOG to work, you should

#include "opencv2/bgsegm.hpp"

and then

pMOG = bgsegm::createBackgroundSubtractorMOG();
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-10-09 16:16:32 -0500

Seen: 2,750 times

Last updated: Oct 10 '13