mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
Export camera path (#398)
* export button working * view changes * adding copy to clipboard feature * camera choice dropdown * going to add script saving next * copy paste working. need to add aspect ratio * aspect overlay kind of working * lint * aspect ratio fixed. version specified * merge * openrelay back
This commit is contained in:
1 parent
f21375ff1b
commit
9bc39d895c
21 files changed
+676
-196
No files matched your search
@@ -43,10 +43,23 @@ def get_chunks(
|
||||
return chunks
|
||||
|
||||
|
||||
def three_js_perspective_camera_focal_length(fov: float, image_height: int):
|
||||
"""Returns the focal length of a three.js perspective camera.
|
||||
|
||||
Args:
|
||||
fov: the field of view of the camera in degrees.
|
||||
image_height: the height of the image in pixels.
|
||||
"""
|
||||
pp_h = image_height / 2.0
|
||||
focal_length = pp_h / np.tan(fov * (np.pi / 180.0) / 2.0)
|
||||
return focal_length
|
||||
|
||||
|
||||
def get_intrinsics_matrix_and_camera_to_world_h(
|
||||
camera_object: Dict[str, Any], image_height: int
|
||||
) -> Tuple[torch.Tensor, torch.Tensor]:
|
||||
"""Returns the camera intrinsics matrix and the camera to world homogeneous matrix.
|
||||
|
||||
Args:
|
||||
camera_object: a Camera object.
|
||||
image_size: the size of the image (height, width)
|
||||
@@ -57,7 +70,7 @@ def get_intrinsics_matrix_and_camera_to_world_h(
|
||||
image_width = aspect * image_height
|
||||
pp_w = image_width / 2.0
|
||||
pp_h = image_height / 2.0
|
||||
focal_length = pp_h / np.tan(fov * (np.pi / 180.0) / 2.0)
|
||||
focal_length = three_js_perspective_camera_focal_length(fov, image_height)
|
||||
intrinsics_matrix = torch.tensor([[focal_length, 0, pp_w], [0, focal_length, pp_h], [0, 0, 1]]).float()
|
||||
|
||||
# extrinsics
|
||||
|
||||
Reference in new issue
Block a user