[Radiance-general] change image color temperature

Greg Ward gregoryjward at gmail.com
Mon Apr 22 10:05:13 PDT 2013


Hi Giovanni,

Your question is difficult to answer.  You have not said whether you want to show what a "white balanced" image would look like, in which case you are better off doing nothing.  If you want to show what the image would have looked like had you used your 6500K white balance on a scene with 3000K illumination, then the answer may be computable.  The way I would do it is in the following stages:

1) Convert to a sharpened RGB color space using:

	$ ra_xyze -r -p .6898 .3206 .0736 .9003 .1166 .0374 .3333 .3333 orig.hdr > sharp.hdr

2) Compute the (x,y) chromaticities for your two color spaces using src/cal/cal/blackbody.cal and convert to Sharpened RGB space and get the ratios between RGB at 3000K to RGB at 6500K:

	$ icalc blackbody.cal xyz_rgb.cal
	CIE_pri(i) = CIE_Sharp(i)
	x65=cct_x(6500); y65=cct_y(6500)
	x30=cct_x(3000); y30=cct_y(3000)
	R(x30,y30,1-x30-y30)/R(x65,y65,1-x65-y65)
	$1=1.6033242
	G(x30,y30,1-x30-y30)/G(x65,y65,1-x65-y65)
	$2=1.10306009
	B(x30,y30,1-x30-y30)/B(x65,y65,1-x65-y65)
	$3=0.439966014

3) Apply these RGB ratios to the Sharpened version of the image and convert back to standard RGB:

	pfilt -1 -er 1.6033 -eg 1.1031 -eb 0.4400 sharp.hdr | ra_xyze -r > shift3000.hdr

If your result looks horribly orange, then you know you've succeeded.  That's just what happens when you shoot indoors with a daylight whit balance!

Cheers,
-Greg

P.S.  You could of course combine steps #1 and #3 if you like really long command lines:

	ra_xyze -r -p .6898 .3206 .0736 .9003 .1166 .0374 .3333 .3333 orig.hdr | pfilt -1 -er 1.6033 -eg 1.1031 -eb 0.4400 | ra_xyze -r > shift3000.hdr

P.P.S.  The reason for converting to a sharpened RGB color space is that this does a better job simulating adaptation in your eye.  You could skip this step and get similar results using the standard RGB color space.

> From: "Giovanni Betti" <gbetti at fosterandpartners.com>
> Date: April 22, 2013 7:35:01 AM PDT
> 
> Dear List,
>  
> I have a problem that I hope the radiance community can help me understand.
>  
> Assume you have simulated a scene with artificial light and you have set the colour of the light to true white (R=G=B; approximate colour temperature 6500k).
> I assume it should be possible in postprocessing to alter the colour temperature of the light source and of the scene (assuming that’s the only light source) using some pcomb expression (different coefficients for the RGB coordinates).
> Does anybody have any pointer to the math required to calculate the coefficient to change the light source from, say, 6500K to 3000K?
>  
> Thanks in advance,
>  
> Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.radiance-online.org/pipermail/radiance-general/attachments/20130422/ecf00d9c/attachment-0001.html>


More information about the Radiance-general mailing list