This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Computer Graphics with Photoshop > December 2005 > slope-limitation equation ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author slope-limitation equation ?
Fabrice

2005-12-15, 6:17 pm

Hello,

Is the function for the "slope-limiting" feature of the Curves windows
available somewhere ? From what I have found on Google, it seems that there
is three part in the function : a power function, a linear function and a
small spline between the two. But I don't know where each starts...

Thank you in advance for your help !
Fabrice.


Mike Russell

2005-12-16, 6:14 am

"Fabrice"wrote:
> Is the function for the "slope-limiting" feature of the Curves windows
> available somewhere ? From what I have found on Google, it seems that
> there is three part in the function : a power function, a linear function
> and a small spline between the two. But I don't know where each starts...


Hi Fabrice,

If I understand your question correctly, the curve window uses bicubic
splines to generate its curve points from the specified control points.
There are any number of references to the mathematical details, including
Numerical Recipes in C.

I could not find the words "slope limiting" in Photoshop's help file.
Curvemeister has a feature that supports user controlled limits for the min
and max slope of its curves. If I misunderstood your question, try again.
--
Mike Russell
www.curvemeister.com


Fabrice

2005-12-16, 6:14 am

>
> I could not find the words "slope limiting" in Photoshop's help file.
> Curvemeister has a feature that supports user controlled limits for the
> min and max slope of its curves. If I misunderstood your question, try
> again.


Hello Mike,
I'm sorry, I mistranslated the name of the window ... It is the "Levels"
window, and not the "Curves" one. I'm talking about the "gamma" function,
that is not a simple x^gamma, but something more complicated with a slope
limitation for the dark tones. I'm looking for the equation of this
function. This questions stirred a lot of controversy seven years ago (!)
(see for example http://tinyurl.com/azb24 ), but I didn't find the formula
anywhere.

Sorry again for not being clear, and thank you anyway for answering.
Fabrice.


Mike Russell

2005-12-16, 6:14 am

"Fabrice" <fabrice_martin2@nospamyahoo.fr> wrote in message
news:43a27671$0$21221$626a54ce@news.free.fr...
>
> Hello Mike,
> I'm sorry, I mistranslated the name of the window ... It is the "Levels"
> window, and not the "Curves" one. I'm talking about the "gamma" function,
> that is not a simple x^gamma, but something more complicated with a slope
> limitation for the dark tones. I'm looking for the equation of this
> function. This questions stirred a lot of controversy seven years ago (!)
> (see for example http://tinyurl.com/azb24 ), but I didn't find the formula
> anywhere.


Ah - I remember that thread. I have no idea what they were talking about
then or today.

Evidently, though, levels and curves are based on slightly different
parametric curves, with the term "slope limiting" applied to the difference.
You may find Stephen Marsh's collection of utilities of interest.
http://members.ozemail.com.au/~bina...ndownloads.html

Stephen includes a link to a levels2curve function that converts a Photoshop
levels file to the corresponding curves file.
--

Mike Russell
www.curvemeister.com


hoffmann@fho-emden.de

2005-12-16, 6:14 am

Fabrice,

I remember the discussions as well.

Given y(x)=x^(1/G) , e.g. with G=2.2

Linear slope for small x, transition at x1:
y(x1)=x1^(1/G)

Slope:
s=y1/x1

Algo:
If x<x1 Then y(x)=s*x Else y(x)=x^(1/G)

x,y are normalized for [0,1].

I don't know the transition value x1. Can be found
in T.Autiokari's graphics (at that time different for
8 bit per channel and 16 bpc).

Best regards --Gernot Hoffmann

Fabrice

2005-12-16, 6:15 pm


> I don't know the transition value x1. Can be found
> in T.Autiokari's graphics (at that time different for
> 8 bit per channel and 16 bpc).


Ok, thank you for the math, but it seems things are a little more
complicated, according to this message from Chris Cox:
http://tinyurl.com/couya

"The gamma adjustment in Levels is a predefined power function with a linear
slope, plus a small spline segment to smooth the meeting of the two
functions."


In addition, I believed the transition value x1 would depend on the value of
gamma. Do you know if it is the case or not ? If not, it is indeed easy to
find its value from Timo's example. I'm going to look at it.

Thanks,
Fabrice.


Fabrice

2005-12-16, 6:15 pm

> Evidently, though, levels and curves are based on slightly different
> parametric curves, with the term "slope limiting" applied to the
> difference. You may find Stephen Marsh's collection of utilities of
> interest.
> http://members.ozemail.com.au/~bina...ndownloads.html
>
> Stephen includes a link to a levels2curve function that converts a
> Photoshop levels file to the corresponding curves file.


Thank you for the idea, but i'd prefer to find out the equation, as it would
be required in a home-made program...

Fabrice.


hoffmann@fho-emden.de

2005-12-16, 6:15 pm

Fabrice,

the answer is simple: Adobe doesn't ever publish algorithms.

Replacing the vertical slope by a finite slope is probably not
bad. I forgot the 'small spline' between the two segments.

All this is up to any image processing programmer, as long
as PhS is not concerned.

E.g. you may have a look at improved Curves for special purposes
here (p.9 ... p.16) :
http://www.fho-emden.de/~hoffmann/hlscone03052001.pdf

No isolated linear part but continuous functions.

By the way: this HLS color space is good replacement for Lab,
if accurate Lab is not required, but a decomposition of RGB into
Hue, Saturation and Lightness (without discontinuities in the
vicinity of the vertices).

Best regards --Gernot Hoffmann

Fabrice

2005-12-19, 6:14 pm

> thanks for the feedback.

Hello,
some more feedback: I have spent a few more hours on trying to reverse
engineer the equation, but to no success. I don't see any pattern emerging
when testing several gamma values.
For example the linear slope varies with gamma, and the value where the two
curves begin to differ varies also a lot, but I did not find a satisfying
relationship between those quantities:

G=1.5 ; slope=2.7 ; value=30
G=2.2 ; slope=4.5 ; value=28
G=3.0 ; slope=7.5 ; value=23
G=4.5 ; slope=22 ; value= 9
G=6.0 ; slope~60 ; value= 3

The problem is the "same" with your equation: the exponent is required to
vary with G in order to mimic Photoshop's behavior. The value 0.028 is
satisfying for G around 2.2-3.0 .

>
> By the way: could you solve your ICC-related problems,
> as mentioned about one year ago in the Google forum
> Color Engineering ?


Yes, I have found very similar ICC profiles by doing the maths from the
theoretical curves given by Kodak, and by using Timo's program. In fact,
I've been quite impressed that his program should give so good results. I
have tested other (commercial or not) programs, and their results were quite
poor, compared to Timo's ones...

Fabrice.


Andrew Morton

2005-12-20, 6:14 pm

hoffmann@fho-emden.de wrote:
> the answer is simple: Adobe doesn't ever publish algorithms.


They do in patents. Although that doesn't necessarily make them easy to
find.

Andrew


Fabrice

2005-12-20, 6:18 pm


> They do in patents. Although that doesn't necessarily make them easy to
> find.


Yes, finding patents is not that difficult, look here:
http://tinyurl.com/bfbpv

However, I didn't find anything related to gamma and slope-limitation. Did
you have an idea concerning the relevant patent ?

Thanks anyway for the suggestion,
Fabrice.


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews