Go to Post To put it simply: An adult coach impacts a team for two minutes. An adult mentor impacts a team for a lifetime. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2017, 23:54
WSiggs WSiggs is offline
Pb Programmer
FRC #4908 (Dragons)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Duxbury Massachusetts
Posts: 38
WSiggs is on a distinguished road
How to calculate target distance?

Our team is working on implementing vision processing, and we have rotation calculations down, but are unsure about how to approach calculating distance. I have seen that some people use a scale factor as a direct ratio between height of the target and that seems easy enough, but I have heard that this doesn't have the best properties (from 254). They recommend using "line - plane intersections", but I have had trouble finding some examples of this. Where would I be able to find examples of these calculations? And are there any other better ways to calculate distance?
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2017, 02:14
AriMindell AriMindell is offline
Registered User
FRC #1389 (The Body Electric)
Team Role: Programmer
 
Join Date: May 2016
Rookie Year: 2015
Location: Maryland
Posts: 28
AriMindell will become famous soon enoughAriMindell will become famous soon enough
Re: How to calculate target distance?

We are using an ultrasonic sensor to determine range from the target, since I believe using the vision itself to determine range is less reliable/accurate. That said, if you are still interested in doing it with vision, GeeTwo gave a good answer to this in another thread:
Quote:
Originally Posted by GeeTwo View Post
If you're asking what I think you're asking, use the height of the retroreflective area. Its actual height 5". Divide that by the number of pixels of its height, and you have a good estimate of the image resolution in a direction perpendicular to a (presumably horizontal) camera, and can roughly calculate range.

Alternately, just measure the height in pixels (P0) at a known range R0 (say 10 feet). Then whenever you're looking at the target, R = R0 * P0 / P. Should be close enough to get you going, but it breaks down as you get close to the target and the sine of the angle is no longer proportional to the angle.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2017, 02:40
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 410
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: How to calculate target distance?

Last year we calculated distance and angle based on the x/y position of the target in the image and it worked pretty well.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2017, 07:11
vScourge's Avatar
vScourge vScourge is offline
Videogame Developer
AKA: Adam Pletcher
FRC #4096 (Ctrl-Z)
Team Role: Coach
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Champaign, IL
Posts: 42
vScourge will become famous soon enough
Re: How to calculate target distance?

If you know the FOV of your camera in degrees, pixel resolution of the image and the real-world dimensions of the target, then you can compute the distance.

This page should get you going. Especially the "Measurements" section about half-way down.
Identifying and Processing the Targets
Reply With Quote
  #5   Spotlight this post!  
Unread 06-02-2017, 09:29
FuzzyLogic FuzzyLogic is offline
Registered User
FRC #3792 (Army Ants)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2016
Location: Missouri
Posts: 1
FuzzyLogic is an unknown quantity at this point
Re: How to calculate target distance?

Another way to calculate distance is to look at the height of the object within a the camera's field of view. Very close to the tower the vision target is at the top of the image, and as you back up it lowers to the middle of the image.

You can either use an empirical function to determine distance (beware, it's not linear though) or use geometry. Our team uses geometry and it's been pretty successful. We typically calculate within 1-3 inches of the actual distance.

This method is also easy to calibrate. Although the pixels-to-distance function isn't linear, the error in the calculation is. Finding the slope of the line allows you to adjust the angle constant in the formula.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi