Camera.intrinsic_matrix

Camera.intrinsic_matrix#

property Camera.intrinsic_matrix: NumpyArray[float][source]#

Return or set the pinhole intrinsic matrix of the camera.

The matrix is [[fx, 0, cx], [0, fy, cy], [0, 0, 1]] in pixels, as reported by a camera calibration such as cv2.calibrateCamera, with cy measured from the top of the image. It describes the image the camera renders, so it is expressed in the pixel size of the viewport and changes with it. Axis skew cannot be represented and must be zero.

Setting the matrix gives the camera a perspective projection.

The camera has to belong to a plotter, which is what gives it an image to be calibrated for. Resetting the camera, as reset_camera() and the view directions do, restores its default field of view and discards fx and fy. The principal point is kept.

Added in version 0.50.

Examples#

Download Python source code | Download Jupyter notebook

A camera renders a square-pixel image centered on the optical axis until it is given a calibration.

>>> import numpy as np
>>> import pyvista as pv
>>> pl = pv.Plotter(window_size=(640, 480))
>>> pl.camera.intrinsic_matrix.round(3)
array([[895.692,   0.   , 320.   ],
       [  0.   , 895.692, 240.   ],
       [  0.   ,   0.   ,   1.   ]])
>>> pl.camera.intrinsic_matrix = np.array(
...     [[800.0, 0.0, 310.0], [0.0, 760.0, 250.0], [0.0, 0.0, 1.0]]
... )
>>> pl.camera.intrinsic_matrix
array([[800.,   0., 310.],
       [  0., 760., 250.],
       [  0.,   0.,   1.]])

See Also#

extrinsic_matrix
window_center
explicit_aspect_ratio