Skip to main content

CameraCalibration

Panel Support

CameraCalibration is used in the 3D Panel and Image Panel.

Field Definitions

Field NameTypeDescription
timestamptimeTimestamp of the calibration data
frame_idstringReference coordinate system of the camera. The origin of this coordinate system is the optical center of the camera, with +x pointing to the right in the image, +y pointing down, and +z pointing into the image plane.
widthuint32Image width
heightuint32Image height
distortion_modelstringDistortion model name
Dfloat64[]Distortion parameters
Kfloat64[9]Intrinsic matrix (3x3 row-major storage)
Rfloat64[9]Rectification matrix (only used for stereo cameras, 3x3 row-major storage)
Pfloat64[12]Projection/camera matrix (3x4 row-major storage)

distortion_model

  • plumb_bob: Parameters are k1, k2, p1, p2, k3
  • rational_polynomial: Parameters are k1, k2, p1, p2, k3, k4, k5, k6

This model is based on OpenCV's pinhole camera model and is consistent with the implementation in ROS.

K Intrinsic Matrix

K is a 3x3 row-major matrix for the original (uncorrected) image.

It uses the focal lengths (fx, fy) and principal point (cx, cy) to project 3D points in the camera coordinate system to 2D pixel coordinates.

    [fx   0  cx]
K = [ 0 fy cy]
[ 0 0 1]

R Rectification Matrix

Rotation matrix that aligns the camera coordinate system with the ideal stereo image plane, making epipolar lines in the two stereo images parallel.

P Projection Matrix

    [fx'  0   cx'  Tx]
P = [ 0 fy' cy' Ty]
[ 0 0 1 0]

This matrix specifies the intrinsic (camera) matrix of the processed (rectified) image. That is, the left 3x3 part is the normal camera intrinsic matrix for the rectified image.

It uses the focal lengths (fx', fy') and principal point (cx', cy') to project 3D points in the camera coordinate system to 2D pixel coordinates — these may differ from the values in K.

For a monocular camera: Tx = Ty = 0, and typically R is the identity matrix with P[1:3,1:3] = K.

For a stereo pair, the fourth column [Tx Ty 0]' relates to the position of the optical center of the second camera in the coordinate system of the first camera. We assume Tz = 0 so that the two cameras are in the same stereo image plane. Tx is always 0 and Ty = 0 for the first camera. For the right (second) camera of a horizontal stereo pair, Ty = 0 and Tx = -fx' * B, where B is the baseline between the cameras.

Given a 3D point [X Y Z]', the projection (x, y) of the point on the rectified image is calculated as:

[u v w]' = P * [X Y Z 1]'
x = u / w
y = v / w

This applies to both images of a stereo pair.

References

coScene's schema types are framework-independent and can be implemented using any supported message encoding format.

Encoding FormatSchema Name
ROS 1foxglove_msgs/CameraCalibration
ROS 2foxglove_msgs/msg/CameraCalibration
JSONfoxglove.CameraCalibration
Protobuffoxglove.CameraCalibration
FlatBuffersfoxglove.CameraCalibration
OMG IDLfoxglove::CameraCalibration

Note: You must use the schema names specified above for coScene to recognize them correctly.