mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 14:58:55 +08:00
camera/plugin docs (#2412)
* api docs for cameras & plugins * fix docstrings
This commit is contained in:
1 parent
6af0bcfbf8
commit
06e59ed1ec
5 files changed
+97
-19
No files matched your search
@@ -519,21 +519,24 @@ def auto_orient_and_center_poses(
|
||||
method: Literal["pca", "up", "vertical", "none"] = "up",
|
||||
center_method: Literal["poses", "focus", "none"] = "poses",
|
||||
) -> Tuple[Float[Tensor, "*num_poses 3 4"], Float[Tensor, "3 4"]]:
|
||||
"""Orients and centers the poses. We provide two methods for orientation: pca and up.
|
||||
"""Orients and centers the poses.
|
||||
|
||||
pca: Orient the poses so that the principal directions of the camera centers are aligned
|
||||
We provide three methods for orientation:
|
||||
|
||||
- pca: Orient the poses so that the principal directions of the camera centers are aligned
|
||||
with the axes, Z corresponding to the smallest principal component.
|
||||
This method works well when all of the cameras are in the same plane, for example when
|
||||
images are taken using a mobile robot.
|
||||
up: Orient the poses so that the average up vector is aligned with the z axis.
|
||||
- up: Orient the poses so that the average up vector is aligned with the z axis.
|
||||
This method works well when images are not at arbitrary angles.
|
||||
vertical: Orient the poses so that the Z 3D direction projects close to the
|
||||
- vertical: Orient the poses so that the Z 3D direction projects close to the
|
||||
y axis in images. This method works better if cameras are not all
|
||||
looking in the same 3D direction, which may happen in camera arrays or in LLFF.
|
||||
|
||||
There are two centering methods:
|
||||
poses: The poses are centered around the origin.
|
||||
focus: The origin is set to the focus of attention of all cameras (the
|
||||
|
||||
- poses: The poses are centered around the origin.
|
||||
- focus: The origin is set to the focus of attention of all cameras (the
|
||||
closest point to cameras optical axes). Recommended for inward-looking
|
||||
camera configurations.
|
||||
|
||||
|
||||
@@ -329,25 +329,27 @@ class Cameras(TensorDataclass):
|
||||
|
||||
This function will standardize the input arguments and then call the _generate_rays_from_coords function
|
||||
to generate the rays. Our goal is to parse the arguments and then get them into the right shape:
|
||||
- camera_indices: (num_rays:..., num_cameras_batch_dims)
|
||||
- coords: (num_rays:..., 2)
|
||||
- camera_opt_to_camera: (num_rays:..., 3, 4) or None
|
||||
- distortion_params_delta: (num_rays:..., 6) or None
|
||||
|
||||
- camera_indices: (num_rays:..., num_cameras_batch_dims)
|
||||
- coords: (num_rays:..., 2)
|
||||
- camera_opt_to_camera: (num_rays:..., 3, 4) or None
|
||||
- distortion_params_delta: (num_rays:..., 6) or None
|
||||
|
||||
Read the docstring for _generate_rays_from_coords for more information on how we generate the rays
|
||||
after we have standardized the arguments.
|
||||
|
||||
We are only concerned about different combinations of camera_indices and coords matrices, and the following
|
||||
are the 4 cases we have to deal with:
|
||||
1. isinstance(camera_indices, int) and coords == None
|
||||
- In this case we broadcast our camera_indices / coords shape (h, w, 1 / 2 respectively)
|
||||
2. isinstance(camera_indices, int) and coords != None
|
||||
- In this case, we broadcast camera_indices to the same batch dim as coords
|
||||
3. not isinstance(camera_indices, int) and coords == None
|
||||
- In this case, we will need to set coords so that it is of shape (h, w, num_rays, 2), and broadcast
|
||||
all our other args to match the new definition of num_rays := (h, w) + num_rays
|
||||
4. not isinstance(camera_indices, int) and coords != None
|
||||
- In this case, we have nothing to do, only check that the arguments are of the correct shape
|
||||
|
||||
1. isinstance(camera_indices, int) and coords == None
|
||||
- In this case we broadcast our camera_indices / coords shape (h, w, 1 / 2 respectively)
|
||||
2. isinstance(camera_indices, int) and coords != None
|
||||
- In this case, we broadcast camera_indices to the same batch dim as coords
|
||||
3. not isinstance(camera_indices, int) and coords == None
|
||||
- In this case, we will need to set coords so that it is of shape (h, w, num_rays, 2), and broadcast
|
||||
all our other args to match the new definition of num_rays := (h, w) + num_rays
|
||||
4. not isinstance(camera_indices, int) and coords != None
|
||||
- In this case, we have nothing to do, only check that the arguments are of the correct shape
|
||||
|
||||
There is one more edge case we need to be careful with: when we have "jagged cameras" (ie: different heights
|
||||
and widths for each camera). This isn't problematic when we specify coords, since coords is already a tensor.
|
||||
|
||||
Reference in new issue
Block a user