utiasSTARS / pykitti

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

R_rect_00 missing from loaded odometry calibration data #72

Open owlshrimp opened 1 year ago

owlshrimp commented 1 year ago

Hello,

I am trying to project velodyne (and eventually SLAM) 3D points to 2D image coordinates (say, for camera 0) for the kitti odometry dataset. https://www.cvlibs.net/datasets/kitti/eval_odometry.php

From [1] page 4-5, the appropriate stackup of matrices for projecting velodyne data seems to be: 2D_point = P_rect_00 R_rect_00 T_cam0_velo * 3D_velo_point

However, this doesn't seem to directly apply to the odometry dataset. For example: dataset_path = "......../dataset" sequence = '00' dataset = pykitti.odometry(dataset_path, sequence, frames=range(0, 20, 5)) print("dataset.P_rect_00:\n{}".format(dataset.calib.P_rect_00)) # prints out a 3x4 matrix print("dataset.R_rect_00:\n{}".format(dataset.calib.R_rect_00)) # throws an error because R_rect_00 doesn't exist

Simply put, https://github.com/utiasSTARS/pykitti/blob/master/pykitti/raw.py defines P_rect_00, R_rect_00, T_cam0_velo, and K_cam0 Meanwhile, https://github.com/utiasSTARS/pykitti/blob/master/pykitti/odometry.py only defines P_rect_00, T_cam0_velo, and K_cam0

From the latter, R_rect_00 is missing. Is this term somehow folded into the other matrices, or otherwise not needed? ie: 2D_point = P_rect_00 T_cam0_velo 3D_velo_point

Should it be grabbed from the raw API? (it's not immediately clear to me which R_rect_00 should be used, if so)

It would be very helpful if someone could shed light on this, as it seems projection of 3D points to 2D for the odometry dataset specifically is completely undocumented on the internet.

Thanks, -Matthew

[1] https://www.cvlibs.net/publications/Geiger2013IJRR.pdf Vision meets Robotics: The KITTI Dataset https://www.cvlibs.net/publications/Geiger2012CVPR.pdf is sparse on equivalent instructions.

owlshrimp commented 1 year ago

I did also notice that there exists "Compute the rectified extrinsics from cam0 to camN" on line 166: https://github.com/utiasSTARS/pykitti/blob/master/pykitti/odometry.py#L166 which is used (only) in the computation of T_cam1_velo/T_cam2_velo/T_cam2_velo and not made directly available. It is derived from P_rect_xx.

I can only guess that maybe the rectification has already been done or is already incorporated into the odometry dataset's data? That would suggest that perhaps R_rect_00 could be skipped over as above?