Motion detection demo using opencv + python

266 views
Skip to first unread message

Dilawar Singh

unread,
Oct 15, 2015, 3:58:41 AM10/15/15
to wncc_iitb
Python + opencv are great tool to do video/image processing. Here is a demo: it shows how to detect eye blinks in mouse recording. These scripts can be modified to detect some other features in video. Feel free to contact me if you have similar problems:

https://www.youtube.com/watch?v=kC_jXwqPPvM

The source code is here: https://github.com/BhallaLab/Scripts/tree/master/Blink_Detection

The design pattern is following:

1. Get the first frame out of video and ask use to select a rectangle as region of interest.
2. Once ROI is selected, one can apply a function to extract feature. Here first (canny) edge-detection, find contour and merge them, after generate a convex hull from merged contour is applied to locate pupil.

The script extract_with_anime.py generates the movie which is linked with post. This is for demo purpose, it slows down the whole process by a factor of 100. The matplotlib.animation is pretty easy to use by its animation speed is quite slow.

--
Dilawar
NCBS Bangalore
Reply all
Reply to author
Forward
0 new messages