LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Open-source speed gun? (https://www.linuxquestions.org/questions/linux-software-2/open-source-speed-gun-4175609521/)

littlebigman 07-09-2017 12:05 PM

Open-source speed gun?
 
Hello,

I'd like to see if there'd be a way to put together a speed gun with a webcam + computer to build an open-source and cheaper alternative to eg. Lasertech's TruSpeed (€3,800,$4.000).

https://www.youtube.com/watch?v=WYg2OJy4EDE

I know about Paul Reynolds' OpenCV-based solution, but I'd like something that I could install on a sidewalk and point at incoming cars instead. As cherry on the pie, it could also read license plates using OpenALPR, but I can do without at this point.

Is there some working project I could use?

Thank you.

szboardstretcher 07-09-2017 12:46 PM

Video to detect speed? You would need to know that your camera operates at X frames per second. Then you would have to detect the car against the background. Then you would have to measure how far that car moved from one second to the next.

But you would also need to know exactly how far away that car is from the camera. If it moves 1 inch per second in the camera and is 10 feet away, that might be indicative of 8MPH, but if it is 40 feet away it might be indicative of 40MPH.

And you would have to make sure the camera is not angled horizontally at all. Since a video of a car at an 80 degree angle would be moving slower across the picture, but be going faster in reality.

It would be impossible to do from the front or back as well. Only the side would work,.. for calculating speed.

Things to consider.

astrogeek 07-09-2017 02:17 PM

A video based point-and-measure device (speed gun) would be an extremely difficult nut to crack!

As szboardstretcher has said said, for video based measurements you need to know multiple parameters very accurately and those cannot be inferred from the video data itself.

In the Paul Reynolds example you linked, he makes the most important ones constants by having an invariant camera location (i.e. fixed frame field), nominally perpendicular to the direction of target motion.

But he still has some significant sources of error that make his best measurements only rough approximations.

1. The distance travelled by vehicles in the near lane is different than that in the far lane by a significant portion of the total distance covered in the frame. Similarly, the position of a vehicle within its own lane may vary, affecting the actual distance measured.

2. He assumes a perfect frame rate, which is the timebase of the speed measurements, and a relatively small sample per measurement - 50 frames. But without actual data to back that up his timebase is fundamentally flawed - in a big way!

3. Even if his frame rate were perfect, and every vehicle maintained constant speed and perfect lane position, by counting frames as his timebase and using 50 frames as the zero reference point, he introduces a quantization error proportional to +/- total-distance/50 into every measurement. That is a big error source, and it increases with vehicle speed due to decreasing sample size with increasing speed!

I am not criticizing that effort, but I would bet the actual error range in his measurements is much larger than you would think from just watching the video of cars driving by.

My point is that he has made effort to control the major parameters of distance and angle to target, and still has large, and unquantified errors inherent in his measurements. Trying to extend that use case to allow for arbitrary placement of camera ("on a sidewalk"), variable distance and angle to target, and larger speed range of targets (> 25mph zone)... would be largely futile.

Soitgoes 07-09-2017 08:14 PM

Why not integrate a microcontroller and ultrasonic sensors? Cheap and easier to figure out.

Regards

norobro 07-09-2017 08:30 PM

Quote:

Originally Posted by Soitgoes (Post 5732955)
Why not integrate a microcontroller and ultrasonic sensors? Cheap and easier to figure out.

I bookmarked this page intending to investigate. Possibly a starting point: http://hackaday.com/2014/08/18/hot-w...adar-detector/


All times are GMT -5. The time now is 06:30 AM.