utiasSTARS / pykitti

Python tools for working with KITTI data.
MIT License
1.14k stars 239 forks source link

Compute the velodyne to rectified camera coordinate transforms #35

Closed C-MEN closed 5 years ago

C-MEN commented 5 years ago

May I ask why transformation matrix for velodyne to camera X is

data['T_camX_velo'] = TX.dot(R_rect_00.dot(T_cam0unrect_velo))

instead of

data['T_camX_velo'] = PrectX0.dot(R_rect_00.dot(T_cam0unrect_velo)) ?

leeclemnet commented 5 years ago

The matrix P_rectX0 tells you the relationship between rectified 2D coordinates on the cam0 image plane and rectified 2D coordinates on the camX image plane. If you look at Equation 4 in the KITTI dataset IJRR paper, you'll see that P_rectX0 is made up of the pinhole camera intrinsics and the baseline of the stereo pair so that it can be used for this operation (Equations 5 & 7).

In contrast, T_camXvelo tells you the relationship between 3D coordinates in the cam0 reference frame and 3D coordinates in the camX reference frame. You'll notice in the code that the transformation matrix TX is defined to be the identity matrix with a translation in the x-direction corresponding to the stereo baseline for the camera pair. The stereo baseline is easily recovered from P_rectX0 by dividing two of its entries.