change image color temperature

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

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" <[email protected]>
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

Thanks Greg,

Yes, I'm expecting orange results!

The idea is to merge different images (with different light sources)
together.

Each light source will have a different colour temperature; as our eye
can't adjust simultaneously to all of them, my assumption is (crude, I
admit!) that it will adjust to the main light source/colour temperature,
while the other will look coloured (just as a lightbulb looks orange in
daylight).

Thanks for sharing this, I'll get into understanding the code now (and
translating for windows)

Giovanni

···

From: Greg Ward [mailto:[email protected]]
Sent: 22 April 2013 18:05
To: Radiance general discussion
Subject: Re: [Radiance-general] change image color temperature

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" <[email protected]>

  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

Hi Giovanni!

In this case you may white-balance the combined contributions of the colored sources. pcomb would do that job quite easily. The procedure is similar to the daylight coefficient approach based on rcontrib. You render one image for each light source (using rtrace, rpict or rcontrib) first with normalized radiance for each source (say RGB 100,100,100). Than you use pcomb to "scale" the images according to the desired source output, and finally add the images for each source.

Cheers, Lars.

···

Thanks Greg,

Yes, I’m expecting orange results!

The idea is to merge different images (with different light sources) together.
Each light source will have a different colour temperature; as our eye can’t adjust simultaneously to all of them, my assumption is (crude, I admit!) that it will adjust to the main light source/colour temperature, while the other will look coloured (just as a lightbulb looks orange in daylight).

Thanks for sharing this, I’ll get into understanding the code now (and translating for windows)

Giovanni

From: Greg Ward [mailto:[email protected]]
Sent: 22 April 2013 18:05
To: Radiance general discussion
Subject: Re: [Radiance-general] change image color temperature

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" <[email protected]>
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
_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi Lars,

Yes, you cantered the point of what I am trying to do. Render different light sources separately potentially change their intensity and colour temperature and compose them together to get a combined result.

The tricky bit is to calculate the right coefficients to change CCT of the light source, which Greg explained with a method of an elegance I wouldn’t have reached on my own!

Thanks again!

G

···

From: Lars O. Grobe [mailto:[email protected]]
Sent: 22 April 2013 23:24
To: Radiance general discussion
Subject: Re: [Radiance-general] change image color temperature

Hi Giovanni!

In this case you may white-balance the combined contributions of the colored sources. pcomb would do that job quite easily. The procedure is similar to the daylight coefficient approach based on rcontrib. You render one image for each light source (using rtrace, rpict or rcontrib) first with normalized radiance for each source (say RGB 100,100,100). Than you use pcomb to "scale" the images according to the desired source output, and finally add the images for each source.

Cheers, Lars.

  Thanks Greg,

  Yes, I’m expecting orange results!

  The idea is to merge different images (with different light sources) together.

  Each light source will have a different colour temperature; as our eye can’t adjust simultaneously to all of them, my assumption is (crude, I admit!) that it will adjust to the main light source/colour temperature, while the other will look coloured (just as a lightbulb looks orange in daylight).

  Thanks for sharing this, I’ll get into understanding the code now (and translating for windows)

  Giovanni

  From: Greg Ward [mailto:[email protected]]
  Sent: 22 April 2013 18:05
  To: Radiance general discussion
  Subject: Re: [Radiance-general] change image color temperature

  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" <[email protected]>

    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

  _______________________________________________
  Radiance-general mailing list
  [email protected]
  http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi,

a very short follow-up on this topic:
R=G=B in Radiance does not have an approximate color temperature of 6500K.
R=G=B corresponds to an equi-energy spectrum over the visible part which
has a correlated color temperature of approx. 5456K.

Best,
David

···

2013/4/22 Giovanni Betti <[email protected]>

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****

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

--
Dipl.-Ing. Dr. David Geisler-Moroder
Hofwaldweg 14/20
6020 Innsbruck
Austria