Skip to content

camera parameters #41

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

Open
li1u opened this issue Mar 6, 2025 · 1 comment
Open

camera parameters #41

li1u opened this issue Mar 6, 2025 · 1 comment

Comments

@li1u
Copy link

li1u commented Mar 6, 2025

Excuse me, I see that the camera parameters in your code are adjusted according to the size of the camera. I would like to ask if I want to use the generated camera parameters for reconstruction in other algorithms, not just visualization, what should I do?

@li1u
Copy link
Author

li1u commented Mar 6, 2025

The main problem is that the camera parameters obtained by other methods are completely wrong when reconstructed. My focal is obtained by estimate_focal_knowing_depth, and c2w is obtained by calibrate_camera_pnpransac.

`focals = estimate_focal_knowing_depth(pts3d[0][None].cuda(), valid_first[None].cuda()).cpu().item()

    intrinsics = torch.eye(3,)
    intrinsics[0, 0] = focals
    intrinsics[1, 1] = focals
    intrinsics[0, 2] = w / 2
    intrinsics[1, 2] = h / 2
    intrinsics = intrinsics.cuda()

    focals = torch.Tensor([focals]).reshape(1,).repeat(len(rgbimg))

    y_coords, x_coords = torch.meshgrid(torch.arange(h), torch.arange(w), indexing='ij')
    pixel_coords = torch.stack([x_coords, y_coords], dim=-1).float().cuda()  # [H, W, 2]

    c2ws = []
    for (pr_pt, valid) in zip(pts3d, msk):
        c2ws_i = calibrate_camera_pnpransac(pr_pt.cuda().flatten(0,1)[None], pixel_coords.flatten(0,1)[None], valid.cuda().flatten(0,1)[None], intrinsics[None])
        c2ws.append(c2ws_i[0])

    cams2world = torch.stack(c2ws, dim=0).cpu()  # [N, 4, 4]
    focals = to_numpy(focals)`

Image
As shown in the picture, we actually shot around the object, but the effect shown is that the camera is in the center. Have you used the generated camera parameters?

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