Pages: [1]   Go Down

Author Topic: Unifying colour temperatures of different light sources in RAW  (Read 531 times)

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com

Another exercise about synthetic RAW generation. We have a scene with two very different light sources:
- Daylight (we cannot avoid it)
- LED warm light (we cannot change it)

http://guillermoluijk.com/misc/linear2.jpg

(RAW file: http://www.guillermoluijk.com/misc/ambientemasartificial.dng)


We do an extra shot by switching off the LED light so we just get the Daylight:

http://guillermoluijk.com/misc/linear1.jpg

(RAW file: http://www.guillermoluijk.com/misc/soloambiente.dng)


Now by linear subtraction we can isolate the LED light source: LED = (Daylight + LED) - Daylight

The LED RAW data is linearly scaled to mimic the Daylight colour temperature.
A synthetic DNG output file is built by simply adding the Daylight RAW values to the modified LED RAW values:

http://guillermoluijk.com/misc/linear3.jpg

(RAW file: http://guillermoluijk.com/datosimagensonido/rawwhitebalanced.dng)


The output DNG file is RAW in all aspects, but both light sources now have the same colour temperature so a single RAW development will eliminate any colour tint produced by the mismatching original colour temperatures.

Whole exercise: https://www.overfitting.net/2021/05/descomposicion-lineal-de-fuentes-de.html

Regards
« Last Edit: May 13, 2021, 05:22:12 am by Guillermo Luijk »
Logged

glyph

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 76
  • Ron H.
    • Glyph Art Studio
Re: Unifying colour temperatures of different light sources in RAW
« Reply #1 on: May 12, 2021, 09:17:29 pm »

Impressive, to say the least. Science and math for the win! Thanks for sharing.
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1853
    • Frank Disilvestro
Re: Unifying colour temperatures of different light sources in RAW
« Reply #2 on: May 13, 2021, 11:42:52 am »

Fascinating! Ho do you subtract the two DNG? Is that in your R code?

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: Unifying colour temperatures of different light sources in RAW
« Reply #3 on: May 13, 2021, 05:17:23 pm »

Fascinating! Ho do you subtract the two DNG? Is that in your R code?

Sure, all code is available for the four exercises (there is a link to the repo in the end of each article). The RAW subtraction is as simple as:

# LINEAR SUBTRACTION
imag=img[[1]]-img[[2]]  # (Ambiente + Artificial) - Ambiente
imag[imag<0]=0  # clip negative subtractions

An animated GIF showing the before/after colour temperature matching:


Regards
« Last Edit: May 13, 2021, 06:45:10 pm by Guillermo Luijk »
Logged
Pages: [1]   Go Up