CameraInfo
Image size, camera matrix k, distortion d, rectification r, projection p.
Full docstring
`k`, `r` and `p` are stored as matrices (ROS flattens them to 9, 9 and 12 numbers; converters flatten). Pixel coordinates are (u = column, v = row), x right, y down, z forward. `p` defaults to `[k | 0]` when left out.
Preview
The figure robot_msgs.viz.plot(example) draws for the example below.

Fields
| Name | Type | Default |
|---|---|---|
width | int | required |
height | int | required |
k | Array | required |
d | Array | array([], dtype=float64) |
distortion_model | str | 'plumb_bob' |
r | Array | array([[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]]) |
p | Array | None | None |
header | Header | Header() |
Example
One instance from the package's own test catalog; the output is its real repr().
CameraInfo(width=640, height=480, k=float64[3×3], d=[], distortion_model='plumb_bob', r=float64[3×3], p=float64[3×4], header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'))to_dict() as JSON
{
"_type": "sensor/CameraInfo",
"width": 640,
"height": 480,
"k": {
"dtype": "<f8",
"shape": [3, 3],
"data": [615.0, 0.0, 320.0, 0.0, 615.0, 240.0, 0.0, 0.0, 1.0]
},
"d": {
"dtype": "<f8",
"shape": [0],
"data": []
},
"distortion_model": "plumb_bob",
"r": {
"dtype": "<f8",
"shape": [3, 3],
"data": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
},
"p": {
"dtype": "<f8",
"shape": [3, 4],
"data": [615.0, 0.0, 320.0, 0.0, 0.0, 615.0, 240.0, 0.0, 0.0, 0.0, 1.0, 0.0]
},
"header": {
"_type": "std/Header",
"stamp": 1761600000.25,
"frame_id": "camera_color_optical_frame",
"meta": {}
}
}Long arrays are cut after 16 values and say so with “…”.
Functions
Constructors
Classmethods and staticmethods: ways to build one.
from_intrinsics(
fx: float,
fy: float,
cx: float,
cy: float,
width: int,
height: int,
d: Array | None = None,
header: Header | None = None,
) -> CameraInfoNo docstring.
Properties
Read-only views computed from the fields.
Methods
Return new values; messages are never mutated.
project(points: Array) -> Array(N, 3) points in the camera optical frame → (N, 2) pixels (u, v).
scaled(factor: float) -> CameraInfoIntrinsics for the same image resized by factor (sizes round to whole pixels).
unproject(pixels: Array, depth: Array) -> Array(N, 2) pixels (u, v) with (N,) depth z along the optical axis → (N, 3) points.
to_dict
from Msgto_dict() -> dict[str, Any]JSON-safe dict with a "_type" key; arrays keep their dtype and shape.