Skip to content

[Bug] T matrix incorrectly recomputed from P matrix , causing projection mismatch in full size img #11

@Kyekyekye

Description

@Kyekyekye

Hi team,

I’ve been investigating the geometric projection pipeline in bevlab/datasets.py, and I noticed a possible issue regarding the computation of the camera translation vector T.

Specifically, when testing the projection of Velodyne points to the full-size image using the extracted R_data, T_data, and K_data, I found that the result does not match the expected projection defined by KITTI:

x = P @ Tr @ X

To isolate the issue:

  • I set the augmentation noise to zero:
    pc, trans_dict = revtrans_translation(pc, trans_dict)
    pc, trans_dict = revtrans_rotation(pc, trans_dict)
  • I also disabled any resizing or modification of the camera intrinsics:
    K[0, 0] *= img_w_ratio
    K[0, 2] *= img_w_ratio
    K[1, 1] *= img_h_ratio
    K[1, 2] *= img_h_ratio
    

Under these conditions, I would expect that:

K_data @ (R_data @ pc.T + T_data.reshape(3, 1))

should yield projections that align with x = P @ Tr @ X
However, I observe a consistent shift. Upon inspection, I suspect the issue lies in the following recomputation of T:

tz = T[2]
tx = (P[0, 3] - cx * tz) / fx
ty = (P[1, 3] - cy * tz) / fy
T = np.array([tx, ty, tz])

Would appreciate your confirmation on whether this tx/ty adjustment was intended, or if it may be removed for clarity and correctness.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions