Chromatic aberration occurs because an optical system does not bring all wavelengths to the same image position or focus. The visible result can include lateral colour fringing, wavelength-dependent blur and reduced contrast. Correction is therefore an estimation problem: measure the error under known conditions, fit a model that is appropriate for the lens and camera, then validate the residual error on images that were not used to fit the model.
For an optical-design explanation of wavelength-dependent focus and achromatic correction, consult Edmund Optics’ technical guide to optical aberrations and chromatic correction.
For related manufacturing and surface-control considerations, see our guide to aspherical lens manufacturing and optical metrology.
This article explains a practical calibration approach and provides illustrative pseudocode. It does not claim a complete production implementation or measured before-and-after results. A real implementation must be tested against the specific lens, sensor, focus range and processing pipeline.
Lateral and longitudinal chromatic aberration
Lateral chromatic aberration appears as wavelength-dependent magnification, often visible as colour separation toward the frame edges. Longitudinal chromatic aberration occurs when different wavelengths focus at different axial positions and may appear as coloured fringes in front of or behind the focus plane. A simple radial remapping can model some lateral displacement, but it does not fully correct longitudinal blur or complex asymmetric lens behaviour.
For a broader explanation of optical design and performance measurement, see lens resolution testing.
Calibration data and test conditions
Capture a high-contrast calibration target with known geometry and neutral illumination. Record the camera body, lens, focal length, aperture, focus distance, sensor mode, raw converter and any in-camera corrections. Include centre and off-axis measurements because lateral displacement often varies with field radius. Repeat the calibration at more than one focus distance and aperture if the correction is intended to cover those conditions.
Estimate channel alignment using edge positions or feature correspondences. Separate the calibration images from the validation images. If the same samples are used to fit and report the correction, the residual error will understate how well the model generalises.
For the wider optical system context, see aspherical lens technology.
A simple radial model
For a first-order lateral correction, define the image centre as (cx, cy). For a pixel at (x, y), let r2 = (x − cx)2 + (y − cy)2. A simplified channel-specific radial scale can be written as sk(r) = 1 + akr2 + bkr4, where k identifies the colour channel and the coefficients are estimated from calibration data. The corrected coordinate is mapped relative to the centre using the fitted scale. This is a model choice, not a universal lens equation; coordinate normalisation and the mapping direction must be defined consistently.
Illustrative pseudocode
for each calibration image:
detect target corners or high-contrast edge locations
estimate channel-specific displacement from reference geometry
convert pixel coordinates to normalised radius and angle
store paired source and reference coordinates
for each colour channel:
fit radial coefficients using training calibration captures
inspect residual vectors by radius and field position
reject a model that leaves structured residual patterns
for each validation image:
apply the fitted inverse mapping to the channel
resample with a documented interpolation method
measure remaining channel displacement on held-out edges
report:
lens, focal length, aperture, focus distance and camera mode
fitted coefficients and fitting procedure
validation sample count and residual error distribution
known limitations and unsupported conditions
This pseudocode describes the calibration logic only. It omits image decoding, robust outlier rejection, chromatic centre estimation, interpolation boundary handling, metadata storage and production safeguards. Those elements must be implemented and tested before deployment.
Validation and residual reporting
Report median and high-percentile residual displacement in pixels, separated by field region and colour channel. Inspect whether errors remain systematic at the corners or change with aperture and focus distance. Also check for interpolation blur, ringing, clipped borders and colour artefacts. Do not claim a numerical correction improvement until the before-and-after results have been measured on held-out images.
Conclusion
Chromatic aberration correction is a calibrated mapping problem whose complexity depends on the optical system. A radial model can be a useful starting point for lateral displacement, but it is not a complete correction for every lens or every form of chromatic aberration. Publish the calibration conditions, model, pseudocode or implementation, held-out residual measurements and limitations before describing the method as validated.