MoveDetect is a C++ library that detects movement in video frames and returns a "true" or "false" value.
MoveDetect is open source and published using the MIT license. Meaning you can use it in your commercial application. See license.txt for details.
MoveDetect requires OpenCV. On Ubuntu:
sudo apt-get install cmake build-essential libopencv-dev
cd ~/src
git clone https://github.com/stephanecharette/MoveDetect.git
cd MoveDetect
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
make package
MoveDetect has many configuration settings to modify the detection threshold, and optionally draw the mask output, bounding boxes, and and contour lines.
This is how to use it:
// include MoveDetect.hpp and link against MoveDetect and OpenCV
//
MoveDetect::Handler handler;
cv::VideoCapture video("movie.m4v");
while (true)
{
cv::Mat frame;
video >> frame;
if (frame.empty())
{
break;
}
//
const bool movement_detected = handler.detect(frame);
if (movement_detected)
{
// ...
}
}
The official MoveDetect documentation and web site is at https://www.ccoderun.ca/programming/doxygen/movedetect/.
Some links to specific useful pages: