View Single Post
  #9   Spotlight this post!  
Unread 04-04-2016, 21:06
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: How can angle offset of a shooter be calculated from pixel offset?

It's fairly simple. It's (pixels from center) / (camera pixel width) * FOV
For example, your camera has a field of view (FOV) of 45 degrees, your camera width is 320 pixels, and your image is 16 pixels off center. Then the angle to aim is:

(320 pixles/16 pixels) * 45 degrees = 2.25 degrees

You can calibrate your exact camera FOV by pointing your camera at a white board and marking two points on the white board at the left and right edge of the camera image. Then measure the distance between the two points on the white board, and the distance between the white board and the camera. Then a little trig will give you the FOV.
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote