/OpenCV_HummingbirdsMotion

Motion Detection using OpenCV and python

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

MotionMeerkat

MotionMeerkat is a standalone python executable that identifies candidate motion events of interest from an extensive video stream. After running a video through MotionMeerkat, the user can review a folder of candidate motion frames for the target organism. This tool greatly reduces the time needed to review videos and is flexible to a variety of video inputs. The python source code is also available online for more advanced users.

Executable can be found here: http://benweinstein.weebly.com/motionmeerkat.html

Approach

Combining Python 2.7 and the OpenCv2 library, with videos read using ffmpeg.

All source corde testing has been done on Windows to develop the exe, but there is no reason to expect major difficulties on linux or mac if running in python.

Contents

/dist: folder containing the executable dist build /build: data files for executable

main.py

Python executable - can be run from shell or IDLE, first time users should just open .py file up in IDLE (or any python interpreter)

Source Installation

  1. Download anaconda distribution of python which includes a number of scientific modules: https://store.continuum.io/cshop/anaconda/

or

  1. Download and install python 2.7
  2. Download and install numpy and scipy
  3. OpenCV (tested on 2.4.9): http://opencv.org/downloads.html
  4. Copy the python bindings! see: http://stackoverflow.com/questions/4709301/installing-opencv-on-windows-7-for-python-2-7 and other SOF questions on this detail.
    • Extract OpenCV (will be extracted to a folder opencv)
    • Copy ..\opencv\build\python\x86\2.7\cv2.pyd
    • Paste it in C:\Python27\Lib\site-packages
  5. Confirm opencv connection by opening Python IDLE or terminal, and type "import cv2", if you recieve no errors, everything is connected
  6. Install FFmpeg for capturing videos

FFmpeg is exported and in the path variables, typing ffmpeg into cmd prompt will boot the program Python path is exported, calling python from cmd boots the program The #!shebang in the top of the motion.py script matches the location of python (type 'where python' into cmd to check directory location)

Note: Please check paths depending on your cloned git library - they may not be relative in all cases.