dipityPix app

Thursday, October 15, 2015

Adjusting color temperture in prismatic color model

Another post on the prismatic color space Dave Hart and I have developed for the Subjective iPhone photo editing app.   This post is about changing color temperature (white point) in that model.  

Suppose you want to move a color C to white.   In the prismatic space you do this in the hue cross section.   The most direct way is just to add the barycenric of white and subtract the barycentric of C.   That works, but will make some hues move out of the triangle.   For that the simplest method is to clamp and renormalize.   I searched for "tungsten" at flickr and found a yellow photo.  This one is clearly on purpose, but still a good example.

Now we can apply a shift to all hues:
The code for this shift/clamp/renormalize (with a vec3 C++ class) is:
The (22,18,10) was just one tenth of the 8 bit RGB color of the back wall.   The one tenth is to allow me to do arithmetic in my head.


Unknown said...

Hi, Pete!

Really interesting posts! Is there a typo in the 3rd if?

if (bary[2] > 1.0) bary[2] = 1.0;

Peter Shirley said...

GOOD CATCH! I was lucky in that this image didn't have saturated enough colors for that to bite me.