Ask Your Question

Revision history [back]

OpenCV, Motion detection

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT);

MOG2Background.operator ()(Frame, Foreground); MOG2Background.getBackgroundImage(Background); std::vector<std::vector<cv::point> > Contours; cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED); cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?

OpenCV, Motion detection

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT);

MOG2Background.operator ()(Frame, Foreground); MOG2Background.getBackgroundImage(Background); std::vector<std::vector<cv::point> std::vector<std::vector<cv::Point> > Contours; cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED); cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);CV_FILLED);

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?

OpenCV, Motion detection

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

cv::GaussianBlur(Frame, `cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT); cv::BORDER_DEFAULT);

MOG2Background.operator ()(Frame, Foreground); MOG2Background.getBackgroundImage(Background); std::vector<std::vector<cv::Point> Foreground);

MOG2Background.getBackgroundImage(Background);

std::vector<std::vector<cv::point> > Contours; Contours;

cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); CV_CHAIN_APPROX_SIMPLE);

cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED); CV_FILLED);

cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED); `

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?

OpenCV, Motion detection

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

`cv::GaussianBlur(Frame, cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT);

cv::BORDER_DEFAULT); MOG2Background.operator ()(Frame, Foreground);

MOG2Background.getBackgroundImage(Background);

std::vector<std::vector<cv::point> Foreground); MOG2Background.getBackgroundImage(Background); std::vector<std::vector<cv::Point> > Contours;

Contours; cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

CV_CHAIN_APPROX_SIMPLE); cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED);

CV_FILLED); cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED); `

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?

OpenCV, Motion detection

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT);
MOG2Background.operator ()(Frame, Foreground);
MOG2Background.getBackgroundImage(Background);
std::vector<std::vector<cv::Point> > Contours;
cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED);
cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?

click to hide/show revision 6
updated title and tags

OpenCV, Motion detectiondetection false alarms from light changes

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT);
MOG2Background.operator ()(Frame, Foreground);
MOG2Background.getBackgroundImage(Background);
std::vector<std::vector<cv::Point> > Contours;
cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED);
cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?

click to hide/show revision 7
retagged

Motion detection false alarms from light changes

In order to use the motion detection in my software with OpenCV, I use this elementary approach:

cv::GaussianBlur(Frame, Frame, cv::Size(5, 5), 0, 0, cv::BORDER_DEFAULT);
MOG2Background.operator ()(Frame, Foreground);
MOG2Background.getBackgroundImage(Background);
std::vector<std::vector<cv::Point> > Contours;
cv::findContours(Foreground, Contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
cv::rectangle(Foreground, cv::Point(0, 0), cv::Point(Foreground.cols, Foreground.rows), cv::Scalar(0, 0, 0), CV_FILLED);
cv::drawContours(Foreground, Contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

This code works correctly but, if there is a flash light from the Window (by a car lights during the night for example) I obtain an alarm. How can I do to optimize my code?