# 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 specified as
[`intrinsics`

= cameraIntrinsics(`focalLength`

,`principalPoint`

,`imageSize`

)*fx*,*fy*], and the camera's principal point
specified as [*cx*, *cy*]. See `cameraParameters`

for more details.

uses additional options specified by one or name-value pairs. Enclose each property name
in quotes. For example, `intrinsics`

= cameraIntrinsics(___,`Name,Value`

)```
intrinsics =
cameraIntrinsics('RadialDistortion',[0,0])
```

### Input Arguments

`focalLength`

— Camera focal length

two-element vector

Camera focal length, specified as a two-element vector, [*fx*,
*fy*].

$${f}_{x}=F\times sx$$

$${f}_{y}=F\times sy$$

*F*is the focal length in world units, typically millimeters[

*sx*,*sy*] are the number of pixels per world unit in the x and y direction respectively*fx*and*fy*are in pixels

`principalPoint`

— Optical center of camera

two-element vector

Optical center of camera, specified as a two-element vector,
[*cx*,*cy*], in pixels.

`imageSize`

— Image size produced by the camera

two-element vector

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

## Properties

`RadialDistortion`

— Radial lens distortion

`[0,0]`

(default) | two-element vector | three-element vector

Radial lens distortion, specified as the comma-separated pair consisting of
`RadialDistortion`

and a two-element vector,
[*k1*,*k2*], or a three-element vector,
[*k1*,*k2*,*k3*].
*k1*,*k2*, and *k3* are radial
distortion coefficients. Radial distortion occurs when light rays bend more near the
edges of a lens than they do at its optical center. The smaller the lens, the greater
the distortion.

Radial distortion occurs when light rays bend more near the edges of a lens than they do at its optical center. The smaller the lens, the greater the distortion.

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

x_{distorted} =
x(1 +
k_{1}*r^{2}
+
k_{2}*r^{4}
+
k_{3}*r^{6})
| (1) |

y_{distorted}=
y(1 +
k_{1}*r^{2}
+
k_{2}*r^{4}
+
k_{3}*r^{6})
| (2) |

x, y = undistorted pixel
locations |

k_{1},
k_{2}, and
k_{3} = radial distortion coefficients of
the lens |

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

*k*

_{3}. The undistorted pixel locations appear in normalized image coordinates, with the origin at the optical center. The coordinates are expressed in world units.

`TangentialDistortion`

— Tangential distortion coefficients

`[0,0]`

(default) | two-element vector

Tangential distortion coefficients, specified as the comma-separated pair consisting
of '`TangentialDistortion`

' and 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})] | (3) |

y_{distorted} =
y + [p_{1} *
(r^{2} +
2*y^{2}) + 2 *
p_{2} * x *
y] | (4) |

x, y = undistorted pixel
locations |

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

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

`Skew`

— Camera axes skew

`0`

(default) | angle

Camera axes skew, specified as the comma-separated pair consisting of
'`skew`

' and an angle. If the *x* and the
*y* axes are exactly perpendicular, then the skew must be
`0`

.

`FocalLength`

— Focal length

2-element vector

This property is read-only.

Focal length in *x* and *y*, stored as a 2-element
vector [*fx*, *fy*] in pixels.

fx = F * sx |

fy = F * sy |

*sx*,

*sy*] are the number of pixels per world unit in the

*x*and

*y*direction respectively. Thus,

*fx*and

*fy*are in pixels.

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.

`PrincipalPoint`

— Optical center of camera

two-element vector

This property is read-only.

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.

`ImageSize`

— Image size produced by the camera

two-element vector

This property is read-only.

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

`IntrinsicMatrix`

— Projection matrix

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

This property is read-only.

Projection matrix, stored as the comma-separated pair consisting of
'`IntrinsicMatrix`

' and a 3-by-3 matrix. For the matrix format, the
object uses the following format:

$$\left[\begin{array}{ccc}{f}_{x}& 0& 0\\ s& {f}_{y}& 0\\ {c}_{x}& {c}_{y}& 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_{x},
s_{y}] are the number of pixels per world
unit in the 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 IntrinsicMatrix: [3x3 double]

## Extended Capabilities

### C/C++ Code Generation

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

## See Also

### Apps

### Objects

### Functions

**Introduced in R2017a**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## 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)