# how to compute horizontal angle of a pixel from a computer vision camera

My program needs to compute the angle of a pixel from a computer vision camera that has 120 degrees horizontal field of view, and resolution of 640 pixels wide and 480 pixels high.

Program receives an X,Y array of pixels for each image frame from camera. For left-most pixel, X would be 0 and angle would be -60 degrees. For right-most pixel, X would be 639 and angle 60 degrees. For center pixel, X would be 320 and angle 0.

How is angle computed when (X is > 0 and < 320) and (>320 and <640)?

## migrated from mathematica.stackexchange.comSep 11 '15 at 17:44

This question came from our site for users of Wolfram Mathematica.

• Is this related with the software product Mathematica(TM)? This site is about it! – Dr. belisarius Sep 11 '15 at 13:52
• Check this: stackoverflow.com/questions/17499409/… – Hubble07 Sep 11 '15 at 16:13
• If the lens has a stated angle-of-view of 120 degrees, that generally refers the angle-of-view across a diagonal of the image frame and not the horizontal angle-of-view. The horizontal angle-of-view will be 80% of that (96 degrees). Similarly, the vertical angle-of-view will be 60% of that (72 degrees). – m_goldberg Sep 11 '15 at 17:14
• 120 degrees horizontal field of view – Doug Null Sep 11 '15 at 19:00
• With a field of view that wide there's bound to be noticeable distortion. I would use opencv's camera calibration utility to get the distortion parameters along with the projection matrix. – 2012rcampion Sep 11 '15 at 19:17