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 nerfstudio.

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.

Perspective 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

# COLLAPSED
from nerfstudio.cameras.cameras import Cameras, CameraType
from nerfstudio.utils import plotly_utils as vis

cx = 20.0
cy = 10.0
fx = 20.0
fy = 20.0

c2w = torch.eye(4)[None, :3, :]

camera = Cameras(fx=fx, fy=fy, cx=cx, cy=cy, camera_to_worlds=c2w, camera_type=CameraType.PERSPECTIVE)
fig = vis.vis_camera_rays(camera)
fig.show()