Follow

A simple "auto white balance" algorithm is to stretch each RGB channel so that the bottom x% and top 100-x% of pixels are clipped off at 0 and 1. x is typically 0.6% (0.006). But that can still give a strong colour tint across the whole image, depending on the distribution of values in between.

I'm experimenting with adding automatic per-channel gamma adjustment, to push the 50% threshold of pixels to 0.5. The formula I'm trying is:

$$
g = log (0.5) / (log(mid - lo) - log(hi - lo))
$$

then for each channel of each pixel

$$
out= pow((in - lo) / (hi - lo), g)
$$

Using linear to sRGB conversion makes this appear quite light and desaturated, so 0.25 instead of 0.5 may be more satisfying.

hm doesn't work as well as I'd hoped. getting some weird artifacts too, maybe my histogram bins are too far apart...

Show thread

that and the points on the bézier curves between the points on the bézier curves between my key frames are probably going out of range... I think I'll make the palette texture repeat (mirror repeat might be nice) instead of clamping to the edge

Show thread

I was getting isolated frames of random colours, think I fixed it now, the problem might have been starting the search for gamma midpoint between the low and high cutoffs instead of the entire range.

Mirror repeat palette looks much better than clamping.

Show thread
Sign in to participate in the conversation
post.lurk.org

Welcome to post.lurk.org, an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.