pbrt-v4 icon indicating copy to clipboard operation
pbrt-v4 copied to clipboard

Focal length, Pixel Size of Perspective Camera

Open varun19299 opened this issue 4 years ago • 6 comments

I'm trying to calculate the intrinsic matrix used by the Perspective cameras. I need to determine:

  • focal length
  • Pixel Size (in metres).

I think the latter can be computed using the diagonal size and resolution under Film. But I haven't been able to find the default focal length used.

Finally, is it assumed that the camera centre lies directly above the image centre?

varun19299 avatar Jan 28 '21 11:01 varun19299

Maybe I can just use the FOV as indicated here?

https://github.com/mmp/pbrt-v3/issues/255

varun19299 avatar Jan 29 '21 08:01 varun19299

I'm also assuming square pixels are used, is this correct?

varun19299 avatar Jan 29 '21 08:01 varun19299

Pixels are indeed square. It uses a standard perspective projection with the specified FOV.

mmp avatar Feb 09 '21 01:02 mmp

Thanks for the reply!

I derived the intrinsic and extrinsic matrices using the scene file, assuming:

  • default film diagonal is 35 mm
  • FOV is used to determine focal length. FOV = 2 * arctan(shorter_side/2f).
  • Here, FOV is the minimum FOV of the two sides.
  • Extrinsics got from LookAt etc

I tested this on a structured light simulation (of a sphere of radius 1m).

Unfortunately, the reconstruction is skewed in the axis: (ellipsoid instead of a sphere)

image

(I'm still determining if the error lies on the reconstruction side or the intrinsics).

varun19299 avatar Feb 09 '21 01:02 varun19299

Hi.. I have some issues in Blender, but not at this level. I use this formule, that is not perfect, of course

aspect = 1.0 if (sizeX > sizeY) else (sizeX / sizeY)
fov = focal_lenght / aspect

camera_fov

pbrt4bounty avatar Feb 09 '21 13:02 pbrt4bounty

I have a similar problem to yours.I need to use PBRT to simulate an image taken by a real camera. I already know the intrinsic matrix of the real camera and how to set the intrinsic matrix parameters of the camera in PBRT.

qihang1019 avatar Jun 29 '21 07:06 qihang1019