Monitor (实时视频监控、运动检测视频记录)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Monitor Recorder (运动检测监控记录工具)

This project is a tool similar with those programs executing by monitors. Monitoring somewhere, and recording what happened when actions detected.



  • I wrote these codes with VS Ultimate 2013, version 12.0.21005.1 REL.
  • To compile these codes, you need to install OpenCV, and configure them in your Visual Studio. Download OpenCV from here, make sure the version you downloaded. The steps are:
  • Add <OPENCV_PATH>\build\x64\vc12\bin to your environment path.
  • Add <OPENCV_PATH>\build\include, <OPENCV_PATH>\build\include\opencv and <OPENCV_PATH>\build\include\opencv2 to your VS including path. Right click the project and select Settings or Attributes, the including path is in VC++ path.
  • Add all files under <OPENCV_PATH>\build\x64\vc12\lib to your link inputs. That could be found in LINK -> INPUT. You can also separate the files into two parts by whether having suffix d, and add those files with suffix d into your DEBUG mode, add others into RELEASE mode.


  • You need to install OpenCV and other packages based. You can follow this link Install OpenCV in Linux. Also, you can download to install it easily, or follow these steps ( notice that Ubuntu 14.04 may need to append -D BUILD_TIFF=ON when running cmake ).
$ mkdir monitor && cd monitor
$ sudo apt-get install build-essential
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
$ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
$ wget
$ unzip
$ cd 2.4.13
$ mkdir release && cd release
$ sudo make
$ sudo make install
  • Configure the link path.
$ sudo nano /etc/   
$ Input /usr/local/lib, press Ctrl + X to exit.
$ sudo ldconfig -v


  • This tool can build your camera capable devices into monitors. It can monitor a place, and detects whether there are unnormal actions. If it detects actions, those actions will be recorded into an .avi file.


You can download the windows executable file from here, and Linux executable file from here.

  • The tool will starts after 2s. You need to make sure that when it starts, the first frame it captured is the background you want to monitor. If you don't specify the VIS option, the monitor window won't appear and it will just run background.
  • Run MonitorRecorder.exe --help to see how to use. The copy of help information is below. You can run MonitorRecorder -vis -mog2 24 10 test.avi to have a try. This command will show what the camera monitors with MOG2 mode and records with fps=24, and will starts recording after 10 frames of unnormal actions detected. The recording file is test.avi. The view of MOG2 mode is put in Example.
 ./MonitorRecorder.exe [VIS] [MODE] [FPS] [THRESHOLD] [OUTPUTFILE]
   [VIS]  : use -vis to show the monitor window, or it will run background.
   [MODE] : -src   shows the original frame;
            -mog1       shows the MOG frame;
            -mog2      shows the MOG2 frame.
   [FPS]  : set the fps of record file, default is 24.
          : set the number x that the monitor will start recording after
            x unnormal frames passed.
          : assign the output recording file. It must be .avi format.


  • 2016-10-05: Add this project.
  • 2016-10-06: Add license.
  • 2016-10-07: Build repository.
  • 2016-10-08: Add Linux version.
  • 2016-10-13: Add authorisation.


All codes in this repository are licensed under the terms you may find in the file named "LICENSE" in this directory.