camera/plugin docs (#2412)

* api docs for cameras & plugins

* fix docstrings
This commit is contained in:
drewgilliam authored and GitHub committed 2023-09-08 09:14:16 -07:00
1 parent 6af0bcfbf8
commit 06e59ed1ec
5 files changed
+97 -19

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
.. _cameras:
Cameras
============
Cameras
----------------
.. automodule:: nerfstudio.cameras.cameras
:members:
:show-inheritance:
Camera Optimizers
-----------------
.. automodule:: nerfstudio.cameras.camera_optimizers
:members:
:show-inheritance:
Camera Paths
----------------
.. automodule:: nerfstudio.cameras.camera_paths
:members:
:show-inheritance:
Camera Utils
----------------
.. automodule:: nerfstudio.cameras.camera_utils
:members:
:show-inheritance:
Lie Groups
----------------
.. automodule:: nerfstudio.cameras.lie_groups
:members:
:show-inheritance:
Rays
----------------
.. automodule:: nerfstudio.cameras.rays
:members:
:show-inheritance:
+2
View File
@@ -7,6 +7,7 @@ TODO: Explanation of each component
.. toctree:: .. toctree::
cameras
config config
data/index data/index
fields fields
@@ -14,5 +15,6 @@ TODO: Explanation of each component
models models
model_components/index model_components/index
optimizers optimizers
plugins
utils/index utils/index
viewer viewer
+25
View File
@@ -0,0 +1,25 @@
.. _plugins:
Plugins
============
Method Registry
----------------------
.. automodule:: nerfstudio.plugins.registry
:members:
:show-inheritance:
DataParser Registry
----------------------
.. automodule:: nerfstudio.plugins.registry_dataparser
:members:
:show-inheritance:
Types
----------------------
.. automodule:: nerfstudio.plugins.types
:members:
:show-inheritance:
+9 -6
View File
@@ -519,21 +519,24 @@ def auto_orient_and_center_poses(
method: Literal["pca", "up", "vertical", "none"] = "up", method: Literal["pca", "up", "vertical", "none"] = "up",
center_method: Literal["poses", "focus", "none"] = "poses", center_method: Literal["poses", "focus", "none"] = "poses",
) -> Tuple[Float[Tensor, "*num_poses 3 4"], Float[Tensor, "3 4"]]: ) -> 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. 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 This method works well when all of the cameras are in the same plane, for example when
images are taken using a mobile robot. 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. 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 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. looking in the same 3D direction, which may happen in camera arrays or in LLFF.
There are two centering methods: 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 closest point to cameras optical axes). Recommended for inward-looking
camera configurations. camera configurations.
+15 -13
View File
@@ -329,25 +329,27 @@ class Cameras(TensorDataclass):
This function will standardize the input arguments and then call the _generate_rays_from_coords function 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: 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_indices: (num_rays:..., num_cameras_batch_dims)
- camera_opt_to_camera: (num_rays:..., 3, 4) or None - coords: (num_rays:..., 2)
- distortion_params_delta: (num_rays:..., 6) or None - 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 Read the docstring for _generate_rays_from_coords for more information on how we generate the rays
after we have standardized the arguments. after we have standardized the arguments.
We are only concerned about different combinations of camera_indices and coords matrices, and the following 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: 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) 1. isinstance(camera_indices, int) and coords == None
2. isinstance(camera_indices, int) and coords != None - In this case we broadcast our camera_indices / coords shape (h, w, 1 / 2 respectively)
- In this case, we broadcast camera_indices to the same batch dim as coords 2. isinstance(camera_indices, int) and coords != None
3. not isinstance(camera_indices, int) and coords == None - In this case, we broadcast camera_indices to the same batch dim as coords
- In this case, we will need to set coords so that it is of shape (h, w, num_rays, 2), and broadcast 3. not isinstance(camera_indices, int) and coords == None
all our other args to match the new definition of num_rays := (h, w) + num_rays - In this case, we will need to set coords so that it is of shape (h, w, num_rays, 2), and broadcast
4. not isinstance(camera_indices, int) and coords != None all our other args to match the new definition of num_rays := (h, w) + num_rays
- In this case, we have nothing to do, only check that the arguments are of the correct shape 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 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. and widths for each camera). This isn't problematic when we specify coords, since coords is already a tensor.