Hacker News new | ask | show | jobs
by telot1 3222 days ago
10 year veteran of the ITS industry here. It's not trivial to do camera speed recognition. You need to do ranging in addition to the video detection to know how far the vehicle is from the camera to accurately measure the speeds using movement between frames. These systems cost in the $10,000+ range, while a k-band doppler can be had for around $500. It's a no brainer to stick with the 1940's doppler technology ;)
3 comments

If the street is long enough, what about two of these cameras with one at each end of the street?

You'd only get an average speed but that should be enough to catch the worst offenders.

Something like this[1] has been used on UK motorways for a while.

[1] https://en.wikipedia.org/wiki/SPECS_(speed_camera)

Or could you just post two posts near the road in view of the camera with a known distance between them...
I wonder if you could even use road markings or kerb stones as your calibration to save the effort of measuring things out.

I'm admittedly rather unqualified in this area (I don't even know what the ITS industry is!) but I have experience in estimating distances from video and calculating speeds from pixel displacement (particle image velocimetry) and at first pass it seems to me this would be a fairly straightforward problem to solve.

Obviously radar or lidar would be preferable but a quick search for "OpenCV speed estimation" shows people having success with simple single <$50 camera setups.

I'd use two infrared laser LEDs on a PCB with a low-res-but-high-speed infrared light detector, and set up a retroreflector across the street.

If the LEDs are 10cm apart, and parallel to the street, and left dot vanishes 7.45645 ms after the right dot, then something was moving through the beams from right to left at 30 miles per hour (13.4112 m/s). If right dot vanishes 4.06716 ms after left dot, something was moving left to right at 55 mph (24.5872 m/s).

You can even get an estimate of vehicle length and acceleration if you watch for the dots to reappear.

The frame rates and resolutions of most cameras aren't great for precisely estimating speed. You would need a high-speed camera, which is wasted on a surveillance application. So you just use two cameras, one that sees 16 infrared pixels with an ultra high frame rate, and one that sees many RGB pixels at 24 fps.

I disagree with you regarding resolution and frame rates, I don't see why you would need a high speed camera. Something like a raspberry pi camera would be perfectly sufficient for this, assuming you still just want to get someone's speed to within say +/- 1mph to shame them, as in the original comment.

Set up your RPi camera about 20m from the road, with it's FOV that'll give you about 20 m of road coverage. Rule of thumb in my world is that the items of interest should not move more than 1/4 of window width between frames. So that's 5m, to move 5m between frames at 30Hz you'd need to be doing about 300 mph. More realistically the car might be doing 25m/s giving you an inter-frame displacement of 0.8m ~130px. If that's too little for your software to register just up the inter-frame time.

You only need high-speed if you're mounting a device immediately adjacent to the road with a low-resolution light sensor.

An ordinary surveillance camera certainly can estimate speed, especially with good software, but a dedicated device would likely give a better performance to price ratio or performance to power ratio. Maybe I'm just too old, and still think that a RPi and enough resolution for a human to actually discern an image is overkill, because I'm used to computing power and image resolution being expensive.

But then again, if you're already using that setup to read license plate numbers, you're not actually starting from zero. The marginal effort to estimate speed on top of that is likely less than a purpose-built device.

> The frame rates and resolutions of most cameras aren't great for precisely estimating speed.

How good do you think the numbers would be? For example, the speed limit on my road is 25 mph but I know people routinely drive through at 40 mph. Would a camera system be good enough to record, say, 30 mph with error bars equal to +/- 5 mph?

That is highly application dependent.

If you can set up clear distance markers 100m apart on the road itself, a regular surveillance camera set up with its line-of-sight perpendicular to the road could probably estimate speeds between 5 and 80 mph with at least 1 mph precision, and adding some image processing software could probably give you 0.1 mph precision or better.

Oblique views, curved roads, unclear markers, or even differently colored cars could produce false results, or no results at all.

It may be enough to convince your local cop shop to set up a radar trailer on your street for a few days, but you're not going to be convicting anyone of reckless driving with it.

I reckon an RPi type camera would be perfectly sufficient to estimate speeds, probably to a higher accuracy than you ask.

Edit: a quick search led me to this https://gregtinkers.wordpress.com/2016/03/25/car-speed-detec...

and this https://github.com/pageauc/speed-camera

Wow! That's perfect. Thanks for the links.
The most difficult aspect is the "getting the speed legally binding". As much as many a police officer would love to write a ticket based on your setup, little will become of it without solid formal proof of its accuracy.
It doesn't have to involve the police or courts to effect a change. If somebody asked me to slow down because I was driving at 40 mph down our 25 mph street, I would probably do it.