Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to declare and initial BackgroundSubtractorMOG2 in opencv3.

Hi all, i try many different methods to declare and intial backgoundsubtractormog2 classs. But i always fails, i list all i declare. Someone can tell me how to declare or has any idea or any referance can help me? I appreciate your help.

Ptr<BackgroundSubtractor> MOG2model=createBackgroundSubtractorMOG2().dynamicCast<BackgroundSubtractor>();//Fail
Ptr<BackgroundSubtractorMOG2> MOG2model = createBackgroundSubtractorMOG2().dynamicCast<BackgroundSubtractorMOG2>();//Fail
Ptr<BackgroundSubtractorMOG2> MOG2model = createBackgroundSubtractorMOG2();//Fail
cv::BackgroundSubtractorMOG2 MOG2model=BackgroundSubtractorMOG2::create<BackgroundSubtractorMOG2>("Background");//Fail

by the way, thanks very much!