mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 05:48:57 +08:00
[Fix] convert camera_idx to tensor (#2890)
convert camera_idx to tensor
This commit is contained in:
1 parent
1d070f5625
commit
efa91e5df7
1 file changed
+1
-1
@@ -157,7 +157,7 @@ class CameraOptimizer(nn.Module):
|
|||||||
assert camera.metadata is not None, "Must provide id of camera in its metadata"
|
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"
|
assert "cam_idx" in camera.metadata, "Must provide id of camera in its metadata"
|
||||||
camera_idx = camera.metadata["cam_idx"]
|
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)
|
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)
|
camera.camera_to_worlds = torch.bmm(camera.camera_to_worlds, adj)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user