![]() Positive velocity means the car travels left to right. The velocity drops off at the edges because I am tracking the center of the box, and as the car moves partially offscreen the center of the (visible) box moves towards the trailing edge as it gets smaller. Most of these cars are moving at a fairly constant speed in mph, but you can see cars towards the left hand side have a lower apparent velocity as seen by the camera, because they are farther away. Here is a plot of measured X velocity (pixels per frame, not any real-world unit) vs X position, for a bunch of cars passing by on the road. It is an extension of Adrian Rosebrock's example at So far is working pretty well for cars, but more variable for pedestrians. ![]() The hard part is automatically finding background images that do not contain moving elements and also if there is more than one new object in frame, matching up the same contour to the same object across frames. Here is a slightly different approach, using GaussianBlur, absdiff, and findContours (hopefully more CPU-efficient than the Mixture-Of-Gaussian and blob detection approach). I *think* you can run it on RPi as well, installing with The video input is from the RPi, but I'm actually running OpenCV 3.0.0 and Python 2.7.5 on Windows 7. 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. A branch moves only a short distance back and forth, while "interesting" objects move farther. It starts by detecting any motion, but then it measures how far detected objects travel across the screen. ![]() At least in some cases, it can distinguish cars and pedestrians from tree branches moving in the wind. After one weekend of playing with examples, I was able to get something that does more than a stock motion-detector webcam does. ![]() I'm pretty impressed with OpenCV and Python. I found another use for it as a collector of test cases for an OpenCV experiment. Thank to silvanmelchior, btidey and the other RPi Cam Web Interface project contributors yet again for the ever-improving software. ![]() (New thread, as I didn't want to clutter an old thread in case there are more posts on this topic)ĮDIT: 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) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |