Skip to content

Library to detect whether movement can be detected between two images or video frames.

License

Notifications You must be signed in to change notification settings

stephanecharette/MoveDetect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is MoveDetect?

MoveDetect is a C++ library that detects movement in video frames and returns a "true" or "false" value.

MoveDetect introduction

License

MoveDetect is open source and published using the MIT license. Meaning you can use it in your commercial application. See license.txt for details.

How to Build MoveDetect

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

Example Code

MoveDetect has many configuration settings to modify the detection threshold, and optionally draw the mask output, bounding boxes, and and contour lines.

MoveDetect with bounding boxes and contours

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)
    {
        // ...
    }
}

C++ API Doxygen Output

The official MoveDetect documentation and web site is at https://www.ccoderun.ca/programming/doxygen/movedetect/.

Some links to specific useful pages: