princeton-vl / DeepV2D

BSD 3-Clause "New" or "Revised" License
653 stars 93 forks source link

Intrinsics file - what do numbers mean? #5

Closed cgebbe closed 4 years ago

cgebbe commented 5 years ago

In all kitti demo sequences there is a file called "intrinsics.txt" with four numbers. What do they mean, why are they necessary and where do you get the values from?

If I followed the code correctly, they refer to fx, fy, cx, cy (see camera.py, line50) and you need them to reproject 2d points to 3d. This makes sense to me. But how do you get those values? In my understanding, Kitti raw provides the camera intrinsic matrix in the files "calib_cam_to_cam.txt" in lines starting with "K_0". It also provides the projection matrix directly in lines starting with "P_0". But the values specified there significantly differ from the values in the "intrinsics.txt" file. In particular, fx is approximately equal to fy in "calib_cam_to_cam.txt", whereas in the "intrinsics.txt" file, the first and second value differ by ~10% ?!

zachteed commented 5 years ago

These values are used to construct the intrinsic matrix. They are estimated using camera calibration and generally supplied with the datasets. The intrinsics are different because we are cropping and resizing the images. Cropping and scaling images changes the intrinsic parameters. You can see how the intrinsics are being modified in https://github.com/princeton-vl/DeepV2D/blob/c786c6d6c3f82e07c061df63705281bd7356cf73/lib/data_stream/kitti.py#L194

cgebbe commented 5 years ago

Ah, thanks for the answer! :)