Error in BackgroundSubtraction Mog2
I am using opencv 2.4.4 and when i run this algorithm on it , it give me the error on nmixtures and bShadowDetection
cv::VideoCapture cap("try2.avi");
cv::BackgroundSubtractorMOG2 bg;
bg.nmixtures = 3;
bg.bShadowDetection = false;
//When i use it like below , it didn't give syntax error , but give me error at runtime bg.set("nmixtures", 3); bg.set("bShadowDetection", false);
std::vector<std::vector<cv::Point> > contours;
cv::namedWindow("Frame");
cv::namedWindow("Background");
for(;;)
{
cap >> frame;
bg.operator ()(frame,fore);
bg.getBackgroundImage(back);
cv::erode(fore,fore,cv::Mat());
cv::dilate(fore,fore,cv::Mat());
cv::findContours(fore,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE);
cv::drawContours(frame,contours,-1,cv::Scalar(0,0,255),2);
cv::imshow("Frame",frame);
cv::imshow("Background",back);
if(cv::waitKey(30) >= 0) break;
}
Error's
error C2248: 'cv::BackgroundSubtractorMOG2::nmixtures' : cannot access protected member declared in class 'cv::BackgroundSubtractorMOG2'
`error C2248: 'cv::BackgroundSubtractorMOG2::bShadowDetection' : cannot access protected member declared in class 'cv::BackgroundSubtractorMOG2`'
error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::BackgroundSubtractorMOG2::operator()(class cv::_InputArray const &,class cv::_OutputArray const &,double)" (??RBackgroundSubtractorMOG2@cv@@UAEXABV_InputArray@1@ABV_OutputArray@1@N@Z) referenced in function _main