Retrieve camera intrinsics from PyRender PerspectiveVamera

136 views Asked by At

With PyRender, 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]])
1

There are 1 answers

0
Christoph Rackwitz On BEST ANSWER

Close enough. Your equation for f has the right shape. Minor issues.

You're

  • mixing up x/y and width/height
  • missing a /2 inside of the tan()
  • and some -1 in the cx,cy which should exactly be (width-1)/2, (height-1)/2

And ignore the shearing, everyone else does.