ros-industrial / yak

A library for integrating depth images into Truncated Signed Distance Fields.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What's the mean of world_to_camera?

duanyongli opened this issue · comments

Thanks for your nice work!
I wonder the meaning of world_to_camera.
To put it bluntly, whether world_to_camera transform a point in camera frame to world frame, or vice versa.

If world_to_camera means transform a point in camera frame to world frame, then the motion formula may be:
Eigen::Affine3f motion = last_camera_pose_.inverse() * current_camera_in_volume;

The names of transforms in this package should follow a consistent pattern that shows the direction of the transformation. Reading through the section of code that you linked, we probably need to rename some of the result transforms to be as clear as possible.

For the transform world_to_camera, it will transform a point in the world frame to the camera frame. We follow a pattern where transforms named X_to_Y transform from frame X to frame Y. The volume_to_world_ transform also works in the same way, so if we chain them together like this:

const Eigen::Affine3f current_camera_in_volume = volume_to_world_ * world_to_camera;

It results in a transform from the TSDF volume frame to the camera frame.

The names of transforms in this package should follow a consistent pattern that shows the direction of the transformation. Reading through the section of code that you linked, we probably need to rename some of the result transforms to be as clear as possible.

For the transform world_to_camera, it will transform a point in the world frame to the camera frame. We follow a pattern where transforms named X_to_Y transform from frame X to frame Y. The volume_to_world_ transform also works in the same way, so if we chain them together like this:

const Eigen::Affine3f current_camera_in_volume = volume_to_world_ * world_to_camera;

It results in a transform from the TSDF volume frame to the camera frame.

Thanks for your reply, but I'm still confused about the transformation.

  1. the meaning of motion
    Eigen::Affine3f motion = current_camera_in_volume * last_camera_pose_.inverse();
    current_camera_in_volume stands for volume_to_cameraNew.
    last_camera_pose_ stands for volume_to_cameraOld, then last_camera_pose_.inverse() means cameraOld_to_volume.
    then motion = volume_to_cameraNew * cameraOld_to_volume, I think the matrix multiplication is wrong.
    motion may be calucated through cameraNew_to_volume * volume_to_cameraOld

  2. vol2cam
    Affine3f vol2cam = camera_motion_tform.inv() * pose_;
    vol2cam must be used to transfrom voxel coordinate from volume frame to camera frame,
    so camera_motion_tform must stands for camera_to_volume.
    Through function call, I think camera_motion_tform is passed by current_camera_in_volume.
    However, current_camera_in_volume means volume_to_camera.
    That is conflict!

@duanyongli: Do you mean?

// we want volume to camera
const Eigen::Affine3f current_camera_in_volume = world_to_camera * volume_to_world_;

Eigen::Affine3f motion = current_camera_in_volume.inverse() * last_camera_pose_;

cc @schornakj