Camera intrinsicsNEORACER DOCS
NEORACER DOCS
These docs are public and open source.Edit on GitHub
CALIBRATION / CAMERA INTRINSICS

CAMERA INTRINSICS.

A lens bows straight lines near the edges and the needs to know the focal lengths and the true center of the image. You only need this once, and only if you do geometry with the camera: lane lines on the ground, distances, anything that has to be metric. The standard ROS tool measures it from a checkerboard.

~0 minutesIntermediateOnly for metric vision640 × 480
FIG. A / THE REFERENCE
8 × 6 SQUARES · 35 INNER CORNERS · KNOWN SQUARE SIZE
A flat checkerboard of known square size. The tool finds the inner corners in each frame and, because it knows the true geometry, solves for the lens that would produce what the camera sees.
01 / WHAT YOU MEASURE

WHAT YOU MEASURE.

Two things come out of this. The camera matrix holds the focal lengths fx, fy and the principal point cx, cy, the real center of the sensor. The distortion coefficients, usually five, describe how the lens bows the image so you can undo it. Together they let you turn a pixel into a ray you can trust.

02 / YOU'LL NEED

WHAT YOU'LL NEED.

01

A checkerboard

Flat, rigid, known size.
Print one and tape it to something stiff like foam board. Measure one square edge in metres; the tool needs that to set the scale. A warped sheet ruins the fit.
02

The decoded stream

/camera is JPEG-encoded.
The raw /camera topic carries JPEG bytes, not a plain image, so enable the decode_camera node and calibrate against /camera/decoded.
03

camera_calibration

The standard ROS tool.
Part of the ROS image_pipeline. This is the same cameracalibrator the whole ecosystem uses, not a NeoRacer-specific script, so any ROS camera guide applies.
FIG. B / FIVE STEPS, START TO FINISH
1
Decoded image
/camera/decoded
2
$_
Run calibrator
camera_calibration
3
Wave the board
fill the bars
4
Calibrate
let it solve
5
Save
camera_info YAML
Point the calibrator at the decoded feed, move the board until the coverage bars fill, let it solve, and save the result.
03 / THE PROCEDURE

THE PROCEDURE.

bash
# 1. Make sure the decoded image is publishing (decode_camera enabled). ros2 topic echo /camera/decoded --no-arr # 2. Run the calibrator against it. Match --size to the INNER corners of # your board and --square to one square edge in metres. ros2 run camera_calibration cameracalibrator \ --size 7x5 --square 0.035 \ image:=/camera/decoded camera:=/camera # 3. Hold the board in view and move it: left, right, near, far, and # tilted. Watch the X, Y, Size, and Skew bars fill toward green. # 4. When all four bars are full, click CALIBRATE, then SAVE.
04 / THE OUTPUT

A CAMERA_INFO YAML.

Save writes a calibration archive with the intrinsics in the standard camera_info shape. It looks like this, at the camera's 640 by 480 resolution:

yaml
# camera_info, written by camera_calibration (values are illustrative) image_width: 640 image_height: 480 camera_name: neoracer_camera camera_matrix: rows: 3 cols: 3 data: [495.2, 0.0, 318.7, 0.0, 496.1, 241.3, 0.0, 0.0, 1.0] distortion_model: plumb_bob distortion_coefficients: rows: 1 cols: 5 data: [0.061, -0.118, 0.0008, -0.0003, 0.0]

The diagonal of the camera matrix is fx, fy; the right column is cx, cy, near but not exactly the image center. That offset is exactly the kind of thing your eye cannot see but your geometry depends on.

05 / USING IT

USING THE CALIBRATION.

  • Point your camera node or a republisher at the saved file so it publishes a matching camera_info alongside the image.
  • Any consumer that undistorts or projects, including the osracer navigation stack, reads those intrinsics to do honest geometry.
  • If you only ever use the camera for raw pixels, lane colour, a sign classifier, you can skip this page entirely.