View Single Post
  #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