//cv::BackgroundSubtractorMOG2 bg = cv::BackgroundSubtractorMOG2();
cv::Ptr<BackgroundSubtractorMOG2>createBackgroundSubtractorMOG2();
bg.set("history", 1000);
bg.set("nmixtures", 3);
bg.set("backgroundRatio", 0.7);
bg.set("detectShadows", false);
//background subtractor for the filterTotalBackground results
//cv::BackgroundSubtractorMOG2 bg2 = cv::BackgroundSubtractorMOG2();
Ptr<BackgroundSubtractorMOG2>createBackgroundSubtractorMOG2();
bg2.set("history", 1000);
bg2.set("nmixtures", 3);
bg2.set("backgroundRatio", 0.7);
bg2.set("detectShadows", false);
必要利用这种单一的代码,但我很困惑的地方在上面显示前面code.the注释行给我的错误声明BG和BG2。因此,如果任何人都可以提出一个可行的解决方案,那么这将是一个很大的帮助背景减法器,用于OpenCV的= 3.1.0
bg->operator()(total, fore); //error is here
//Computes a background image.
//C++: void BackgroundSubtractor::getBackgroundImage(OutputArray backgroundImage) const¶
bg->getBackgroundImage(back);
//find the moving objects in the frame and cv::erode the image
bg2->operator()(frame, fore2); //error is here
bg2->getBackgroundImage(back2);
cv::erode(fore2, fore2, cv::Mat());
你可以显示我得到的错误 – eyllanesc