mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 01:12:47 +08:00
Motion detector compatible with OpenCV 2.4.x
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user