Luminous Landscape Forum
Raw & Post Processing, Printing => Digital Image Processing => Topic started by: Guillermo Luijk on May 12, 2021, 06:57:02 pm
-
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
-
Impressive, to say the least. Science and math for the win! Thanks for sharing.
-
Fascinating! Ho do you subtract the two DNG? Is that in your R code?
-
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:
(https://1.bp.blogspot.com/-dRVbVDYuXuc/YJ2Slg4knuI/AAAAAAAAKic/BDp574EBud0k94-0zJJxuAzDn_ldRLczQCLcBGAsYHQ/s16000/whitebalanced512.gif)
Regards