Files
nerfstudio/docs/notebooks/visualize_cameras.ipynb
T
evonneng 3cb44f3a8e doc refactoring (#267)
* reformatted docs; moved visualizer section; added references to top; hiding some doctrees etc.

* changed realtime viewer tab
2022-08-10 16:15:44 -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()