kitti360Scripts icon indicating copy to clipboard operation
kitti360Scripts copied to clipboard

How do I transfer both velodyne and pose to the camera coordinate system?

Open Lee-JaeWon opened this issue 2 years ago • 3 comments

I hope that both the pos and velodyne are represented in the camera coordinate system "Perspective cameras (image_00, image_01): x = right, y = down, z = forward"

But I don't know what to do. Velodyne data was performed with inv(cam_to_velo), The poses.txt data also moved the coordinate system through inv(cam_to_pose)

It doesn't work very well.

Thank you for your answer.

Lee-JaeWon avatar Feb 02 '24 02:02 Lee-JaeWon

Hi, here you can find how to convert the Velodyne data to the camera view: https://github.com/autonomousvision/kitti360Scripts/blob/master/kitti360scripts/viewer/kitti360Viewer3DRaw.py#L232

Let me know if this does not address your question.

yiyiliao avatar Feb 04 '24 09:02 yiyiliao

@yiyiliao

Thank you for your response.

I kept referring to that code as well.

Thanks to this, the process of projecting velodyne points to the image was successful.

However, i am trying now accumulate these velodyne points depending on the corresponding position (cam0_to_world.txt).

So I tried it as below,

I felt that the image and the coordinate system didn't fit when I multiplied it by the pos.

Am I doing it right?

'velo' is pure velodyne points from .bin, Tr_velo_to_camis np.inv(cam_to_velo). 'trans_cam_to_world' is the poses taken directly from cam0_to_world.txt

            TF_points = (R0_rect.dot(Tr_velo_to_cam.dot(velo)).T)
                    
            trans_cam_to_world = self.get_poses()

            campose = np.array(trans_cam_to_world[idx]).reshape(3, 4)
            campose = np.vstack((campose,np.array([0,0,0,1])))

            points = np.matmul(TF_points, campose.T)

Lee-JaeWon avatar Feb 04 '24 11:02 Lee-JaeWon

Hi, you can refer to the code we provided in C++ for accumulation: https://github.com/autonomousvision/kitti360Scripts/blob/9defe218f4d05a1c920924f38ebfa8efc27318da/kitti360scripts/devkits/accumuLaser/src/accumulation.cpp#L460-L472

Note that the raw velodyne points should be corrected for ego-motion (CurlVelodyneData).

yiyiliao avatar Feb 15 '24 05:02 yiyiliao