The motion detection algorithm is based on gradient histogram. Starting the processing, frames are grabbed from the video files and after extracting the region of interest (ROI) part of the image individual frames are processed. This is needed in order to exclude part of the image that are out of our interest, ie part that cover from trees or capturing busy public roads. The configuration is included in a xml file and includes the coordinates of the part that we are interested in . Next step is to normalize and discard the unnecessary information. Algorithm starts with discarding the color information and eliminating parts of video frames – as it is define in the configuration file. Now the images are ready to subtracted in order to find the gradient information. A histogram calculation algorithm is then applied and finally the results classified. Images with motion detection are added and a common image is created for each video file including the motion parts for the specific time-frame. In this way reviewing motion event is easily done by browsing a single image. This is very helpful especially in case of surveillance systems  covering low traffic region such as cottages – seasonal houses.

The following image displaying he algorithm output after detecting a movement:

Recorded image

Motion detection output

Implementation has been mainly based on OpenCv  library, used for grabbing frames from the video files, libxml2 library, used for parsing and storing configuration data, liblog4cxx library, used for logging and error reporting and some standard libraries image manipulation libraries.

The full source code – written in C++ –  is available in GitHub under path.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *