Luminous Landscape Forum
Raw & Post Processing, Printing => Digital Image Processing => Topic started by: Guillermo Luijk on September 27, 2017, 03:10:09 pm
-
As an exercise to practise image processing with R (a statistical data processing language), I have written some code to calculate the RGB curves that were applied to a pair of input + output images:
INPUT
(https://1.bp.blogspot.com/-waVmGIgpywU/WcfRgdAoKmI/AAAAAAAABF4/0Tg6mGIG-vE7Q8S_x2oCOTEqBuZ-TXG0wCLcBGAs/s1600/mazingerantes.png)
OUTPUT
(https://3.bp.blogspot.com/-yVE1fkaPIm8/WcfSS3rHeuI/AAAAAAAABGE/tmD8oOEgpHsPL8ovEqf7j-HgyJotUfm5ACLcBGAs/s1600/mazingerdespues.png)
CALCULATED RGB CURVES
(https://1.bp.blogspot.com/-u_Nb25NCYrQ/WcfUAaK26lI/AAAAAAAABHE/jAK1tgjD0ws21QHgosTpJcrCPagVz_JGACEwYBhgL/s1600/curvasrgb.png)
The process can be applied to any B&W toned image to hack the toning, and then apply it to a B&W image of our own:
TONED IMAGE
(https://4.bp.blogspot.com/-0s6lGu6jeRQ/WcfcfY-F_6I/AAAAAAAABGo/UQR1DX7ncXUu7w1ZUI1uKEzrN7Mb5eEEwCLcBGAs/s1600/virado.png)
CALCULATED RGB CURVES
(https://1.bp.blogspot.com/-0WVRJZ704tI/WcfelYdUBDI/AAAAAAAABG4/h6Y96mGuxIUsIeHyUAkLdKvl7feMcoZogCLcBGAs/s1600/curvasvirado.png)
APPLICATION TO OUR B&W IMAGE
(https://2.bp.blogspot.com/-PfthE0LeCJ8/Wcfe7wZH2PI/AAAAAAAABHA/VX2Ao79k8vUNuCpo8yi3l77Q6sLh3FgHgCLcBGAs/s1600/floresviradas.png)
I have finally analysed two Instagram filters to find out how well they can be represented through curves. Looking at the nearly undistinguishable result, they actually seem to be nothing more than curves:
CALCULATED RGB CURVES
(https://2.bp.blogspot.com/-IM_AvtNABMA/WchIGnobLUI/AAAAAAAABHk/wXLE8W9xIu0bFWRMhxn1uGY4rAbkPfLWQCLcBGAs/s1600/curvasrgb1977.png)(https://2.bp.blogspot.com/-vxfvywedubs/WchIMIScYTI/AAAAAAAABHo/ep8rOrp-U9UITAt-vAJzWzIuI8uLN2cSwCLcBGAs/s1600/curvasrgblordkelvin.png)
INSTAGRAM vs CALCULATED RGB CURVES
(https://4.bp.blogspot.com/-S6bOOVnjarI/WchRRNQgO8I/AAAAAAAABII/zWUTtk56AnUruCUlWKfGPkgSfytSSNIUgCLcBGAs/s1600/instagram.png)
Hope you find it interesting. The English translation is available through Google:
RGB curves reverse engineering with R (http://www.elmomentodecisivo.com/2017/09/ingenieria-inversa-de-curvas-rgb-con-r.html)
Regards
-
Very interesting, Guillermo.
I wonder if some variation of this could be used to create curves for creating better platinum presets for Lr or PS by photographing a classic platinum print???
-
Well done Guillermo...
i always use curves for all my color changes...
with BW toning i always wonder if the begin and endpoints ( 0, 255) has to stay in place or not.
-
As an exercise to practise image processing with R (a statistical data processing language), I have written some code to calculate the RGB curves that were applied to a pair of input + output images:
Guillermo, Well done.
It's a fine demonstration of what can be done with only using Curves.
It's one of the ways that color grading can be done, and using curves makes it relatively easy to implement in existing photo-editors. It just takes some before and after comparisons to build the curves that can be reused, and some software to do it.
Another way color grading is often done is by using color look-up tables (CLUTs), either per channel LUTs or (e.g. Hald) 3D LUTs and by using interpolation of in-between colors. 3D LUTs allow even more complex color grading than with per channel LUTs, e.g. rotation of colors.
ImageMagick has a lot of built-in Look-up Table functionality:
https://www.imagemagick.org/Usage/color_mods/#color_lut
RawTherapee (http://rawtherapee.com/downloads) also supports Hald 3D LUTs:
http://rawpedia.rawtherapee.com/Film_Simulation
Topaz Studio (besides curves) also has a plugin that allows color grading based on the 5 most dominant colors of an image.
Here's some more detail about that specific plugin:
https://web.topazlabs.com/color-theme#overview
Photoshop (starting with CS6) also has some LUT capabilities:
https://blogs.adobe.com/richardcurtis/2012/09/14/adding-a-3d-lut-or-colour-lookup-table-for-toning-to-your-image-no-2/
Cheers,
Bart
-
Photoshop (starting with CS6) also has some LUT capabilities:
icc/icm profiles were possible to apply in PS even before that, so it is not exactly starting with CS6 ...
-
icc/icm profiles were possible to apply in PS even before that, so it is not exactly starting with CS6 ...
What I mentioned is not about ICC/ICM profiles, but about (3D) LUTs (Adjustment layers) which is a different kind of animal. It's very commonly used for Color grading in video editing, but equally useful for applying a 'uniform look' in series of stills, even Black & White ones).
Cheers,
Bart
-
As an exercise to practise image processing with R (a statistical data processing language),
R??? Why make your life miserable with that terrible 'language'. Use Python.
-
RawTherapee (http://rawtherapee.com/downloads) also supports Hald 3D LUTs:
http://rawpedia.rawtherapee.com/Film_Simulation
In fact reverse engineering 3D LUTs is exactly the same principle. The problem is that it is much less likely to be able to define all 3D colour combinations with a single input/output pair than with 1D LUTs. Not only because there is a vast larger number of possible combinations in 3D LUTs, but because real world images never have all colours at a time. I recall a synthetic imagen provided by Raw Therapee that allows to create the 3D LUT if the user is allowed to apply the processing, and this is the way they created their film simulations.
I found them: http://gmic.eu/film_emulation/various/clut/
To define a 1D LUT with 8-bit resolution, this tiny square is enough :)
(http://www.guillermoluijk.com/misc/test.png)
Regards
-
R??? Why make your life miserable with that terrible 'language'. Use Python.
I use both, and none makes my life miserable :P
-
What I mentioned is not about ICC/ICM profiles, but about (3D) LUTs (Adjustment layers) which is a different kind of animal.
yes, but using profiles you can do the same
-
I use both, and none makes my life miserable :P
Python >>>>>> R. Technically, R is not even a valid 'programming language'. Just a (very bad) mixture of some commands.
-
Python >>>>>> R. Technically, R is not even a valid 'programming language'. Just a (very bad) mixture of some commands.
Never intended to write a program, that is why I used R for this exercise. Treating your R-fobia will make your life less miserable lol
-
Never intended to write a program, that is why I used R for this exercise. Treating your R-fobia will make your life less miserable lol
It is not R-phobia. I have worked in R extensively to know that it doesn't even qualify for a modern language, IMHO, for e.g. something like Python, or even Java. Or even C/C++. It is just rubbish. There is no reason to use it. Python is all one needs in place of it. And, at other places, Java and/or Scala. And, C/C++ where none of the afore-mentioned can be used.
I'm quite serious. Despite what you might hear from supposed 'data scientists' about R, it is just a flagrant distortion of the notion of a 'programming language'. Enough said.
-
It is not R-phobia.
You have already devoted three posts in a thread about RGB curves to hate R, which most people in this forum probably don't know what is nor are interested in. It seems R-fobia is not your only trauma here.
-
You have already devoted three posts in a thread about RGB curves to hate R, which most people in this forum probably don't know what is nor are interested in. It seems R-fobia is not your only trauma here.
Phobia, Trauma??? What is wrong with you? Listen, I just gave my advice regarding R, which I believe is a bad 'language'. You can take it or leave it. But no need to get rude. What is with personal attacks???. Ok.
-
Python >>>>>> R. Technically, R is not even a valid 'programming language'. Just a (very bad) mixture of some commands.
like matlab ?
-
Phobia, Trauma??? What is wrong with you? Listen, I just gave my advice regarding R, which I believe is a bad 'language'. You can take it or leave it. But no need to get rude. What is with personal attacks???. Ok.
G basically asks not to hijack the thread ;)
-
Good stuff Guillermo.
-
Good stuff Guillermo.
+1 now that we are getting back OT away from HOW the process (which is quite interesting) was produced; it works.