[Tutor] How to count vehicle? I'm trying but my code don't increasing..
Whees Northbee
ch.de2.2309 at gmail.com
Mon Sep 1 20:15:59 CEST 2014
There's no vehicle in my code, my video just contain vehicles so I think I
don't need to use haar classifier, so I'm just do background subtraction to
get foreground which is vehicle movement because there's no other movement
except vehicle and maybe little movement from trees...
I just use opencv module, like to do background subtraction..
No, the code don't have any error.
The code is working smoothly to detecting vehicle and make rectangle of
vehicle, and I find center point of rectangle at (cx,cy)..
I draw manually a line in video at coordinate (20,170) to (320,170)..
When each of the rectangle vehicle cross or intersect with that line, I
want to count it as 1..
I already try:
*)I think, since the line is in the same y coordinate, so if the center
(cx,cy), cy=line y coordinate, the count increase
if cy==170:
counter=counter+1
it doesn't work, no error but the counter stuck at 0
Second try:
*)I try to find distance between (cx,cy) and that line, if the distance is
0, counter increase
dy=cy-170 #170 is y coordinate of line
if dy==0:
if (cx<=320) and (cx>=70):
counter=counter+1
don't have error, but the counter sometime add sometime no..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140902/0e414444/attachment.html>
More information about the Tutor
mailing list