Files
nerfstudio/docs/model_components/visualize_cameras.ipynb
T
Ethan Weber 6879a8a9bd Reorganizing docs for pipeline restructure (#279)
* starting docs for pipelines

* working on an example

* clearing output

* starting to implement config changes and add documentation

* removing diff

* format

* templated pipeline notebook a bit

* black
2022-08-16 12:10:24 -07:00

4.2 MiB

Camera Models

Everything starts with the cameras. Given a set of images, we need a way to project their pixels into 3D space. This is accomplished by computing the camera ray for each pixel given information about the type of camera and the location of the camera. This guide describes the camera models implemented in Nerfactory.

Each image should have an associated pose which consists of two properties, intrinsic and extrinsic parameters.

Intrinsics
All of the parameters internal to the camera such as lense or sensor properties.
Extrinsics
All of the parameters external to the camera such as the location and rotation relative to the world frame.
In [1]:
# HIDDEN
import torch
from nerfactory.cameras import cameras
import plotly.graph_objects as go
import mediapy as media

(pinhole)=

Pinhole Camera Model

The simplest and most used camera model. Most standard cameras can be sufficiently approximated using the pinhole camera model.

Intrinsic Description
cx Number of pixels in the x dimension
cy Number of pixels in the y dimension
fx Focal length in the x dimension
fy Focal length in the y dimension
In [2]:
# COLLAPSED
from nerfactory.cameras import cameras
from nerfactory.utils import plotly as vis

cx = 20
cy = 10
fx = 20
fy = 20

camera = cameras.PinholeCamera(cx, cy, fx, fy)
fig = vis.vis_camera_rays(camera)
fig.show()

(equirectangular)=

Equirectangular (360°) Camera Models

An Equirectangular camera images the scene in all directions at the same time.

Intrinsic Description
height Number of rows in the image
width Number of columns in the image
In [3]:
# COLLAPSED
from nerfactory.cameras import cameras

height = 10
width = 30

camera = cameras.EquirectangularCamera(height=height, width=width)
fig = vis.vis_camera_rays(camera)
fig.show()