Pages: [1]   Go Down

Author Topic: Interesting Gamma curve similarity (warning: Geek stuff)  (Read 3914 times)

32BT

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 3095
    • Pictures
Interesting Gamma curve similarity (warning: Geek stuff)
« on: October 01, 2011, 05:43:25 pm »

So I was thinking about how to best represent linear RAW data through some logarithmic curve, and hence I was trying some formulas for a new gamma curve. While fooling around with some power 2 formulas I tried this:

Y = power(2.0, X*X) - 1.0

Simplicity itself, which is always good, and it has the desirable property that X = 0.5 maps to approximately Y = 0.18

The curve looked reasonable as gamma curves go, but then I wanted to know how much it deviated from the L in Lab. I have no idea whether it is in any way significant or not, but for those interested, see the attached file. Black is the power curve, pink is the L curve. (The gray curve is the inverse). In case you don't see the pink curve, that's because it gets obscured by the black curve...





Logged
Regards,
~ O ~
If you can stomach it: pictures

stamper

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5882
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #1 on: October 02, 2011, 04:11:01 am »

I think you need to get out more.

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #2 on: October 02, 2011, 05:08:05 am »

How can this information be used by photographers and digital imaging enthusiasts to improve image making?
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #3 on: October 02, 2011, 06:26:21 am »

I think you need to get out more.

Or maybe it's you who need a new brain. One that works.


How can this information be used by photographers and digital imaging enthusiasts to improve image making?

I wrote a program to fuse RAW captures from HDR scenes, and I use a standard Y=X^(1/2.2) gamma curve there. Should opgr's curve have some advantages over the standard gamma, I could incorporate it into my code, and hence users of my program would improve image making (specially at the deep shadows).

Of course this is just an example.
« Last Edit: October 02, 2011, 06:29:54 am by Guillermo Luijk »
Logged

stamper

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5882
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #4 on: October 02, 2011, 07:13:39 am »

How can this information be used by photographers and digital imaging enthusiasts to improve image making?

Were you being facetious?

feppe

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2906
  • Oh this shows up in here!
    • Harri Jahkola Photography
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #5 on: October 02, 2011, 07:20:32 am »

Were you being facetious?

It's a fair question. In typical geek fashion the OP doesn't explain what it all means and assumes everyone has a physics degree. Guillermo makes it accessible, as usual.

Eric Myrvaagnes

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 22814
  • http://myrvaagnes.com
    • http://myrvaagnes.com
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #6 on: October 02, 2011, 09:16:00 am »

It's a fair question. In typical geek fashion the OP doesn't explain what it all means and assumes everyone has a physics degree. Guillermo makes it accessible, as usual.
To be fair to Opgr, he did give a Geek warning.
Logged
-Eric Myrvaagnes (visit my website: http://myrvaagnes.com)

32BT

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 3095
    • Pictures
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #7 on: October 02, 2011, 12:37:16 pm »

I had been thinking previously about an example how this is practically useful to Photographers:

The L curve in Lab is a somewhat contorted gamma curve. It is based on a toppled gamma 3.0 with a small linear part in the dark tones. It is meant to match practical perception of subtractive samples with a reference white brightness of 100cd/m2.

It has given us one very useful value which is the middle gray reference of 18%.

However, because it is a contorted gamma curve, it loses one of the more useful features of a true gamma curve, which is invariance to multiplication. (At least I believe that's what it's called in english). That equates to Exposure Compensation in Photographer's terms.

That property has become all the more interesting in recent times where we have true HDR imaging. That is: input values in files can exceed well beyond the usual maximum value of 1.0. In addition, technology has advanced to such extend that the 100cd/m2 brightness is really a somewhat outdated number.

So, the interesting part of the formula above therefore is the fact that, while from a completely different approach, it matches L exactly, yet it has several properties that suggest it may be applicable in extended cases. HDR editing being one of them, monitor calibration being another...

Also, we had some recent discussions about on-board RAW data histograms. Because linear gamma histograms are generally not very useful, we all tend to agree that some form of logarithmic distribution is best.

A base-2 log distribution would be useful because it equates directly to F-stops, which is obviously something that most photographers will understand. You would see F-stops on the horizontal axis, and amount of data vertically. It would immediately show you how much to open up or stop down to bring the resulting data within the desired range.

(see Guillermo's example histogram in threads about ETTR elsewhere)

However, a default log distribution requires some form of reference unit. This is doable in-camera, but once the data is in a file it becomes a bit more tricky. Now, the above formula is nothing other than the square root of the base-2 log distribution. This turns out to be a direct equivalent of the L curve in Lab. And that suddenly makes everything very interesting because the L curve in Lab was established in a totally different way.

Then there are 2 problems with the L curve:
1. it is a shifted gamma curve which likely invalidates its application beyond the maximum value. (See above).

2. it has a linear part that is supposed to represent the transition to a more sensitive B&W perception when people look at dark tones in a dark context. Problem of course is that when viewing a single black pixel in a sea of white, we do not change our perception to the more sensitive B&W viewing. Some very complex models have been designed to overcome this problem, but they are not generally useful in any real life application. 

Can we simply ignore the linear part in L ? Yes, but unfortunately not for the L formula, because the shifted gamma curve in L doesn't map the origin correctly.

So, now I have a gamma curve that seems identical to L, but suggest a better applicability to larger values, and a correct rendition to zero… And given the way that the above formula was derived, and how well it matches the perceptual data that the L formula was meant to represent, it may well have more significance than this.

tl;dr…
(see, the short version really was more interesting!)





Logged
Regards,
~ O ~
If you can stomach it: pictures

Eric Myrvaagnes

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 22814
  • http://myrvaagnes.com
    • http://myrvaagnes.com
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #8 on: October 02, 2011, 01:34:07 pm »


(see, the short version really was more interesting!)

I beg to differ, Oscar. I find both versions interesting, and the longer one is quite informative (even though I do eschew geekiness in most of my own photography).

Eric
Logged
-Eric Myrvaagnes (visit my website: http://myrvaagnes.com)

Tim Lookingbill

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2436
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #9 on: October 02, 2011, 05:22:18 pm »

Could you show us where your newly modified L* curve will deliver better results in the shadows over the established toppled L* curve with the linear portion?

Are you talking about more refined and precise curve tweaks in a Raw converter in an attempt to add definition in the deep shadows or are you talking about just offering a better roll off into the shadows.

There's a weird optical phenomenon that occurs when zooming in (for instance in ACR) to edit deep shadow detail like in shrubbery foliage, the eye adapts to the dark surround where you can now see all these tonal transitions that can be brought out using curve edits. I've spent a good number of minutes amplifying this detail with multi-node micro tweaks using ACR's curve only to see hardly a change in the overall appearance of the image when switching back to the default Medium curve after viewing the entire image zoomed out. Why?

Because human vision is constantly adapting to lightness and contrast changes. When you try to render an image to make it show ALL the detail, it tends to violate this natural human visual response making the image look artificial and just weird.

You geeks need to take this into account other than just rely on mathematical theory. I can see this is a thread only Guillermo and Oscar can understand enough to put to good use. Hope it's useful enough to get a patent on because it sounds like it's useful, but I doubt anyone here can see how it changes things for photography outside of HDR which only works in architectural renderings or anything that has to be pinned down so it doesn't move when shooting bracketed exposures on a tripod.
« Last Edit: October 02, 2011, 05:23:55 pm by tlooknbill »
Logged

stalisman

  • Newbie
  • *
  • Offline Offline
  • Posts: 12
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #10 on: October 03, 2011, 06:36:54 am »

for what it's worth why not take a look at this page:  http://www.21stcenturyshoebox.com/cm/displaygamma/  it helps explains the context for this thread perhaps?


The original Y = 2^(X*X) -1  does indeed match very well the L* curve specified therein.

in the same format '2.2' gamma is written as  Y = X^(0.454545) and '1.8' as Y = X^(0.555556)

The thread original formula has the advantage that it is after all aimed at human perception rather than quirks of electricity and light beams.  Meaning I guess that in monitor calibration it is supposed to modify the natural gamma curve of the hardware ... I am just guessing there.






« Last Edit: October 03, 2011, 06:41:16 am by stalisman »
Logged

Peter_DL

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #11 on: October 05, 2011, 06:59:57 pm »

 
>>  Y = 2^(X*X) -1  does indeed match very well the L* curve  <<
... it loses one of the more useful features of a true gamma curve, which is invariance to multiplication.

Such abandoning of a fundamental theorem seems to me intuitively worrisome (referring to the known commutativity of linear scaling and regular-gamma encoding), but then it is probably the price to pay for assuming a "perceptual" editing sphere. Just like with Lab mode, some of us like it and cool things can be done, however, there is no good representation of Exposure & CT adjustments – at least, not in the usual terms of multiplication. The point is the difference between just mapping data from A to B, and studying the distribution, as opposed to moving data points within A or B spheres. It all depends what you finally have in mind.

Best regards, Peter

--
« Last Edit: October 05, 2011, 07:23:06 pm by Peter_DL »
Logged

stalisman

  • Newbie
  • *
  • Offline Offline
  • Posts: 12
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #12 on: October 06, 2011, 07:04:17 am »

I suppose it ought to be said that the 'new' function on the block is not a gamma function at all, just a run of the mill function that just happens to look the same in the typical areas of interest.

As such it would not automaticaly exhibit the mathematical properties that folks find beneficial / desirable.

I don't know what the 'gamma like' definition of the L* curve is so I don't know if the new function is easier to program.

I do wonder though why folks are mixing  Gamma(2.2) and Gamma(1.8) harware gammas with human perceptual functions (sometimes called gammas) like L* and the new one.
Logged

Peter_DL

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544
Re: Interesting Gamma curve similarity (warning: Geek stuff)
« Reply #13 on: October 06, 2011, 03:19:38 pm »

I do wonder though why folks are mixing  Gamma(2.2) and Gamma(1.8) harware gammas with human perceptual functions (sometimes called gammas) like L* and the new one.

The gentle start of a L* TRC, for example as given with Lstar-RGB, can often maintain a better tonal resolution in the shadows and a better color integrity upon Black point setting. See e.g. David Dunthorn, CFS-243.  However, this is essentially a past discussion since Raw converter typically execute this and other basic operations @ a proper linear-gamma, while just displaying gamma-encoded, somewhat perceptional-comprehensible data.

Peter

--
« Last Edit: October 06, 2011, 03:36:15 pm by Peter_DL »
Logged
Pages: [1]   Go Up