DLCV 09C · How big must a 3D LUT be?
AdvancedDLCV 09C · Low-Light Image EnhancementImage lab
Description
Bake one smooth color enhancement into an M × M × M table and apply it with a nearest-node lookup or with trilinear interpolation. Compare both with the exact transform.
Try this: At the default (M = 9, the smooth gradient) the nearest lookup shows clear bands and the trilinear result looks like the exact one. Switch the error map to trilinear: where is the error largest, and why there? Then raise M to 33 for the nearest lookup: are the bands gone? Finally set M = 3 and compare the two interpolations.
Explanation
Answer the prediction first, or open the explanation when you are ready.
Show the explanation
A nearest lookup replaces every color by the stored color of one node, so the output is a staircase: even with M = 33 the steps are several levels tall, and they show up as bands on a smooth gradient. Trilinear interpolation turns the staircase into a continuous, piecewise-linear surface that follows a smooth transform closely even with 9 nodes. On the gradient the nearest table with M = 33 has a mean error of 2.46 levels and a maximum of 7; the trilinear table with M = 9 has a mean error of 0.32 levels and a maximum of 4.
Lab · DLCV 09C · How big must a 3D LUT be?
Loading image…
Try this: At the default (M = 9, the smooth gradient) the nearest lookup shows clear bands and the trilinear result looks like the exact one. Switch the error map to trilinear: where is the error largest, and why there? Then raise M to 33 for the nearest lookup: are the bands gone? Finally set M = 3 and compare the two interpolations.
The true enhancement is defined in code (src/lib/playground/labs/lut-trilinear.ts) and is the lab’s own toy: on each channel t, a tone curve g = t^0.9 followed by the S-curve (1 − a) g + a (3g² − 2g³) with a = 0.5; then a saturation gain of 1.15 that scales each color’s distance from its luma gray (luma 0.299 R + 0.587 G + 0.114 B); then a hue turn of 8° (a rotation of the RGB cube about its gray axis); then clipping to [0, 1]. The table has one entry per node of an M × M × M lattice over the RGB cube: node (i, j, k) stores the exact transform of the color (i/(M−1), j/(M−1), k/(M−1)), so it holds 3M³ numbers. A nearest lookup returns the stored color of the closest node. Trilinear interpolation blends the 8 corners of the cell around the color with weights that are products of the offsets, as in the chapter. Both results and the exact transform are rounded to 8-bit levels (0 to 255) before the errors are measured, and the error map is magnified 8 times. The photo is the astronaut test image reduced to 256 × 256; the gradient is a smooth blend of four corner colors computed in the lab, so it has no texture to hide banding.
Method and image sources
- Hui Zeng, Jianrui Cai, Lida Li, Zisheng Cao & Lei Zhang, Learning Image-adaptive 3D Lookup Tables for High Performance Photo Enhancement in Real-time, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022
- scikit-image test images (skimage.data): camera is CC0 by Lav Varshney; coins is from the Brooklyn Museum collection, no known copyright restrictions; astronaut is a NASA photograph in the public domain