0

I am trying to recover an intrinsic camera K matrix to be used in OpenCV from OpenGL specifications for a camera. Almost everything that I have read on stackoverflow, etc. seems to assume that I want to take OpenGL matrices to OpenCV matrices, but my problem is the reverse. There was a previous question here but the construction of the K matrix link is dead.

Given a set of camera specifications in OpenGL:

clipping plane: { near: 0.01, far: 10.0 }
vertical field view angle (radians): 1.2
publish image resolution pixels: { width: 640, height: 480 }

I need to recover the K matrix parameters, i.e. focal lengths in the x and y directions as well as the principal point offsets.

I know that the axes conventions differ between OpenGL and OpenCV as well.

Rohit Gupta
  • 4,022
  • 20
  • 31
  • 41
  • how is that "field of view angle" to be understood? hfov, vfov, dfov? in radians? or as the tan() of the angle? can you present an example picture of a square of known size, at a known distance, viewed frontally, centered, no camera rotation, with those camera parameters? – Christoph Rackwitz Jun 26 '23 at 22:47
  • generally, cx = (width-1)/2, cy likewise, and f = (width/2) / tan(alpha/2) if considering hfov – Christoph Rackwitz Jun 26 '23 at 22:50
  • @ChristophRackwitz Thanks for your comments, edited per your questions. FOV is vertical (which I think is the default for OpenGL). Units for FOV are in degrees. What is alpha? and should cy = (height-1)/2? – BeginnersMindTruly Jun 26 '23 at 23:16

0 Answers0