diff --git a/src/video/motiondetector.cpp b/src/video/motiondetector.cpp index c115c2b..db53dcf 100644 --- a/src/video/motiondetector.cpp +++ b/src/video/motiondetector.cpp @@ -4,7 +4,7 @@ using namespace cv; MotionDetector::MotionDetector() { - pMOG2 = cv::createBackgroundSubtractorMOG2(); + pMOG2 = new BackgroundSubtractorMOG2(); } MotionDetector::~MotionDetector() @@ -14,7 +14,7 @@ MotionDetector::~MotionDetector() void MotionDetector::ResetMotionDetection(cv::Mat* frame) { - pMOG2->apply(*frame, fgMaskMOG2, 1); + pMOG2->operator()(*frame, fgMaskMOG2, 1); } cv::Rect MotionDetector::MotionDetect(cv::Mat* frame) @@ -27,7 +27,7 @@ cv::Rect MotionDetector::MotionDetect(cv::Mat* frame) cv::Rect largest_rect, rect_temp; // Detect motion - pMOG2->apply(*frame, fgMaskMOG2, -1); + pMOG2->operator()(*frame, fgMaskMOG2, -1); //Remove noise cv::erode(fgMaskMOG2, fgMaskMOG2, getStructuringElement(cv::MORPH_RECT, cv::Size(6, 6))); // Find the contours of motion areas in the image