Skip to content

Commit

Permalink
[Fix] convert camera_idx to tensor (#2890)
Browse files Browse the repository at this point in the history
convert camera_idx to tensor
  • Loading branch information
tobiasfshr authored Feb 9, 2024
1 parent 1d070f5 commit efa91e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nerfstudio/cameras/camera_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def apply_to_camera(self, camera: Cameras) -> None:
assert camera.metadata is not None, "Must provide id of camera in its metadata"
assert "cam_idx" in camera.metadata, "Must provide id of camera in its metadata"
camera_idx = camera.metadata["cam_idx"]
adj = self([camera_idx]) # type: ignore
adj = self(torch.tensor([camera_idx], dtype=torch.long, device=camera.device)) # type: ignore
adj = torch.cat([adj, torch.Tensor([0, 0, 0, 1])[None, None].to(adj)], dim=1)
camera.camera_to_worlds = torch.bmm(camera.camera_to_worlds, adj)

Expand Down

0 comments on commit efa91e5

Please sign in to comment.