mmatl / pyrender

Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes.
http://pyrender.readthedocs.io/
MIT License
1.31k stars 226 forks source link

How to retrieve intrinsic camera parameters from PerspectiveCamera #264

Open nonathecoda opened 1 year ago

nonathecoda commented 1 year ago

Hi! I'm trying to create a pointcloud from a depth map that I rendered using a PerspectiveCamera. For this, I will need the intrinsic parameters of the camera. Is there a straightforward way to retrieving those parameters? I tried the following, which clearly seems to be wrong, however I didn't find any other approaches yet:

f=(image_width/2)/math.tan(camera.yfov) s=0 y0 = image_height/2 x0 = image_width/2

intrinsics = np.array( [[f, s, x0], [0, f, y0], [0, 0, 1]])