Counting Vehicles

Forum for questions and support relating to the 1.25.x releases only.
Locked
rossmck
Posts: 11
Joined: Wed Jan 09, 2008 11:03 pm

Counting Vehicles

Post by rossmck »

Bit of an unusual use case ... but I was wondering if anyone could advise if ZoneMinder could be used for this (or if they could recommend anything else)

I have a camera overlooking a two lane road and am looking to count vehicles in each direction - essentially all I need is an output from zone minder which tells me when movement was detected in one of 4 zones (an "in" and "out" point on each side of the road) if this makes any sense.

The idea being I can use these values to work out how many vehicles entered the left hand side of the top of the image and left by the right hand side of the top of the image as traffic going one direction, and vice-versa using the bottom two.

Or can anyone think of how else this could possibly be achieved (within linux)
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Counting Vehicles

Post by bb99 »

Define 4 monitors using the same camera defining unique zones that cover only the desired area. I haven't done this but it's possible. Most I've setup is 2 monitors on same camera with different zones.
koolb
Posts: 14
Joined: Tue Oct 04, 2011 3:30 am

Re: Counting Vehicles

Post by koolb »

Sounds viable, if you use zmu -l to list notice when your left monitor (same cam) is pre-alarm after your right one, then you know the direction (car travels right to left).

while :
do sudo zmu -l -U $usr -P $pwd
done | perl -pe 'BEGIN{$left=1;$right=3;} #set to the appropriate left/right mon ids
($id, $fn, $st) = split(/\s+/);
next unless $fn == 3 && $st < 2 && ($id == $left || $id == $rite);
$st{$id} = $st;
if ($st{$left} > $st{$rite}) { print "car moving leftToRight\n"; }
elsif ($st{$rite} > $st{$left}) { print "car moving rightToLeft\n" }'
Locked