jeck_slist
Posts: 7
Joined: Mon Jan 26, 2015 1:58 pm

Vehicle speed and license plate monitoring

Tue Jan 27, 2015 6:18 am

Greetings.

I am currently developing a project that captures vehicle speed along with its license plate.

Hardware:

* Raspberry Pi B+
* RaspiCam (tentative) or commercial CCTV surveillance cameras (tentative)

Software:

* Raspbian OS
* C++ or Python
* OpenCV (image processing/computer vision library)

The setup works like this:

The camera would be mounted in an elevated area and would capture/record the incoming vehicles. Data from the camera is sent to the Pi for processing. Its the Pi's Job to determine the speed and license plate of the incoming vehicle. The system must be able to detect multiple vehicles since the camera will be placed pointed at the road. The system must be able to detect overspeeding or speeds reaching 100-120kmh (since most roads in my country have this as a speed limit). The system is assumed to only work effectively in the daytime for optimal lighting.

Concerns:

* is the raspicam enough for the job? will it capture the license plates of vehicles at this high speeds? If this is enough, what settings should i use (resolution, shutter speed etc.)
* is the Pi enough for the Job? Im afraid that the pi may not be capable of processing the data fast enough knowing that the pi has 700mhz of processor speed.
* c++ or python? (which is much more efficient? Since i am concerned with speed)

do you have any suggestions on how i should tackle this project? Should I change something within the current setup? Any advice is appreciated.

Thanks in advance

User avatar
aTao
Posts: 1094
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Vehicle speed and license plate monitoring

Tue Jan 27, 2015 8:13 am

A camera alone is very difficult to use as a speed detector. Pitfalls include: no ground distance reference, no set reference point on vehicle (a low reference point will appear to move slower than a high one: sports car vs humvee), the RaspiCam uses rolling shutter (not all parts of the image are captured at the same time).
>)))'><'(((<

jeck_slist
Posts: 7
Joined: Mon Jan 26, 2015 1:58 pm

Re: Vehicle speed and license plate monitoring

Tue Jan 27, 2015 5:04 pm

aTao wrote:A camera alone is very difficult to use as a speed detector. Pitfalls include: no ground distance reference, no set reference point on vehicle (a low reference point will appear to move slower than a high one: sports car vs humvee), the RaspiCam uses rolling shutter (not all parts of the image are captured at the same time).
So what do you suggest I use?

User avatar
aTao
Posts: 1094
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Vehicle speed and license plate monitoring

Tue Jan 27, 2015 10:10 pm

from what I have seen of speed cameras they are quite focussed, aiming at a particular point of 1 lane of the road, given that then all the camera needs to to is capture number plates while a radar or ultra sound range detector clocks the speed (by Doppler shift).
The other method is average speed traps where 2 cameras are placed a long way apart and the time taken to travel the distance gives the average speed.

In either case you may find you still need to address the rolling shutter problem since movement will distort the image. It has been discussed here recently and I cannot remember if it was decided that the RaspiCam could be used this way. It would need a bit of firmware jiggerypokery and a mechanical shutter.
>)))'><'(((<

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: Vehicle speed and license plate monitoring

Tue Feb 17, 2015 12:11 am

Could you not use two lasers and two photo resistors that trigger, one set at point a the other set at point b. Knowing the distance between the two points and a simple script to calculate the speed???

stortryne
Posts: 11
Joined: Wed Feb 11, 2015 3:14 pm

Re: Vehicle speed and license plate monitoring

Fri Feb 20, 2015 11:46 am

mypifi wrote:Could you not use two lasers and two photo resistors that trigger, one set at point a the other set at point b. Knowing the distance between the two points and a simple script to calculate the speed???
It could, provided that you have road with only one lane. A light-beam crossing two lanes would give erroneus measurements when there are vehicles in both lanes (regardles of direction).

aux99
Posts: 7
Joined: Wed Feb 04, 2015 8:18 pm

Re: Vehicle speed and license plate monitoring

Fri Feb 27, 2015 8:55 pm

Hi,

I've seen multiple of these Speed measuring postings around the forum. From what I've read this could possibly be done with a HB100 doppler sensor. I guess when you want to capture a photo, just add fixed-focus camera and calculate the timing based on the speed as measured by the doppler sensor.

Based on this information I decided to start with the first step; the measurement of the speed with the doppler sensor. I ordered on of these https://www.tindie.com/products/limpkin ... ackpack-1/ and now the fun can begin :D

First problem to solve is how to connect these 4 pins. I have:
- VCC
- GND
- Freqeuncy Out
- VOUT
I was hoping to connect to a usb, but I guess I need the GPIO to make it work.


I guess I need
- PIN2 of the GPIO for VCC
- PIN6 of the GPIO for GND

Can anyone confirm this? and where should I connect the other two pins?
Any help will be appreciated.

User avatar
Douglas6
Posts: 4950
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Vehicle speed and license plate monitoring

Sat Feb 28, 2015 12:51 am

According to the HB100 application note, the frequency output generates pulses at a frequency proportional to velocity, on the order of 100 Hz (walking speed). The Pi might be able to sample those kinds of frequencies, but I have no idea how. Somebody around here should.

I'd start with Joan's Piscope to get a look at the output.

User avatar
jbeale
Posts: 3722
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Vehicle speed and license plate monitoring

Sat Feb 28, 2015 3:04 am

You can resolve a license plate with the R-Pi camera, but it is much easier to do from a roadside position when using a longer "telephoto" lens, say 8 to 12 mm focal length. In full-frame mode the R-Pi camera has an angle of view of 54 x 41 degrees with its 3.6 mm focal length lens. You can get camera modules advertised as "raspberry pi compatible" from ebay etc. with various length M12 lenses including 8mm or longer. If by "capture" you mean automatically recognize and transcribe a plate number, that is "just" a software problem which could I assume be done on the RPi or some other computer, if the basic image quality is good enough. I think it is more likely to work if you restrict yourself to just one lane of traffic per camera.

Also, you mention the camera being placed at an elevated position. At least around where I live, you cannot see some license plates, especially on trucks from an elevated position looking down because the plate is underneath an overhanging part of the vehicle, so a camera has to look nearly horizontally rather than down.

aux99
Posts: 7
Joined: Wed Feb 04, 2015 8:18 pm

Re: Vehicle speed and license plate monitoring

Sat Feb 28, 2015 10:20 pm

thanks @Douglas6 for your usefull hints. pigpio/pioscope seems interesting. Will check as soon as I got the pins right

I've been searching all evening for comparable projects / pin-layouts. From what I've found so far is this comment on the sellers page:
"Hello, thanks for your purchase! VOUT is proportional to the amount of reflected energy so you'll have to experiment. As for the FREQ_OUT ouput, I invite you to have a look at the application note."

Would it make sense to connect the VOUT, rated at 2.5V->VCC to a GPIO18 (for example) and the Frequency out to GPIO17.
I want to achieve to read the VOUT (the amount of reflected energy, perhaps this can be used to detect if it 's a car or bicycle?)
and the Frequency Out to detect the velocity / speed.


Just from a technical perspective; could it damage the Raspberry and/or the sensor when connecting this.

User avatar
Douglas6
Posts: 4950
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Vehicle speed and license plate monitoring

Sat Feb 28, 2015 10:52 pm

aux99 wrote:Would it make sense to connect the VOUT, rated at 2.5V->VCC to a GPIO18 (for example) and the Frequency out to GPIO17.... Just from a technical perspective; could it damage the Raspberry and/or the sensor when connecting this.
No, does not make sense and yes, could damage the Pi, since that module operates at 5V. Also, you'll need a ADC to read the analog output of VOUT (The Pi's GPIO are digital, high/low only). Typically you could use a couple resistors as a voltage divider to drop the 5V to a safe 3V level, but I'm not sure how this might affect the frequency output.

afremont
Posts: 22
Joined: Wed Jan 28, 2015 1:32 pm

Re: Vehicle speed and license plate monitoring

Sun Mar 01, 2015 12:08 pm

I think I'd use an Arduino to "drive" the Doppler module and communicate the information via a serial port to the pi. The Arduino is much better suited to measuring voltage and pulse widths.

To the OP: PM me and I'll show you some stuff that I did for measuring vehicle speed with a camera. Here's a sample picture showing an SUV doing over 38mph in a 25mph zone.

Image
"Experience: It's what you get when you were expecting something else"

Enuratique
Posts: 1
Joined: Fri Apr 17, 2015 12:29 am

Re: Vehicle speed and license plate monitoring

Fri Apr 17, 2015 12:40 am

afremont wrote:I think I'd use an Arduino to "drive" the Doppler module and communicate the information via a serial port to the pi. The Arduino is much better suited to measuring voltage and pulse widths.

To the OP: PM me and I'll show you some stuff that I did for measuring vehicle speed with a camera. Here's a sample picture showing an SUV doing over 38mph in a 25mph zone.

Image
I just signed up to PM you, but apparently that feature is not yet available to me yet. I would love more info on your system - I was trying to find something exactly like this. PM if you can...

BMS Doug
Posts: 3956
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Vehicle speed and license plate monitoring

Fri Apr 17, 2015 7:51 am

Enuratique wrote:
I just signed up to PM you, but apparently that feature is not yet available to me yet. I would love more info on your system - I was trying to find something exactly like this. PM if you can...
You will be able to PM him now, once you have made a forum post you can PM people.
Doug.
Building Management Systems Engineer.

inkeroo
Posts: 1
Joined: Sun May 03, 2015 3:33 pm

Re: Vehicle speed and license plate monitoring

Sun May 03, 2015 3:35 pm

afremont: can you post up what you have done? I'm looking to build something exactly like you describe and it would be very helpful to see how you accomplished this. :)

grahamed
Posts: 277
Joined: Mon Jan 30, 2012 7:01 pm

Re: Vehicle speed and license plate monitoring

Wed May 06, 2015 10:13 pm

Hi

Why an ADC with the HB100? The velocity info is contained in the frequency of the FREQ_OUT signal.

The 'scope view on https://www.tindie.com/products/limpkin ... ackpack-1/ shows a digital signal (FREQ_OUT presumably) and an analog (V_OUT presumably). A couple of resistors to drop FREQ_OUT from 5V to 3V3 should be OK to drive a GPIO pin.

pingu
Posts: 1
Joined: Sun May 10, 2015 3:12 am

Re: Vehicle speed and license plate monitoring

Sun May 10, 2015 3:37 am

Seems to me that the rolling shutter could be used to good advantage, actually.

For example, when one takes a picture with a digital camera in a direction perpendicular to the path the vehicle motion, a telephone pole or road sign captured will appear to tilt from vertical.

So, in theory, one could correlate the distortion angle of any vertical object with speed.

Regarding a more conventional method of tracing moving objects from frame to frame, someone tried to do it here: http://se.asee.org/proceedings/ASEE2014 ... 014/30.pdf

Atma-n
Posts: 1
Joined: Mon May 11, 2015 12:30 pm

Re: Vehicle speed and license plate monitoring

Mon May 11, 2015 12:33 pm

afremont wrote:I think I'd use an Arduino to "drive" the Doppler module and communicate the information via a serial port to the pi. The Arduino is much better suited to measuring voltage and pulse widths.

To the OP: PM me and I'll show you some stuff that I did for measuring vehicle speed with a camera. Here's a sample picture showing an SUV doing over 38mph in a 25mph zone.

Image
I am also interested in your tool. My cat got killed three days ago by a speeding car who did not even have the guts to stop and help him. He became 8 months old.

dunnodunno
Posts: 2
Joined: Wed Sep 16, 2015 1:00 pm

Re: Vehicle speed and license plate monitoring

Wed Sep 16, 2015 1:32 pm

Hello,
I would like to spot license plate from at leat 50 meters away, what do you recommend to buy ? I saw Rasp camera NoIR and long focal lens, but can't see any benchmarks or anything...

User avatar
jbeale
Posts: 3722
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Vehicle speed and license plate monitoring

Wed Sep 16, 2015 2:06 pm

dunnodunno wrote:Hello,
I would like to spot license plate from at leat 50 meters away, what do you recommend to buy ? I saw Rasp camera NoIR and long focal lens, but can't see any benchmarks or anything...
Something like a RPi camera with M12 lens mount, and a 16mm focal length lens could probably do it. Focus is very critical and may drift over time; these ebay specials are not necessarily mechanically rigid and dimensionally stable over temperature, which is what you need to stay in-focus with a long lens. Something like this: http://www.m12lenses.com/16-0mm-F1-8-Me ... 1618mp.htm

They have f/1.4 lenses, which are brighter but more fuzzy and never seem in sharp focus. They have 25mm focal length also but those are more difficult to use, and of course smaller field of view.

I also wonder if the IR camera is the best choice, it has lower contrast than the normal camera so you loose a lot of information, many cars will look the same and you cannot distinguish colors well if at all, even during the day.

dunnodunno
Posts: 2
Joined: Wed Sep 16, 2015 1:00 pm

Re: Vehicle speed and license plate monitoring

Wed Sep 16, 2015 2:35 pm

Ok thank you for these informations.
Anyway i don't need to see the cars, only the license plates. Even black & white photos could do the job.

User avatar
jbeale
Posts: 3722
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Vehicle speed and license plate monitoring

Wed Sep 16, 2015 3:53 pm

dunnodunno wrote:Ok thank you for these informations.
Anyway i don't need to see the cars, only the license plates. Even black & white photos could do the job.
Ok- sounds like a less common application. Usually when you want a plate number, it is also useful to fully describe the car it's attached to. Where I live, quite a few cars either don't have plates at all (in CA it's actually legal for some period of time after purchase, and often not strictly enforced thereafter), or they are somewhat or completely illegible.

Slackware
Posts: 131
Joined: Mon Jan 18, 2016 3:45 pm

Re: Vehicle speed and license plate monitoring

Sun Feb 14, 2016 4:17 pm

I hate to add complexity to your idea. but you will find a valuable market if you design the system to block license plate from being captured at the same time. This will increase your customer base 200 fold. That is how they do it here, sell cops detectors, and sell drivers detector detectors.

User avatar
experix
Posts: 204
Joined: Mon Nov 10, 2014 7:39 pm
Location: Coquille OR
Contact: Website

Re: Vehicle speed and license plate monitoring

Mon Feb 15, 2016 5:14 pm

Slackware wrote:I hate to add complexity to your idea. but you will find a valuable market if you design the system to block license plate from being captured at the same time. This will increase your customer base 200 fold. That is how they do it here, sell cops detectors, and sell drivers detector detectors.
I am patenting a system to defeat the system that blocks the license plate capture-- so don't anybody even think of touching that.

IChooseY0u
Posts: 1
Joined: Tue Aug 02, 2016 9:14 pm

Re: Vehicle speed and license plate monitoring

Tue Aug 02, 2016 9:25 pm

aux99 wrote:thanks @Douglas6 for your usefull hints. pigpio/pioscope seems interesting. Will check as soon as I got the pins right

I've been searching all evening for comparable projects / pin-layouts. From what I've found so far is this comment on the sellers page:
"Hello, thanks for your purchase! VOUT is proportional to the amount of reflected energy so you'll have to experiment. As for the FREQ_OUT ouput, I invite you to have a look at the application note."

Would it make sense to connect the VOUT, rated at 2.5V->VCC to a GPIO18 (for example) and the Frequency out to GPIO17.
I want to achieve to read the VOUT (the amount of reflected energy, perhaps this can be used to detect if it 's a car or bicycle?)
and the Frequency Out to detect the velocity / speed.


Just from a technical perspective; could it damage the Raspberry and/or the sensor when connecting this.
Hello aux99,

Where you able to figure out how to connect the pins on the HB100 backpack module to the PI?

Thanks,
ICY

Return to “Automation, sensing and robotics”