Skip to content

White balance

Estimate channel gains or mappings that reduce an image’s illumination colour cast.

Try it on your image ↓

VISUAL WALKTHROUGHColour
REFERENCE INPUTWarm colour cast

Colours depend on both channel order and the range assigned to each channel.

RESULTCorrect the colour cast

The chosen gains restore the original swatches. Incorrect illumination assumptions can produce incorrect colour.

STEP 03 / 03

Apply channel corrections and preserve the intended output range.

Illustrative example. The stages explain the method; they are not a live OpenCV execution.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Estimate and correct colour balance using image statistics.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.

Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Normalize colour under changing lighting before display or carefully calibrated analysis.

How it works

  1. 01Measure channel statistics or learned illumination features.
  2. 02Estimate the correction under the selected assumptions.
  3. 03Apply channel corrections and preserve the intended output range.

estimated illuminant → channel correction → adjusted colour

What to tune

Choose a method based on the scene distribution and available model. Avoid silently changing colour in tasks that require original pixel evidence.

Where it breaks down

Gray-world assumes average reflectance is neutral; percentile stretching and learned models have different assumptions. Strongly coloured scenes can violate them.

TypeScript API

Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.

All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.