System designTroubleshooting

Undistortion looks worse after calibration: what to check

If undistortion looks worse after calibration, check edge coverage, pose diversity, residuals and held-out straight lines before changing hardware.

LumaSpec Vision10 min read Share on LinkedIn

On this page 10 sections
  1. 01Separate a good fit from a useful correction
  2. 02Freeze capture geometry and verify map inputs
  3. 03Replace repeated views with useful coverage and tilt
  4. 04Inspect residuals by view and image position
  5. 05Validate straightness on images excluded from fitting
  6. 06Add model complexity only when validation supports it
  7. 07Translate geometric error into the inspection budget
  8. 08Check acquisition hardware before replacing it
  9. 09Release the calibration only after these checks
  10. 10Questions

A small calibration error does not guarantee good lens correction. An optimizer can fit a limited collection of checkerboard corners while predicting the wrong correction elsewhere, especially near image edges. For inspection systems, the useful question is whether independent geometry improves, not whether one training statistic looks small. Work through capture consistency, target coverage, residual patterns and held-out validation before adding distortion coefficients or replacing hardware.

Separate a good fit from a useful correction

Reprojection error measures how closely the calibrated model predicts the detected target points. It does not directly measure straightness throughout the image, nor accuracy at locations absent from the calibration data.

Several similar, centered checkerboard views can produce a small error while leaving focal length and distortion weakly constrained. Peripheral correction then depends heavily on extrapolation. Adding more centered views may improve the reported statistic without fixing that weakness.

Use this diagnostic order to separate configuration mistakes from inadequate calibration data:

Symptom First test Likely corrective action
Correction changes after resizing or cropping Compare calibration and runtime image geometry Transform the intrinsics correctly or restore the original geometry
Center looks reasonable but edges bend excessively Plot detected corners across the full frame Add sharp peripheral views with varied poses
A few target views have much larger errors Inspect their detections and image quality Recapture blurred, warped or incorrectly detected views
Training error improves but independent lines worsen Compare simpler and more flexible models Retain the model that generalizes better
Only borders or framing look different Hold output geometry constant Separate resampling choices from calibration quality

For a measurement-focused acceptance method, use the barrel distortion correction accuracy procedure. Judge geometry rather than the visual appeal of the corrected frame.

Freeze capture geometry and verify map inputs

Start with a reproducible image pipeline. Record image width, height, crop origin, binning, orientation, focus and any optical zoom setting. Calibration and inspection must use compatible settings.

Changing focus can alter the camera model. Resizing changes focal lengths and principal-point coordinates expressed in pixels. Cropping shifts the principal point relative to the new image origin. Do not apply an unchanged calibration merely because the runtime image has a familiar aspect ratio.

Check these inputs before capturing another target sequence:

  • Intrinsics and distortion coefficients come from the same calibration run.
  • The distortion model and coefficient ordering match the mapping implementation.
  • Image dimensions use the expected width and height order.
  • Point arrays contain finite coordinates and the expected number of correspondences.
  • Object-point ordering matches detected corner ordering in every accepted view.
  • Map generation uses the intended output intrinsics and any intended rectification transform.

Count checkerboard inner corners, not printed squares. Accept a detection only when the detector reports success and the expected corner array is valid. Apply subpixel refinement only after establishing a successful detection.

The calibration input error checks cover correspondence and matrix problems separately. For repeatable target images, also establish stable camera exposure and gain settings.

Replace repeated views with useful coverage and tilt

Image count is a collection plan, not a quality certificate. Ten diverse, sharp views can contain more useful information than many nearly identical centered views. Neither count proves that the edges are constrained.

As an initial collection plan, aim for approximately 25-40 accepted views and reserve another 5-10 independent images for validation. These are practical starting ranges, not a universal minimum or an accuracy guarantee.

Divide the frame into a center region, four edge regions and four corner regions. Plot all detected calibration corners on a blank image. The plot immediately reveals where the model has evidence and where it must extrapolate.

Build the collection deliberately:

  1. Capture centered views at different orientations rather than repeating one front-facing pose.
  2. Move the board toward every edge and corner while keeping the complete detectable pattern inside the image.
  3. Add moderate tilts around different board axes. Roughly 15-35 degrees can be a useful starting range if corners remain sharp.
  4. Vary target distance while keeping focus fixed and individual squares adequately resolved.
  5. Remove near-duplicate frames that add little new coverage or orientation.

Peripheral observations matter because radial distortion terms become more influential farther from the distortion center. Views confined to the middle cannot strongly test that behavior.

The target coverage and margin guide helps plan board placement without losing detections. Use a rigid, flat target; the calibration target flatness guide explains when a simple printed target becomes a limitation.

Inspect residuals by view and image position

A single average conceals structure. Calculate an error for each accepted view, then inspect residual vectors at their image locations.

One useful definition is point-based root-mean-square reprojection error:

For view i with N_i detected corners: e_i = sqrt(sum_j[(u_j - uhat_j)^2 + (v_j - vhat_j)^2] / N_i)

Here, detected coordinates are compared with projections predicted by the fitted model. The result is in pixels. Confirm the definition used by your software before comparing reports; some summaries average coordinate components or view scores differently.

Consider a hypothetical collection containing 900 central observations with 0.2-pixel errors and 100 peripheral observations with 1.0-pixel errors:

Pooled RMS = sqrt[(900 × 0.2^2 + 100 × 1.0^2) / 1000] = sqrt(0.136) ≈ 0.37 pixels

The pooled figure looks modest, yet the peripheral errors are five times larger. A coverage plot and regional statistics expose what the average hides.

Use residual patterns to choose the next test:

  • One poor view: inspect blur, glare, target movement, corner ordering and target flatness.
  • Large errors around the perimeter: improve coverage and test whether the model suits the lens.
  • Similar directional errors across neighboring points: investigate systematic geometry errors rather than treating them as random detection noise.
  • Errors that change with capture sequence: check focus drift, motion and changing acquisition settings.

Do not delete every difficult peripheral view simply to lower the score. Recapture valid geometry when image quality is poor; otherwise, removing those observations can hide the exact weakness you need to fix.

Validate straightness on images excluded from fitting

Keep validation images out of both coefficient fitting and repeated model tuning. Include independent straight features near the center, edges and corners, with several line orientations.

A correctly modeled perspective camera preserves the straightness of a straight physical line after lens distortion is removed. The line need not become horizontal or vertical. Perspective can change its orientation without making it curved.

Use rigid, verified straight features. A bowed target, curled print or physically curved edge cannot establish whether correction is accurate.

Follow a repeatable test:

  1. Fix the output image size and output intrinsics for comparisons between candidate calibrations.
  2. Identify points along several independent straight features.
  3. Fit a straight line to each feature and calculate perpendicular point-to-line distances.
  4. Report both RMS and maximum deviation, together with each feature's image location.
  5. Compare candidate calibrations on the same validation images and output sampling.

For example, suppose an edge feature measures 0.4 pixels RMS before correction and 1.2 pixels afterward at comparable sampling. That is evidence of worse straightness for that feature, even if the training reprojection error decreased.

Also check held-out checkerboards by keeping intrinsics and distortion fixed and estimating only each board's pose. Their reprojection errors provide another diagnostic, but pose fitting can absorb some disagreement. Combine that test with straight-line measurements rather than relying on either alone.

Black borders are not proof of failed calibration. They can arise from choosing an output view that includes regions without source pixels. The black-border diagnostic and output scaling explanation separate framing decisions from geometric errors.

Add model complexity only when validation supports it

Begin with the simplest distortion model appropriate to the optical system. Additional coefficients give an optimizer more freedom, but freedom is not additional evidence.

Compare candidate models using the same training views and independent validation set. Check peripheral straightness, regional residuals and stability when a small subset of training views is omitted. Large changes between otherwise similar fits suggest weak constraints or inconsistent data.

A very wide-angle optical system may need a different projection model rather than more terms in an unsuitable one. Use a model supported by your calibration and runtime mapping implementations, and keep their conventions consistent.

Do not force the principal point to the exact image center merely because its estimated position looks surprising. Cropping, assembly and weak calibration geometry can all affect its interpretation. Investigate the data and repeatability before adding constraints.

Translate geometric error into the inspection budget

A pixel error becomes meaningful only in relation to the inspection task. For a nearly front-facing planar object, an initial local estimate comes from field width divided by image width.

Suppose the usable field spans 240 mm across 2400 pixels:

Approximate object sampling = 240 mm / 2400 pixels = 0.10 mm/pixel A 0.5-pixel geometric error corresponds locally to: 0.5 pixels × 0.10 mm/pixel = 0.05 mm

This is a sampling estimate, not a complete measurement uncertainty calculation. Perspective, depth variation, edge localization, target accuracy and remaining distortion also contribute.

For the same field, a preliminary requirement of five pixels across a 0.5 mm feature gives:

Required image width = 240 mm × 5 pixels / 0.5 mm = 2400 pixels

Use that calculation to establish image sampling before assigning a calibration error budget. The dimensional inspection resolution guide explains the broader selection tradeoffs.

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

Set separate acceptance limits for the center and the peripheral regions your inspection actually uses. A global average should not conceal a failed measurement zone.

Check acquisition hardware before replacing it

If correction fails, first establish whether the hardware produces repeatable calibration images. Poor target placement is not fixed by buying a higher-resolution camera.

For area scan cameras, compare shutter behavior, interface and image format using the camera finder. A rolling shutter requires particular care when the target or camera moves during acquisition. For static calibration, stop relative motion before exposing the image.

The LS-CMR-0053 is a GigE camera with a rolling shutter. It illustrates why acquisition behavior belongs in the calibration plan, rather than being treated as a software-only detail.

Area scan cameras12 MP GigE area scan camera, IMX226, 1/1.7" rolling shutter, 9 fps (LS-CMR-0053)LS-CMR-0053
Sensor format
1/1.7"
Lens mount
C-mount
Interface
GigE
Resolution
12 MP
$560.00View partBuild a system with it

For machine vision lenses, check image-circle coverage, mount compatibility, focus stability and resolution suitability in the lens finder. Confirm performance at the intended aperture and working distance rather than assuming one calibration covers every optical setting.

The LS-FFL-0567 is a C-mount machine vision lens. Treat it as a selection reference, not evidence that a particular camera-and-lens combination meets your measurement tolerance.

Machine vision lenses16 mm, 1.1", 20 MP, C-mount machine vision lens, F2.8-22, <0.3% distortion (LS-FFL-0567)LS-FFL-0567
Type
Machine vision fixed
Sensor format
1.1"
Mount
C-mount
Resolution
16-25 MP
$679.00View partBuild a system with it

Before ordering, document the required field, sensor dimensions, mount, working-distance range and smallest inspection feature. If the existing optics provide adequate coverage and repeatable images, improve the calibration evidence before changing components.

Release the calibration only after these checks

Save the calibration with its acquisition settings, target description, model convention and validation report. Rebuild correction maps whenever the calibration or output geometry changes. The real-time undistortion pipeline guide covers map reuse and runtime handling.

Use this release checklist:

  • Capture state recorded: focus, image format, crop and orientation match the approved configuration.
  • Detections inspected: accepted corners are complete, correctly ordered and sharply resolved.
  • Coverage demonstrated: corner plots include the peripheral regions used by inspection.
  • Pose diversity present: target orientation and distance are not nearly constant.
  • Residuals reviewed: per-view and regional errors meet declared limits.
  • Independent geometry improved: held-out lines pass straightness checks at fixed output geometry.
  • Repeatability checked: a repeated capture or fit does not produce unexplained large changes.
  • Runtime maps verified: deployed correction uses the approved calibration and output settings.

If a configuration mismatch explains the failure, fix it and rerun validation. If peripheral evidence is missing, recapture before adding coefficients. If hardware selection remains unresolved, start with the lens configuration step or send your field, image size and error budget through applications support.

Questions

Are ten checkerboard images enough for calibration?

There is no dependable image-count threshold. Ten views may work for a well-constrained setup, but repeated centered poses leave important uncertainties unresolved. Assess frame coverage, target orientation, image sharpness and independent validation instead. Add views where those checks reveal missing evidence rather than collecting duplicates.

Why can a low reprojection error produce worse undistortion?

Reprojection error describes agreement with the detected training points. If those points occupy a limited image region, the model may fit them closely while predicting poor peripheral correction. Incorrect runtime image geometry or an unsuitable distortion model can also produce a low training score and visibly worse output.

Should more distortion coefficients fix curved image edges?

Not automatically. Additional coefficients can fit detection noise or compensate for weak target coverage without representing the optics reliably. Improve the capture set first, then compare models using independent straight features and regional errors. Keep extra parameters only when they improve validation and remain stable across repeated fits.

Should the principal point be forced to the image center?

Do not overwrite it simply because the estimate is away from the geometric center. Check cropping, resizing, coordinate conventions and calibration diversity first. A fixed principal point is a modeling constraint that needs justification, not a general repair for a calibration that looks wrong.

What should be checked before deploying a new calibration?

Use verified straight features that were excluded from calibration, especially near the frame edges. Compare their perpendicular deviations from fitted lines at controlled output sampling. Also confirm the deployed image geometry and correction maps match the validated configuration; a good calibration cannot compensate for mismatched runtime settings.