TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

Module: tfg.rendering.camera.perspective

This module implements perspective camera functionalities.

Defined in rendering/camera/perspective.py.

The perspective camera model, also referred to as pinhole camera model, is defined using a focal length \((f_x, f_y)\) and a principal point \((c_x, c_y)\). The perspective camera model can be written as a calibration matrix

$$ \mathbf{C} = \begin{bmatrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \\ \end{bmatrix}, $$

also referred to as the intrinsic parameter matrix. The camera focal length \((f_x, f_y)\), defined in pixels, is the physical focal length divided by the physical size of a camera pixel. The physical focal length is the distance between the camera center and the image plane. The principal point is the intersection of the camera axis with the image plane. The camera axis is the line perpendicular to the image plane starting at the optical center.

More details about perspective cameras can be found on this page.

Functions

intrinsics_from_matrix(...): Extracts intrinsic parameters from a calibration matrix.

matrix_from_intrinsics(...): Builds calibration matrix from intrinsic parameters.

project(...): Projects a 3d point onto the 2d camera plane.

ray(...): Computes the 3d ray for a 2d point (the z component of the ray is 1).

unproject(...): Unprojects a 2d point in 3d.