Chromatic aberration removal in the RAW domain on GPU

Updated:

Fastvideo has developed a self-calibrating, sub-pixel correction of lateral chromatic aberration that works in the RAW domain, before demosaicing. The channel displacement maps are estimated directly from the images to be corrected — no chart and no calibration session — and applied on GPU at about 5 GPix/s, i.e. under 5 ms per 24 MPix frame on the NVIDIA GeForce RTX 4090.

Detailed benchmark data. Measured results are published on our benchmark pages: all benchmarks.

Lateral chromatic aberration correction in RAW domain: before and after comparison

Lateral chromatic aberration before and after correction in the RAW domain

Chromatic aberration (CA) is a common lens artifact caused by the fact that the refractive index of glass varies with wavelength, so a lens cannot focus all colors to exactly the same point. Lateral (transverse) chromatic aberration shifts the color channels relative to each other across the image plane and produces colored fringes at contrast edges. Axial (longitudinal) chromatic aberration shifts the focal plane per wavelength and appears as color blur, typically with purple and green fringing.

Lateral CA has a characteristic signature that makes it easy to identify. It grows from the center of the image toward the corners and shows up on any high-contrast edge that is not exactly radial to the image center. The fringes appear in complementary color pairs on opposite sides of a bright or dark object: red–cyan, violet–green, or blue–yellow. If a fringe appears in one color only (for example, purple with no matching green edge on the opposite side), or if it does not follow this radial, complementary pattern, it is most likely not lateral CA and requires a different correction.

The right place to correct lateral CA is the RAW domain, before demosaicing. Any demosaicing algorithm mixes information between color channels, so once the image has been demosaiced, the original channel misalignment can no longer be truly removed — it can only be desaturated, which suppresses the visible fringes at the cost of losing color detail near edges. Correcting CA directly on the Bayer data, on the other hand, realigns the red and blue channels with the green one before any channel mixing takes place, so fine detail and edge colors are preserved.

Our goal is a high-precision, sub-pixel correction of lateral CA, implemented as a warp applied to the red and blue Bayer channels of a RAW/DNG image. The critical part is computing the required transform accurately: the displacement between channels varies across the frame and reaches its maximum in the corners, so it has to be measured and corrected as a smooth, spatially varying field rather than a single global shift.

The conventional way to obtain such a transform is a chart-based calibration, as defined by ISO 19084:2015: a dot chart with a regular grid of black dots is photographed, and the chromatic displacement is computed from the per-channel positions of the dot centers. This approach is accurate, but it requires a dedicated chart, controlled shooting conditions, and a separate calibration session for every camera and lens combination.

Our method takes a different route: it is self-calibrating, so calibration can be performed after the fact. No chart and no dedicated calibration session are needed — the channel displacement field is estimated directly from the very RAW/DNG images that need to be corrected. A single frame with sufficiently detailed texture is enough, and estimating over a series of frames taken with the same lens makes the result even more robust.

From Displacement Fields to RAW-Domain Warping

The correction works with two displacement fields: red-to-green and blue-to-green. The green channel serves as the reference — it carries twice as many samples in the Bayer pattern as red or blue, and human vision is most sensitive to it, so aligning red and blue to green is the natural choice. Each field describes, for every point of the frame, how far and in which direction the corresponding channel is shifted relative to green.

Once the two fields have been estimated, they are converted into warp maps for the red and blue Bayer channels. The warp is applied with sub-pixel precision directly to the RAW data: the red and blue samples are resampled according to their maps, while the green channel and the Bayer layout itself remain untouched. The output is a valid RAW image — PGM or DNG — with the same resolution, bit depth, and Bayer structure as the input, only with the color channels brought back into alignment. It can be fed into any existing RAW processing pipeline, and every downstream stage, starting with demosaicing, benefits from the corrected input.

Two properties of this approach are worth highlighting. First, the displacement field is spatially varying but smooth, which matches the physics of lateral CA: it is a lens property, so it changes gradually across the frame rather than jumping from pixel to pixel. Estimating a smooth field over the whole frame averages out local noise and makes the sub-pixel accuracy achievable in practice. Second, because the correction is a pure geometric realignment of the original samples — no channel mixing, no desaturation — it removes the fringes without touching the colors and details of the scene itself.

Results: Before and After

For the demonstration below we took a 12-bit 24 MPix DNG image with strong lateral chromatic aberration. The displacement fields were estimated directly from this image — no chart and no external calibration data were used.

estimated channel displacement field for lateral chromatic aberration

The estimated channel displacement field

The displacement is close to zero at the image center and grows smoothly toward the edges — the characteristic radial pattern of lateral chromatic aberration, and a useful sanity check that the estimation has captured the lens behavior rather than image noise.

Both crops below come from the same region near the edge of the frame, where lateral CA is strongly pronounced, and both were converted from RAW to RGB with an identical processing pipeline — the only difference between them is whether CA correction was applied in the RAW domain before demosaicing.

source image with chromatic aberration

A crop of the source image

Strong lateral chromatic aberration is visible as red and cyan fringes along the high-contrast edges.

processed image without chromatic aberration

The same crop after self-calibrated CA removal in the RAW domain

The color fringes are gone, while edge sharpness and scene colors are fully preserved.

Note what the correction does not do: the edges are not blurred and the colors near them are not washed out. This is the practical difference between realigning the channels in the RAW domain and merely desaturating the fringes after demosaicing — the fringes disappear because the channels are actually back in place, not because the color information along the edges has been discarded.

Performance on GPU

The workflow is split into two stages. The displacement field estimation and the construction of the remap tables are performed offline, once per camera and lens setup, using previously captured RAW/DNG frames. The real-time part of the pipeline only applies these precomputed maps to the incoming frames — this is the stage whose performance matters for live camera applications, and this is what we benchmarked.

We measured the CA removal module, implemented in CUDA as part of our RAW-to-RGB pipeline, on an NVIDIA GeForce RTX 4090 with the same 12-bit 24 MPix DNG image shown above. The measured throughput of the correction stage is about 5 GPix/s. For a 24 MPix frame this translates to under 5 ms per frame, i.e. more than 200 fps for the correction stage alone. In other words, sub-pixel CA removal adds only a small fraction to the total frame budget of a real-time RAW pipeline, so it can be enabled permanently in live camera applications rather than reserved for offline post-processing.

Availability

The algorithm is implemented and benchmarked — the images and the performance figures above were produced with our test build. The module has not been released yet; it is currently being prepared for release with the following specifications:

If you are interested in evaluating CA removal for your camera application, contact us using the form below — we can discuss your images and requirements while the module is being finalized.

Frequently Asked Questions

Can chromatic aberration be removed after demosaicing?

No — after demosaicing, chromatic aberration can only be desaturated, not truly removed. Demosaicing mixes information between color channels, so the original channel misalignment becomes unrecoverable; desaturating the fringes hides them at the cost of color detail near edges. Our method runs in the RAW domain, before demosaicing, where the red and blue channels can still be physically realigned with green — preserving both sharpness and color accuracy.

Does chromatic aberration correction require a calibration chart?

No — our method is self-calibrating and needs no chart or calibration session. The channel displacement field is estimated directly from the RAW/DNG images that need to be corrected, so calibration can be performed after the fact — even for legacy footage where no calibration data was ever recorded and the lens is no longer at hand.

How many images are needed for self-calibration?

A single RAW frame can be enough — if it carries high-contrast texture across the whole frame, including the corners, since the displacement field has to be measured everywhere. When the detail is sparse or concentrated in one region, a series of frames taken with the same lens is more reliable; they can even show the same scene, shot with slight camera rotations in between. What matters is edge detail across the frame, not the number of scenes. The estimation is automatic: the frames go in, the warp maps come out.

Which type of chromatic aberration does the method correct?

The method corrects lateral (transverse) chromatic aberration — the shift of color channels across the image plane that produces colored fringes at contrast edges. It is most pronounced in wide-angle and zoom optics and grows toward the frame corners. Axial (longitudinal) CA is a per-wavelength focus shift, appears as color blur, and is most visible at large apertures; a geometric warp cannot undo it, so our method does not address it.

How do I tell if color fringing in my image is chromatic aberration?

Look at the corners of the frame, and look for pairs. Photograph a high-contrast edge — a dark tree branch against a bright sky — near a corner: a red fringe on one side and a cyan fringe on the other means lateral CA, the type that geometric realignment fixes. A fringe in one color only, or one that ignores the radial pattern, is something else; uniform purple or green fringing around the edge points to axial CA or lens flare.

Can chromatic aberration be corrected in real time?

Yes — applying the correction runs at about 5 GPix/s on the NVIDIA GeForce RTX 4090, which is under 5 ms for a 24 MPix frame. The workflow is split in two: the displacement field is estimated offline, once per camera and lens setup, and the resulting maps are then applied to every incoming frame in real time. The offline stage is a one-time cost — the maps are reused for all footage from the same camera and lens — so a live pipeline in broadcast, surveillance, or machine vision only pays for the warp.

Does CA removal reduce image sharpness?

No — the correction is a pure geometric realignment of the red and blue channels, with no channel mixing and no desaturation. The fringes disappear because the channels are actually back in place, so edge sharpness and scene colors are preserved. Post-demosaic approaches that hide the fringes by desaturating or blurring them soften the image and discard color detail along the edges; ours leaves the green channel untouched and only moves the red and blue samples to their correct positions.

Does the correction change the RAW file format?

No — the pixel grid is untouched: the output keeps the resolution, bit depth, and Bayer layout of the input, and only the red and blue samples are moved to their correct positions. A DNG comes out as DNG, with its file header intact, so a RAW converter reads it exactly as it would read the original and your existing pipeline needs no changes.

Fyodor Serzhenko, Fastvideo

About the author

Fyodor Serzhenko, PhD, is the founder and CEO of Fastvideo. He earned his PhD at the Moscow Institute of Physics and Technology (MIPT) in 1993. Since 2009 he has led the development of Fastvideo’s GPU-accelerated image codecs and ISP modules, including the Fastvideo SDK. Connect on LinkedIn.

Why you can trust these results

Fastvideo has built GPU-accelerated image processing software since 2009. Our codecs comply with the standards they implement — JPEG (ITU-T T.81 / ISO IEC 10918) and JPEG2000 (ITU-T T.800 / ISO IEC 15444) — and our tools are open source on GitHub. Every performance figure we publish is reproducible: see our benchmark methodology, download the Fastvideo SDK benchmark report (PDF), and measure it on your own GPU.

Contact Form

This form collects your name and email. See our Privacy Policy for how we handle your personal data.