System designHow-to

Single camera calibration when your device has no stereo pair

Calibrate a single RGB or mono camera for intrinsics and distortion: target choice, capture steps, square size, model order and stereo-config scripts.

LumaSpec Vision8 min read Share on LinkedIn

On this page 9 sections
  1. 01Why single camera calibration is not a lesser calibration
  2. 02What you need
  3. 03Calibrate a single camera, step by step
  4. 04Handling the stereo_config error
  5. 05Choosing the square size and the number of poses
  6. 06Verifying the result
  7. 07When the usual answer is wrong
  8. 08Before you start: a short checklist
  9. 09Questions

Calibrating a device that carries only one color or mono camera trips people up for a tooling reason, not a math reason. Every step of intrinsic calibration works exactly as it does inside a stereo rig; what breaks is the capture script that assumes a board configuration always contains a stereo pair and fails on a missing key. This guide walks through single camera calibration end to end: the target, the capture plan, the solve, and how to handle scripts that expect a stereo_config you do not have. It assumes you can run Python and print a checkerboard, and it ends with a calibration file you can use for undistortion and pose estimation.

Why single camera calibration is not a lesser calibration

A stereo calibration is really three calibrations in one pass: the intrinsics of the left camera, the intrinsics of the right camera, and the extrinsics that relate them. Remove the second camera and you remove the third step, but the first step is unchanged. You still solve for the camera matrix (fx, fy, cx, cy) and the distortion coefficients from images of a known planar target.

So a device with one camera produces a complete calibration. What you cannot produce is disparity, depth from stereo, or a rectification that aligns two views. If you later need those, you need a second camera or a depth sensor, not more calibration. For background on the two-camera path, read stereo camera calibration from paired checkerboard images; for the target-pattern alternative, see circular grid camera calibration with monochrome images.

What you need

  • A camera that streams steady, in-focus images: an area scan camera such as the LS-CMR-0166 or the MV-CS200-10UM over USB3.
  • A printed checkerboard on flat stock, or a proper target such as the LS-LXR-0029 dot-grid calibration board.
  • Calipers to measure the true square or dot pitch.
  • A capture and solve tool: OpenCV's calibrateCamera directly, or your platform's calibration script.
  • A rigid mount, or a second person holding the target.
Lens accessoriesCalibration boards and depth-of-field rulers, dot diameter 0.5 mm, dot grid, 76 x 76 mm (LS-LXR-0029)LS-LXR-0029
Type
Calibration targets
$189.00View partBuild a system with it

Calibrate a single camera, step by step

  1. Measure the target. Print a checkerboard of at least 8 x 6 inner corners and measure the printed square size with calipers. Printers scale; a nominal 3.0 mm square is often 2.94 mm on paper. Enter the measured value, in millimeters, as the square size.
  2. Fix the camera, not the target list. Mount the camera rigidly, lock exposure and focus, and disable auto exposure so brightness does not drift between frames. Focus is part of the optical setup; refocusing after calibration invalidates it.
  3. Capture 15 to 25 poses. Hold the target flat, then tilted 20 to 45 degrees up, down, left and right, at near and far distances, and in each corner of the frame. Move the target, not the camera, so the intrinsics stay tied to one optical state.
  4. Verify detection before solving. Run corner detection on every capture and draw the result. Discard frames where corners are missed, mis-ordered, or blurred. A sharp image of the board slightly out of the field of view is worse than one fewer image.
  5. Solve with a modest distortion model. Use the eight-parameter model: fx, fy, cx, cy, k1, k2, p1, p2. Add k3 only if straight lines near the frame border still bow after undistortion.
  6. Check the reprojection error. Expect roughly 0.1 to 0.5 pixels for a careful capture. An error below 0.1 px with few images usually means overfitting, not perfection.
  7. Save the intrinsics in a format your runtime reads. Camera matrix, distortion coefficients, and the image size they were computed at belong together in one file.

Handling the stereo_config error

The failure looks like a calibration bug but is a configuration assumption. The script reads the board definition and immediately asks for the left and right camera of a stereo pair, for example with a lookup such as self.board_config['stereo_config']['left_cam']. On a board whose cameras list contains only a color camera, that key does not exist, and the run stops with KeyError: 'stereo_config' before a single image is captured.

The fix is to make the stereo bookkeeping conditional:

if 'stereo_config' in self.board_config:
    left = self.board_config['cameras'][self.board_config['stereo_config']['left_cam']]['name']
    right = self.board_config['cameras'][self.board_config['stereo_config']['right_cam']]['name']

With that guard, the script skips the pair set-up and continues into the per-camera capture loop, which for your board runs once, on the color camera. Nothing about the intrinsic solve changes. If you would rather not patch a script, call calibrateCamera on your captured set directly, or use a tool that accepts a plain camera list. When you later move results between tools, the mapping table in import stereo calibration parameters across software formats covers the single-camera fields too.

Choosing the square size and the number of poses

The square size sets the physical scale of everything downstream. Estimate your resolution need from the target: to detect corners to a tenth of a pixel, each square should span roughly 10 or more pixels in the image. With a 1/1.7" sensor and a lens covering a 100 mm field of view, squares of about 2.5 mm give a workable balance.

pixels_per_mm = sensor_width_px / field_of_view_mm square_px = square_mm x pixels_per_mm

Worked example: a 4000 x 3000 sensor watching a 100 mm wide scene gives 40 px/mm, so a 2.5 mm square spans 100 px, comfortably above the 10 px floor. A 1 mm square would span 40 px and still work but wastes field of view per pose; a 10 mm square gives only 10 squares across the scene and too few corners per image. For the same arithmetic applied to lens choice, run the camera resolution calculator.

Pose count matters as much as target size. Each image constrains the solver in the directions the target is tilted; flat, centered poses add almost nothing. Twenty varied poses beat fifty near-identical ones, and they leave fewer parameters to trade against each other.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Verifying the result

  • Undistort one captured frame and lay a straightedge on image lines that were straight in the world; residual bowing means the distortion model or the border coverage is short. The coefficients themselves are explained in unrectified camera image: interpreting distortion coefficients.
  • Reproject the detected corners and confirm the error is spread evenly across the frame. One bad corner of the image points at a missing pose region, not at the solver.
  • Re-run the solve with two disjoint halves of your capture set. Focal lengths that differ by more than about 1 percent mean the set is too small or too repetitive.
  • Record focus, zoom and working distance. Any of these changed later means recalibrate.

When the usual answer is wrong

  • You actually need depth. No amount of intrinsic calibration creates a baseline. Move to a stereo pair or a 3D sensor from the 3D sensors range, such as a structured-light camera, and calibrate that as its own system.
  • The lens is fisheye. The eight-parameter model diverges beyond roughly 120 degrees field of view; use an equidistant fisheye model or the corners will get worse, not better.
  • The camera autofocuses. A focusing lens has no stable intrinsics. Either lock the focus mechanically or recalibrate at each focus position you use.
  • The target is not flat. A board glued to corrugated card adds systematic error no solver can remove. Glass or aluminum-backed targets from lens accessories hold flatness.

Before you start: a short checklist

  • Square size measured with calipers, entered in millimeters.
  • Focus, exposure and aperture locked before the first capture.
  • At least 15 poses, tilted, covering corners and borders.
  • Corner detection verified on every frame before solving.
  • Reprojection error checked and pose set split-tested.
  • Intrinsics saved with the image size and lens state.

For the camera itself, the area scan cameras finder narrows by sensor size, mount and interface, and the camera configurator walks the full chain. If you want a second opinion on target size or model order for your set-up, use the contact page and describe the field of view and working distance; that is exactly the kind of question we can answer before you order.

Questions

Can I calibrate a camera that has no stereo pair?

Yes. Stereo calibration is two intrinsic calibrations plus one extrinsic step that relates the two cameras to each other. If your board or device defines only a color or mono camera, run the intrinsic part alone: capture a calibration target from many poses and solve for the camera matrix and distortion coefficients. The result is a complete, usable calibration; you only lose the stereo baseline, which you do not have anyway.

Why does a calibration script fail with KeyError: 'stereo_config'?

The script assumes every board configuration defines a stereo pair and reads that key unconditionally, even when only a color camera exists. The calibration math does not need the key; only the capture bookkeeping does. Guard the lookup with a membership test so it runs only when a stereo_config entry exists, then proceed with the single-camera capture. If you cannot modify the script, use a calibration tool that accepts a monocular camera list.

How many checkerboard images do I need for a stable intrinsic calibration?

Plan for 15 to 25 usable images, and accept results once reprojection error stops improving. Cover the whole field of view: corners, center, near and far. Ten images of the target held flat in front of the lens give a poor estimate of focal length and distortion because the poses are nearly identical. Tilt the board 20 to 45 degrees in several directions so the solver can separate focal length from distance.

Does the printed square size matter if I only need distortion?

Yes, it matters less than for metric work but still matters. Distortion coefficients depend on the ratio of pixel positions to the target geometry, so a wrong square size scales your focal length and principal distance incorrectly. If you only undistort images, the effect is small; if you estimate pose or measure in millimeters, measure the printed squares with calipers and enter the true value, for example 2.5 mm.

Which distortion model should I choose for a single camera?

Start with the eight-parameter radtan model: fx, fy, cx, cy plus k1, k2, p1, p2. Add k3 only for wide-angle lenses where straight lines near the border still bow after undistortion. Equidistant or thin-prism models are for fisheye lenses and high-precision work; a plain board lens is usually served well by radtan, and extra coefficients on sparse data make the fit unstable.