mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
1 parent
45db2bcfab
commit
6c2bfad931
2 files changed
+6
-3
No files matched your search
@@ -129,7 +129,10 @@ class RenderStateMachine(threading.Thread):
|
|||||||
|
|
||||||
image_height, image_width = self._calculate_image_res(camera_state.aspect)
|
image_height, image_width = self._calculate_image_res(camera_state.aspect)
|
||||||
|
|
||||||
camera = get_camera(camera_state, image_height, image_width)
|
if self.viewer.include_time:
|
||||||
|
camera = get_camera(camera_state, image_height, image_width, self.viewer.control_panel.time)
|
||||||
|
else:
|
||||||
|
camera = get_camera(camera_state, image_height, image_width)
|
||||||
camera = camera.to(self.viewer.get_model().device)
|
camera = camera.to(self.viewer.get_model().device)
|
||||||
assert isinstance(camera, Cameras)
|
assert isinstance(camera, Cameras)
|
||||||
assert camera is not None, "render called before viewer connected"
|
assert camera is not None, "render called before viewer connected"
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class CameraState:
|
|||||||
|
|
||||||
|
|
||||||
def get_camera(
|
def get_camera(
|
||||||
camera_state: CameraState, image_height: int, image_width: Optional[Union[int, float]] = None
|
camera_state: CameraState, image_height: int, image_width: Optional[Union[int, float]] = None, time: float = 0.0
|
||||||
) -> Cameras:
|
) -> Cameras:
|
||||||
"""Returns the camera intrinsics matrix and the camera to world homogeneous matrix.
|
"""Returns the camera intrinsics matrix and the camera to world homogeneous matrix.
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ def get_camera(
|
|||||||
cy=pp_h,
|
cy=pp_h,
|
||||||
camera_type=camera_state.camera_type,
|
camera_type=camera_state.camera_type,
|
||||||
camera_to_worlds=camera_state.c2w.to(torch.float32)[None, ...],
|
camera_to_worlds=camera_state.c2w.to(torch.float32)[None, ...],
|
||||||
times=torch.tensor([0.0], dtype=torch.float32),
|
times=torch.tensor([time], dtype=torch.float32),
|
||||||
)
|
)
|
||||||
return camera
|
return camera
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user