LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-09-2017, 12:05 PM   #1
littlebigman
Member
 
Registered: Aug 2008
Posts: 590

Rep: Reputation: 33
Question 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.
 
Old 07-09-2017, 12:46 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656
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.
 
1 members found this post helpful.
Old 07-09-2017, 02:17 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,619
Blog Entries: 11

Rep: Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657Reputation: 3657
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.
 
Old 07-09-2017, 08:14 PM   #4
Soitgoes
Member
 
Registered: Oct 2016
Location: Beyond Thunderdome
Distribution: Gentoo
Posts: 67

Rep: Reputation: Disabled
Why not integrate a microcontroller and ultrasonic sensors? Cheap and easier to figure out.

Regards
 
Old 07-09-2017, 08:30 PM   #5
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by Soitgoes View Post
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/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Google Glass moves with speed thanks to open source LXer Syndicated Linux News 0 03-31-2014 10:40 AM
LXer: The Era of the Open Source Gun LXer Syndicated Linux News 0 05-07-2013 02:10 AM
LXer: Open-source messaging at (nearly) the speed of light LXer Syndicated Linux News 0 05-19-2012 12:32 PM
LXer: Microsoft Wants Speed Advantage With Open Source PHP LXer Syndicated Linux News 0 11-01-2006 08:54 AM
LXer: Open source coders' speed astounds Coverity LXer Syndicated Linux News 0 04-05-2006 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration