← All field notes

everyone came out red.

seven bands · the first build could only reach one

The first working version of the engine had a single, damning behavior: whoever stepped in front of it came out red. Different people, different clothes, different light — red, red, red. It looked like a bug in the code. It turned out to be a bug in my understanding of light.

This is the second lab note. The first one, the engine is open, explained what the read does today. This one is the messier story of how it got there — the part I'd normally keep in a private commit history. If you write code or you like color science, this is the fun one.

The symptom.

I built the first engine at my kitchen table, reasoning from one question: what does the camera actually see? The naive answer is simple and wrong. Take the frame, throw every pixel's hue into a histogram, find the tallest bin, map that hue to a band. Ship it.

Nearly every read came back red — or its warm neighbors, orange and a bit of pink. I checked the mapping. I checked the histogram. I checked the camera. The code was doing exactly what I told it. The problem was that what I'd told it to do was measure the room.

Why every room is red.

Here's the thing nobody tells you until you stare at a hue histogram for an hour: almost everything in an ordinary photo lives in the warm corner of the color wheel. Skin is orange. Wood is orange. Incandescent and LED "warm white" bulbs are orange. Sunlight through a window skews warm. Even most walls, once the room light lands on them, drift toward amber.

So the tallest bin in the histogram isn't you. It's the light you happen to be standing in. Read the raw dominant hue and you are, with high confidence, measuring the lamp. The lamp is warm. Warm maps to red. Red wins, nearly every time.

"The tallest bin wasn't the person. It was the room. I'd built a very precise lamp detector."

The thing I'd accidentally re-derived.

What makes this embarrassing and wonderful in equal measure is that it isn't a new problem. It's color constancy — the reason a white shirt still looks white to you at sunset, under fluorescent office light, and on an overcast afternoon, even though the actual wavelengths hitting your retina in those three situations are wildly different. Your visual system silently estimates the color of the light and cancels it out. You never notice, because you've done it flawlessly your entire life.

Cameras don't do it for free. Color scientists have been formalizing the trick since the 1970s. Two ideas rescued the engine:

The gray-world assumption. Over a whole scene, the average of all the colors tends toward gray. If your average comes out orange, that orange is almost certainly the illuminant, not the subject — so whatever tint the average carries, you divide it back out. Crude, fast, and shockingly effective.

Edwin Land's Retinex. Land — the founder of Polaroid, which feels right for an aura camera — showed that perceived color depends not on the raw light off an object but on that light relative to its surroundings. "Retinex" (retina + cortex) was his model for how the eye-brain system pulls a stable color out of shifting light. It's the intellectual ancestor of every white-balance algorithm since.

I hadn't invented a bug. I'd built the "before" picture from a color-science textbook and then walked straight into the chapter that fixes it.

The fix, in four moves.

The correction is small once you see it. The engine now does this on every frame:

1 · estimate the room average the lit pixels → white point 2 · divide it out per-channel gain (a diagonal / von Kries move) 3 · read continuously 36-bin hue histogram, interpolated between bins 4 · equalize gently a prior that stops warm hues from drowning the rest

Step two is the whole ballgame. Estimate the illuminant, then scale each color channel so that estimate becomes neutral — the same diagonal transform (von Kries adaptation) your own eyes approximate. What's left after the division is the light the room didn't put there: the color that's actually reflecting off you.

Step four needs a word, because it's the one that could be abused. After white balance, warm hues are still statistically over-represented — rooms are warm even after you correct for them. So there's a mild prior that pulls down the most common warm band a little, the way a graphic equalizer lifts a quiet frequency. It never invents a color. It can't turn a red read into a violet one. It only stops a single over-common band from swallowing the whole spectrum. If your light is genuinely red, you still read red.

The second bug, hiding behind the first.

Once rooms stopped forcing everyone red, a quieter bug surfaced. The old read snapped the calculated hue to one of twelve fixed steps — 30 degrees apart — and then mapped the step to a band. A spectrum is continuous; twelve steps are not. Worse, the snap-points and the band boundaries didn't line up: one of the seven advertised colors, orange, sat in a gap where no snap-point ever landed. It was, quite literally, unreachable. You could not come out orange no matter what you reflected.

Reading hue continuously — fine bins, then interpolating between them, down to about ten degrees — fixed it for free. Every one of the seven bands is now reachable. The gap is closed. You can check this yourself: the distribution demo on the engine page photographs two hundred simulated people and shows all seven bands filling in.

What I won't fake.

The temptation, once the read works, is to dress it up. A live counter pretending thousands of reads are happening this second. A stat like "16% of people come back cyan" invented to look scientific. I won't. The lens is weeks old. When there are real numbers, I'll publish real numbers — and they'll be worth reading precisely because you'll know they weren't decorated.

That's the whole reason these lab notes exist. Precision isn't the enemy of wonder. A prism is more wondrous once you know it's just refraction — the rainbow doesn't need the mystery. Knowing exactly why everyone used to come out red, and exactly what changed, is the interesting part.

If you know optics or color science and you spot something I still have wrong, tell me. We'll fix it in the open, like we broke it.


— Ashley

Ashley
Founder · aura.refract

See the fix run. Move the light around.

The engine is live at /engine — flip white balance off and watch every room collapse to red.

Open the engine →