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.


All of the parameters internal to the camera such as lense or sensor properties.


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.




Number of pixels in the x dimension


Number of pixels in the y dimension


Focal length in the x dimension


Focal length in the y dimension

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)