# cameraIntrinsics

Object for storing intrinsic camera parameters

## Description

Store information about a camera’s intrinsic calibration parameters, including the lens distortion parameters.

## Creation

### Syntax

### Description

returns a camera intrinsics object that contains the focal length and the camera's
principal point. The three input arguments set the FocalLength, PrincipalPoint, and ImageSize properties, respectively.`intrinsics`

= cameraIntrinsics(`focalLength`

,`principalPoint`

,`imageSize`

)

sets additional properties
using one or name-value pairs. Enclose each property name in quotes.`intrinsics`

= cameraIntrinsics(`focalLength`

,`principalPoint`

,`imageSize`

,`Name,Value`

)

For example, ```
intrinsics =
cameraIntrinsics(focalLength,principalPoint,imageSize,"RadialDistortion",[0
10])
```

sets the radial lens distortion property,
`RadialDistortion`

, as the vector `[0 10]`

.

## Properties

`FocalLength`

— Focal length

2-element vector

Focal length in *x* and *y*, stored as a 2-element
vector [*f _{x}*

*f*] in pixels.

_{y}*f _{x}* =

*F**

*s*

_{x}*f _{y}* =

*F**

*s*

_{y}*F* is the focal length in world units, typically in millimeters.
*s _{x}* and

*s*are the number of pixels per world unit in the

_{y}*x*and

*y*direction respectively. Thus,

*f*and

_{x}*f*are in pixels.

_{y}The focal length *F* influences the angle of view and thus affects
the area of the scene that appears focused in an image. For a fixed subject distance:

A short focal length offers a wide angle of view allowing to capture large area of the scene under focus. It emphasizes both the subject and the scene background.

A long focal length offers a narrow angle of view, thus reducing the area of the scene under focus. It emphasizes more on the subject and restricts the amount of background from being captured.

You cannot set the value of `FocalLength`

after you create the
`cameraIntrinsics`

object.

`PrincipalPoint`

— Optical center of camera

two-element vector

Optical center of camera, stored as a two-element vector [*cx*
*cy*] in pixels. The vector contains the coordinates of the optical
center of the camera.

You cannot set the value of `PrincipalPoint`

after you create the
`cameraIntrinsics`

object.

`ImageSize`

— Image size produced by the camera

two-element vector

Image size produced by the camera, stored as a two-element vector,
[*mrows*
*ncols*].

You cannot set the value of `ImageSize`

after you create the
`cameraIntrinsics`

object.

`RadialDistortion`

— Radial lens distortion coefficients

`[0 0]`

(default) | 2-element vector | 3-element vector | 6-element vector

Radial lens distortion coefficients, specified as a 2-, 3-, or 6-element vector.

2-element vector — [

*k1**k2*].3-element vector — [

*k1**k2**k3*].6-element vector — [

*k1**k2**k3**k4**k5**k6*].

Radial distortion is the displacement of image points along radial lines extending from the principal point.

As image points move away from the principal point (positive radial displacement), image magnification decreases and a pincushion-shaped distortion occurs on the image.

As image points move toward the principal point (negative radial displacement), image magnification increases and a barrel-shaped distortion occurs on the image.

The camera parameters object calculates the radial-distorted location of a point,
denoted as (*x*_{distorted},
*y*_{distorted}):

$${x}_{distorted}=x\left(\frac{1+{k}_{1}*{r}^{2}+{k}_{2}*{r}^{4}+{k}_{3}*{r}^{6}}{1+{k}_{4}*{r}^{2}+{k}_{5}*{r}^{4}+{k}_{6}*{r}^{6}}\right)$$

$${y}_{distorted}=y\left(\frac{1+{k}_{1}*{r}^{2}+{k}_{2}*{r}^{4}+{k}_{3}*{r}^{6}}{1+{k}_{4}*{r}^{2}+{k}_{5}*{r}^{4}+{k}_{6}*{r}^{6}}\right)$$

x, y is a undistorted image point in
normalized image coordinates in world units, with the origin at the optical
center. |

r^{2} =
x^{2} +
y^{2} |

k_{1},
k_{2}, …,
k_{6} are radial distortion coefficients of
the lens. Typically, two coefficients are sufficient and
k_{3}, …,
k_{6} are only needed for wide-angle
lenses. |

`TangentialDistortion`

— Tangential distortion coefficients

`[0 0]`

(default) | two-element vector

Tangential distortion coefficients, specified as a 2-element vector,
[*p*_{1}
*p*_{2}]. Tangential distortion occurs when the
lens and the image plane are not parallel.

The camera parameters object calculates the tangential distorted location of a
point. You can denote the distorted points as
(*x*_{distorted},
*y*_{distorted}), as follows:

*x*_{distorted} = *x* + [2 *
*p*_{1} * *x* *
*y* + *p*_{2} *
(*r*^{2} + 2 *
*x*^{2})]

*y*_{distorted} =
*y* + [*p*_{1} *
(*r*^{2} +
2**y*^{2}) + 2 *
*p*_{2} * *x* *
*y*]

x, y are undistorted pixel
locations |

p_{1} and
p_{2} are tangential distortion
coefficients of the lens |

r^{2} =
x^{2} +
y^{2} |

`Skew`

— Camera axes skew

`0`

(default) | numeric scalar

Camera axes skew, specified as a numeric scalar. If the *x* and the
*y* axes are exactly perpendicular, then the skew must be
`0`

.

`K`

— Camera intrinsic matrix

3-by-3 identity matrix (default) | 3-by-3 matrix

This property is read-only.

Camera intrinsic matrix, specified as a 3-by-3 matrix. The matrix has the format

$$\left[\begin{array}{ccc}{f}_{x}& s& {c}_{x}\\ 0& {f}_{y}& {c}_{y}\\ 0& 0& 1\end{array}\right]$$

The coordinates [*c _{x}*

*c*] represent the optical center (the principal point), in pixels. When the

_{y}*x*and

*y*axis are exactly perpendicular, the skew parameter,

*s*, equals

`0`

.*f _{x}* =

*F**

*s*

_{x}

*f _{y}* =

*F**

*s*

_{y}

F is the focal length in world units, typically expressed in
millimeters. |

s and
_{x}s are the number of pixels per world
unit in the _{y}x and y direction respectively. |

f and
_{x}f are expressed in pixels._{y} |

## Examples

### Create an Object Containing Fundamental Camera Parameters

Define camera parameters without lens distortion or skew.

Specify the focal length and principal point in pixels.

focalLength = [800 800]; principalPoint = [320 240]; imageSize = [480 640];

Create a camera intrinsics object.

intrinsics = cameraIntrinsics(focalLength,principalPoint,imageSize)

intrinsics = cameraIntrinsics with properties: FocalLength: [800 800] PrincipalPoint: [320 240] ImageSize: [480 640] RadialDistortion: [0 0] TangentialDistortion: [0 0] Skew: 0 K: [3x3 double]

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

## Version History

**Introduced in R2017a**

### R2024b: Import OpenCV pinhole camera model with six radial distortion coefficients

The `cameraIntrinsics`

has been updated to support
OpenCV pinhole camera model with 6 radial distortion coefficients.

### R2022b: Supports premultiply matrix convention

Starting in R2022b, many Computer Vision Toolbox™ functions create and perform geometric transformations using the premultiply
convention. Accordingly, a property of the `cameraIntrinsics`

object has
changed to support the premultiply convention.

The new

`K`

property replaces the old`IntrinsicMatrix`

property. The value of`K`

is the transpose of`IntrinsicMatrix`

.

For more information, see Migrate Geometric Transformations to Premultiply Convention.

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)