Mughees Ul Haq

Work 09 / 18

Colour correction with a lookup table made for each photo

Auto-boost corrects the colour and exposure of each photo with a 3D lookup table built for that photo. I fixed banding in dark rooms, made its controls signed, and removed a wasted JPEG round-trip.

For
A property-media platform
Status
Version 1.13.0
Public photos given a warm, a cool and a green colour cast, before and after the white-balance stage.Warm cast addedWhite-balanced
Public photos given a warm, a cool and a green colour cast, before and after the white-balance stage.Cool cast addedWhite-balanced
Public photos given a warm, a cool and a green colour cast, before and after the white-balance stage.Green cast addedWhite-balanced
I gave public photos a warm, a cool and a green cast and ran the white-balance stage. Drag to compare. The lookup-table predictor was not available to me, so this shows one stage of auto-boost, the white balance.

Photos: Kitchen, Paul Schweiker House and Studio, Me… by w_lemay, CC BY-SA 2.0; Sustainable Kitchen - Flickr - Jeremy Levine… by Jeremy Levine from Los Angeles, United States, CC BY 2.0; Munsell House, Park Street, South Royalton,… by w_lemay, CC BY-SA 2.0. What I changed.

Whole system
under 30 MB
Predictor, tables and white balance
Shadow gain
3.4× → 2.2×
To stop banding in dark areas
Controls
−100 to 100
Signed, with the same rendered output
Quality metric
none
Checked by eye

How it works

It is based on Image-Adaptive-3DLUT. A small predictor looks at the photo and outputs weights for a set of learned basis lookup tables. Their weighted sum is a 3D colour table made for that photo, applied with custom C++ trilinear interpolation.

Inside and outside photos have separate profiles, chosen by the scene classifier. Outside photos get a fixed table first, and a white-balance network removes colour casts.

What I fixed

  • Banding in dark rooms. A quantised lookup table amplifies whatever noise is in the input. I removed a per-tile contrast step (CLAHE) that caused mottling, and halved the shadow lift from 0.4 to 0.2, which takes the gain from 3.4× to 2.2×.
  • Confusing controls. The knobs now run from −100 to 100, and highlights point the same way as the rest. Existing settings were remapped so the rendered output stayed byte-identical, and the inputs are clamped so grey or black frames cannot break them.
  • A wasted step. The service decoded and re-encoded every JPEG only to attach EXIF data. I removed the round-trip.

Limits

There is no number for colour quality here. Changes were checked by eye and by comparing outputs. The banding fix trades some shadow lift for cleaner dark areas.

Tools

Image-Adaptive-3DLUT, PyTorch, C++ (trilinear interpolation), OpenCV.

Builds on Image-Adaptive-3DLUT (Zeng et al.).

The full write-up

There is a longer write-up of this project. It has client details in it, so email me if you’d like a redacted copy.