EDIT: If you aren't familiar with OpenCV on the RPi, below notes show installing OpenCV 2.4 (but not the OpenCV 3.0.0 I'm using)
http://www.pyimagesearch.com/2015/02/23 ... i-2-and-b/
http://www.pyimagesearch.com/2015/03/30 ... nd-python/
Thank to silvanmelchior, btidey and the other RPi Cam Web Interface project contributors yet again for the ever-improving software. I found another use for it as a collector of test cases for an OpenCV experiment. Demo on YouTube: https://www.youtube.com/watch?v=KCevhaR75_s
I'm pretty impressed with OpenCV and Python. After one weekend of playing with examples, I was able to get something that does more than a stock motion-detector webcam does. At least in some cases, it can distinguish cars and pedestrians from tree branches moving in the wind. It starts by detecting any motion, but then it measures how far detected objects travel across the screen. A branch moves only a short distance back and forth, while "interesting" objects move farther. In the video, I apply a velocity and distance-travelled text label to any blob which has moved more than 50 pixels left or right, since it was first detected.
The video input is from the RPi, but I'm actually running OpenCV 3.0.0 and Python 2.7.5 on Windows 7. I *think* you can run it on RPi as well, installing with
Code: Select all
sudo apt-get install libopencv-dev python-opencv
I am using createBackgroundSubtractorMOG2 and SimpleBlobDetector. The demo source code is at https://github.com/jbeale1/OpenCV
If you want to try this yourself, edit BlobTrack1.py to change my hardcoded input filename to read your own video:
Code: Select all
cap = cv2.VideoCapture('2015-06-28-CarTest.mp4') # compilation of test cases