Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding function prealign_cameras #92

Open
cmh1027 opened this issue May 15, 2024 · 0 comments
Open

Question regarding function prealign_cameras #92

cmh1027 opened this issue May 15, 2024 · 0 comments

Comments

@cmh1027
Copy link

cmh1027 commented May 15, 2024

def prealign_cameras(pose, pose_GT):
    pose, pose_GT = pose.float(), pose_GT.float()
    center = torch.zeros(1, 1, 3)
    center_pred = camera.cam2world(center, pose)[:, 0]  # [N,3]
    center_GT = camera.cam2world(center, pose_GT)[:, 0]  # [N,3]
    sim3 = camera.procrustes_analysis(center_GT, center_pred)
    center_aligned = (center_pred - sim3.t1) / sim3.s1 @ sim3.R.t() * sim3.s0 + sim3.t0
    R_aligned = pose[..., :3] @ sim3.R.t()
    t_aligned = (-R_aligned @ center_aligned[..., None])[..., 0]
    aligned_pose = camera.pose(R=R_aligned, t=t_aligned)
    return aligned_pose, sim3

It seems that the parameters pose and pose_GT are c2w.
However, when I see camera.cam2world method, it seems that its input is w2c because Pose().invert(pose) should be c2w.

def cam2world(X,pose):
    X_hom = to_hom(X)
    pose_inv = Pose().invert(pose)
    return X_hom@pose_inv.transpose(-1,-2)

Could you clarify which one is wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant