digiKam raw converter default gamma curve

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

digiKam raw converter default gamma curve

Elle Stone
I've been exploring the digiKam raw converter.
I was happy (ecstatic) to see that the raw converter appears to have true Unclip as an opton (like in the dcraw code, and unlike UFRaw, which has flawed handling of highlights, imho). Also the inclusion of DCB and AMaZE is "amazing".

So I have a question about the gamma curve. (The post-processing tab gamma is probably not the gamma that I'm asking about - post-processing gamma is applied after raw conversion rather than as part of raw conversion.)

In dcraw code the gamma curve is calculated in this function: void CLASS gamma_curve (double pwr, double ts, int mode, int imax)
(http://ninedegreesbelow.com/2010/imaging/dcraw-annotated/dcraw-v898-annotated.html#D3)

dcraw command line option: "-g 1 1" gives linear gamma output.
"-g 2.20 0" gives simple power curveor "true gamma".
default curve is "-g 2.222 4.5".

Questions:
1. What default gamma curve does the digiKam raw converter use?
2. Is there a way to specify a custom gamma curve in the gui, that I'm just not seeing?
Also, could someone be kind enough to point me to the code section for the raw converter?

Many thanks in advance,
Elle
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Elle Stone
Never mind, kfind and geany to the rescue. I found the code section.
Elle
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Pentti Rautio
Hi Elle, hope that you tell what are your conclusions about gamma
correction (when and where and how?)

By the way : could there be a manufacturer specific correction
somewhere in the code so for example nikon NEF uses a "nikonian" gamma
etc.

Pentti

2011/2/26 Elle Stone <[hidden email]>:
> Never mind, kfind and geany to the rescue. I found the code section.
> Elle
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Gilles Caulier-4
The gamma curve is computed automatically by libraw. Ther is no tune
available from libraw api to adjust curve.

Only some gamma adjustments are possible from libraw, not a fulll curve.

This is why; i added a full curve correction in post processing
settings. There is 2 way to use it :

- let's post processing computed by libraw to adjust gamma
automatically, and process fine adjustment from digiKam postprocessing
curves.
- disable libraw gamma processing and adjust whole gamma curve from
digiKam post processing.

Gilles Caulier

2011/2/27 Pentti Rautio <[hidden email]>:

> Hi Elle, hope that you tell what are your conclusions about gamma
> correction (when and where and how?)
>
> By the way : could there be a manufacturer specific correction
> somewhere in the code so for example nikon NEF uses a "nikonian" gamma
> etc.
>
> Pentti
>
> 2011/2/26 Elle Stone <[hidden email]>:
>> Never mind, kfind and geany to the rescue. I found the code section.
>> Elle
>> _______________________________________________
>> Digikam-users mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-users
>>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Elle Stone
Pentii, not knowing what a Nikonian gamma curve is (in Canon there are
"picture style" curves, but they are applied post-processing), I would
like to ask, what it is that you want to have happen when you decode a
raw file, that perhaps isn't happening with the digikam raw converter?

Gilles, when you say "gamma curve" do you mean the gamma curve on the
post-processing tab? because that is not the gamma that I'm talking
about.

I'm talking about the "gamma curve" in the code below ("ts" stands for
"toe slope" - if it isn't 0, it isn't really a gamma curve):

dcraw code:
void CLASS gamma_curve (double pwr, double ts, int mode, int imax)

Code from libkdcraw (line starting with double gamm[6]):
(this section of code appears in another document, but it's the same
both places)

LibRaw:: LibRaw(unsigned int flags)
{
    double aber[4] = {1,1,1,1};
    double gamm[6] = { 0.45,4.5,0,0,0,0 };
    unsigned greybox[4] =  { 0, 0, UINT_MAX, UINT_MAX };
    unsigned cropbox[4] =  { 0, 0, UINT_MAX, UINT_MAX };

In the above libraw code gamm[6] has 0.45 as the "power" value and 4.5
as the "toe slope" value.

dcraw uses the same defaults as  what is hard-coded into the LibRaw
code snippet above. UFRaw defaults are close visually, but I don't
know what scale or math-model UFRaw uses in the gui for allowing the
user to set the toe slope (toe-slope is called "linearity" in UFRaw).

In UFRAW and in dcraw the end user, that is, the person using the
programs to decode raw files, can specify OTHER values, such as "0"
for the toe slope, to get a true gamma curve DURING interpolation.

Gamma applied post-processing canNOT make up for whatever gamma was
applied during raw rendering. Especially not if a non-zero toe-slope
was used during raw rendering.

Are you saying that the libraw api doesn't allow the digiKam raw
converter programmer ( the person writing the code behind the digiKam
raw converter - I think that is you, Gilles, yes?), to give the end
user (the person actually using the program to decode a raw file) a
choice of power and toe slope? That the libraw api ONLY lets the
programmer provide the hard-coded defaults to the end user?

The reason I am asking, is all my camera input profiles use a true
gamma curve of either 1 (linear gamma) or 2.2. So the respective
gamm[6] toe-slope value needs to be 0. I don't mind altering the
libkdcrw source code and recompiling libkdcraw for my own personal
use.

But if the programmer gave the end-user access to setting their own
power and toe-slope, like dcraw and UFRaw do, it would be really much
nicer.

Elle

On 2/28/11, Gilles Caulier <[hidden email]> wrote:

> The gamma curve is computed automatically by libraw. Ther is no tune
> available from libraw api to adjust curve.
>
> Only some gamma adjustments are possible from libraw, not a fulll curve.
>
> This is why; i added a full curve correction in post processing
> settings. There is 2 way to use it :
>
> - let's post processing computed by libraw to adjust gamma
> automatically, and process fine adjustment from digiKam postprocessing
> curves.
> - disable libraw gamma processing and adjust whole gamma curve from
> digiKam post processing.
>
> Gilles Caulier
>
> 2011/2/27 Pentti Rautio <[hidden email]>:
>> Hi Elle, hope that you tell what are your conclusions about gamma
>> correction (when and where and how?)
>>
>> By the way : could there be a manufacturer specific correction
>> somewhere in the code so for example nikon NEF uses a "nikonian" gamma
>> etc.
>>
>> Pentti
>>
>> 2011/2/26 Elle Stone <[hidden email]>:
>>> Never mind, kfind and geany to the rescue. I found the code section.
>>> Elle
>>> _______________________________________________
>>> Digikam-users mailing list
>>> [hidden email]
>>> https://mail.kde.org/mailman/listinfo/digikam-users
>>>
>> _______________________________________________
>> Digikam-users mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-users
>>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Gilles Caulier-4
2011/3/1 Elle Stone <[hidden email]>:

> Pentii, not knowing what a Nikonian gamma curve is (in Canon there are
> "picture style" curves, but they are applied post-processing), I would
> like to ask, what it is that you want to have happen when you decode a
> raw file, that perhaps isn't happening with the digikam raw converter?
>
> Gilles, when you say "gamma curve" do you mean the gamma curve on the
> post-processing tab? because that is not the gamma that I'm talking
> about.
>
> I'm talking about the "gamma curve" in the code below ("ts" stands for
> "toe slope" - if it isn't 0, it isn't really a gamma curve):
>
> dcraw code:
> void CLASS gamma_curve (double pwr, double ts, int mode, int imax)
>
> Code from libkdcraw (line starting with double gamm[6]):
> (this section of code appears in another document, but it's the same
> both places)
>
> LibRaw:: LibRaw(unsigned int flags)
> {
>    double aber[4] = {1,1,1,1};
>    double gamm[6] = { 0.45,4.5,0,0,0,0 };
>    unsigned greybox[4] =  { 0, 0, UINT_MAX, UINT_MAX };
>    unsigned cropbox[4] =  { 0, 0, UINT_MAX, UINT_MAX };
>
> In the above libraw code gamm[6] has 0.45 as the "power" value and 4.5
> as the "toe slope" value.

I don't play with these settings in Raw import tool for digiKam image editor.

>
> dcraw uses the same defaults as  what is hard-coded into the LibRaw
> code snippet above. UFRaw defaults are close visually, but I don't
> know what scale or math-model UFRaw uses in the gui for allowing the
> user to set the toe slope (toe-slope is called "linearity" in UFRaw).
>
> In UFRAW and in dcraw the end user, that is, the person using the
> programs to decode raw files, can specify OTHER values, such as "0"
> for the toe slope, to get a true gamma curve DURING interpolation.
>
> Gamma applied post-processing canNOT make up for whatever gamma was
> applied during raw rendering. Especially not if a non-zero toe-slope
> was used during raw rendering.
>
> Are you saying that the libraw api doesn't allow the digiKam raw
> converter programmer ( the person writing the code behind the digiKam
> raw converter - I think that is you, Gilles, yes?),

Yes, i am. Marcel write some code too.

I don't take a look about the gamma curve adjustments. In fact, i
suppose that when i start to implement Raw Import tool in the pass,
these settings have been not yet implemented in libraw. If the purpose
of this settings is exactly what's you need, perhaps we can implement
it in Raw Import tool.

> to give the end
> user (the person actually using the program to decode a raw file) a
> choice of power and toe slope? That the libraw api ONLY lets the
> programmer provide the hard-coded defaults to the end user?


To be sure that we understand exactly libraw gamma curves settings, i
CC Alex who is libraw lead developper.

Alex, please take a look at this mailing list archive and give us your
comments and tips. Thanks in advance

http://digikam.1695700.n4.nabble.com/digiKam-raw-converter-default-gamma-curve-td3325122.html

Gilles

>
> The reason I am asking, is all my camera input profiles use a true
> gamma curve of either 1 (linear gamma) or 2.2. So the respective
> gamm[6] toe-slope value needs to be 0. I don't mind altering the
> libkdcrw source code and recompiling libkdcraw for my own personal
> use.
>
> But if the programmer gave the end-user access to setting their own
> power and toe-slope, like dcraw and UFRaw do, it would be really much
> nicer.
>
> Elle
>
> On 2/28/11, Gilles Caulier <[hidden email]> wrote:
>> The gamma curve is computed automatically by libraw. Ther is no tune
>> available from libraw api to adjust curve.
>>
>> Only some gamma adjustments are possible from libraw, not a fulll curve.
>>
>> This is why; i added a full curve correction in post processing
>> settings. There is 2 way to use it :
>>
>> - let's post processing computed by libraw to adjust gamma
>> automatically, and process fine adjustment from digiKam postprocessing
>> curves.
>> - disable libraw gamma processing and adjust whole gamma curve from
>> digiKam post processing.
>>
>> Gilles Caulier
>>
>> 2011/2/27 Pentti Rautio <[hidden email]>:
>>> Hi Elle, hope that you tell what are your conclusions about gamma
>>> correction (when and where and how?)
>>>
>>> By the way : could there be a manufacturer specific correction
>>> somewhere in the code so for example nikon NEF uses a "nikonian" gamma
>>> etc.
>>>
>>> Pentti
>>>
>>> 2011/2/26 Elle Stone <[hidden email]>:
>>>> Never mind, kfind and geany to the rescue. I found the code section.
>>>> Elle
>>>> _______________________________________________
>>>> Digikam-users mailing list
>>>> [hidden email]
>>>> https://mail.kde.org/mailman/listinfo/digikam-users
>>>>
>>> _______________________________________________
>>> Digikam-users mailing list
>>> [hidden email]
>>> https://mail.kde.org/mailman/listinfo/digikam-users
>>>
>> _______________________________________________
>> Digikam-users mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-users
>>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Elle Stone
Gilles,

Thank you very much for looking into this matter of power and toe slope. User access in the digiKam raw converter would be great.

Elle
Reply | Threaded
Open this post in threaded view
|

Re: digiKam raw converter default gamma curve

Pentti Rautio
In reply to this post by Elle Stone
2011/3/1 Elle Stone <[hidden email]>:
> Pentii, not knowing what a Nikonian gamma curve is (in Canon there are
> "picture style" curves, but they are applied post-processing), I would
> like to ask, what it is that you want to have happen when you decode a
> raw file, that perhaps isn't happening with the digikam raw converter?
>

The problem with digiKam is that when a novice user tries to use
Raw-processing the results are not good enough (usually a bit too dark
or dull) and the user don't know what to do to make it look good. When
using color profiles it is the same for novice users (results are a
bit too dark usually then too and you must know how to  correct it
manually).

There are manufacture specific correction curves in the program
Darktable that are automatically selected by the program. They work
well for at least for Nikon and Pentax cameras (haven't tried others).
The different camera correction curves can be seen in a "basic" (my
translation) window. I don't know if this curved-correction is done in
raw calculation or in post-processing.  Maybe it could be tried to use
these curves in digikam post-processing similarly as camera specific
default?

Other things that new cameras do to the jpg are some levelling and
correction for highlights or darks and that makes sometimes the camera
jpg:s to look better than when done directly from RAW or at least you
should do those corrections later before comparing RAW-processed image
to camera-jpg. What I would like to have implemented in RAW-processing
is some kind of highlight blending.

Pentti


> Gilles, when you say "gamma curve" do you mean the gamma curve on the
> post-processing tab? because that is not the gamma that I'm talking
> about.
>
> I'm talking about the "gamma curve" in the code below ("ts" stands for
> "toe slope" - if it isn't 0, it isn't really a gamma curve):
>
> dcraw code:
> void CLASS gamma_curve (double pwr, double ts, int mode, int imax)
>
> Code from libkdcraw (line starting with double gamm[6]):
> (this section of code appears in another document, but it's the same
> both places)
>
> LibRaw:: LibRaw(unsigned int flags)
> {
>    double aber[4] = {1,1,1,1};
>    double gamm[6] = { 0.45,4.5,0,0,0,0 };
>    unsigned greybox[4] =  { 0, 0, UINT_MAX, UINT_MAX };
>    unsigned cropbox[4] =  { 0, 0, UINT_MAX, UINT_MAX };
>
> In the above libraw code gamm[6] has 0.45 as the "power" value and 4.5
> as the "toe slope" value.
>
> dcraw uses the same defaults as  what is hard-coded into the LibRaw
> code snippet above. UFRaw defaults are close visually, but I don't
> know what scale or math-model UFRaw uses in the gui for allowing the
> user to set the toe slope (toe-slope is called "linearity" in UFRaw).
>
> In UFRAW and in dcraw the end user, that is, the person using the
> programs to decode raw files, can specify OTHER values, such as "0"
> for the toe slope, to get a true gamma curve DURING interpolation.
>
> Gamma applied post-processing canNOT make up for whatever gamma was
> applied during raw rendering. Especially not if a non-zero toe-slope
> was used during raw rendering.
>
> Are you saying that the libraw api doesn't allow the digiKam raw
> converter programmer ( the person writing the code behind the digiKam
> raw converter - I think that is you, Gilles, yes?), to give the end
> user (the person actually using the program to decode a raw file) a
> choice of power and toe slope? That the libraw api ONLY lets the
> programmer provide the hard-coded defaults to the end user?
>
> The reason I am asking, is all my camera input profiles use a true
> gamma curve of either 1 (linear gamma) or 2.2. So the respective
> gamm[6] toe-slope value needs to be 0. I don't mind altering the
> libkdcrw source code and recompiling libkdcraw for my own personal
> use.
>
> But if the programmer gave the end-user access to setting their own
> power and toe-slope, like dcraw and UFRaw do, it would be really much
> nicer.
>
> Elle
>
> On 2/28/11, Gilles Caulier <[hidden email]> wrote:
>> The gamma curve is computed automatically by libraw. Ther is no tune
>> available from libraw api to adjust curve.
>>
>> Only some gamma adjustments are possible from libraw, not a fulll curve.
>>
>> This is why; i added a full curve correction in post processing
>> settings. There is 2 way to use it :
>>
>> - let's post processing computed by libraw to adjust gamma
>> automatically, and process fine adjustment from digiKam postprocessing
>> curves.
>> - disable libraw gamma processing and adjust whole gamma curve from
>> digiKam post processing.
>>
>> Gilles Caulier
>>
>> 2011/2/27 Pentti Rautio <[hidden email]>:
>>> Hi Elle, hope that you tell what are your conclusions about gamma
>>> correction (when and where and how?)
>>>
>>> By the way : could there be a manufacturer specific correction
>>> somewhere in the code so for example nikon NEF uses a "nikonian" gamma
>>> etc.
>>>
>>> Pentti
>>>
>>> 2011/2/26 Elle Stone <[hidden email]>:
>>>> Never mind, kfind and geany to the rescue. I found the code section.
>>>> Elle
>>>> _______________________________________________
>>>> Digikam-users mailing list
>>>> [hidden email]
>>>> https://mail.kde.org/mailman/listinfo/digikam-users
>>>>
>>> _______________________________________________
>>> Digikam-users mailing list
>>> [hidden email]
>>> https://mail.kde.org/mailman/listinfo/digikam-users
>>>
>> _______________________________________________
>> Digikam-users mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-users
>>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users