Why do we still apply gamma curves to linear data?

Olcay12

Active member
Messages
54
Reaction score
3
As far as I know, both the CMOS camera sensors and LCD screens have near linear responses. So, why do we still apply TRCs to scene-referred linear data? Why do we see dark images as we look at the linear raw data on our LCD screens?

PS. As noticed, this topic is not a discussion, a question. If you know the answer and trust your knowledge about the subject, please reply clearly, concisely and enlighten me. Please don't direct me to some wiki pages or to any other web sites. Thanks a lot ))
 
Tone mapping is a subject different from gamma. The dynamic range of a high quality image if captured in a single exposure is normally around 8 stops, paper reproduces 7+ stops in high quality printing process. So, tone mapping is not a major concern, low resolution and noisy shadows are to be compressed through a toe of tone mapping curve into a last "stop" on the reproduction ;)
 
... please reply clearly, concisely and enlighten me. Please don't direct me to some wiki pages or to any other web sites.
Iliah Borg wrote:

Also because of a lot of mis-understandings, like "that's how we see, so we need gamma".

Our brightness perception has not a linear relationship with the scene luminance, so it is said that the gamma is there for compensating it. Do you mean that?
Iliah Borg wrote:

Yes, gamma is not compensating for non-linearities of our perception, it rather makes some use of it, saving bandwidth and space.

.


Sometimes a little reading (of knowledgeable authors) is worth the effort for understanding:

http://www.poynton.com/PDFs/Rehabilitation_of_gamma.pdf

http://www.hpaonline.com/wp-content/uploads/2015/02/Poynton-TR2015-PUDI-pp.pdf
I like the part when they say:

"The main purpose of gamma correction in video, desktop graphics, prepress, JPEG, and MPEG is to code luminance or tristimulus estimates (proportional to intensity) into a perceptually-uniform domain, so as optimize perceptual performance of a limited number of bits (such as 8 or 10) in each of the RGB colour components."

They put very strict limitations to the usefulness of gamma that way, but not strict enough.

We use CMYK in pre-press, by the way, and the question of gamma becomes very moot.

All in all, gamma bias of Mr. Poynton seems to be now much less than it was 20 years ago ;)
Relating to matters of (RAW recorded) digital still photography (where at least 16-bit arithmetic is common in RAW processor operations, although Camera DR does not reach that, and Flare/Glare limit to around 11 EV), the Poynton/Funt paper that I linked-to, and that you quoted in part above in your reply also states (appearing near the bottom of page 13):

This paper mainly concerns quantization of each colour component into a fairly small number of bits – say 8 or 10. Where that constraint is lifted, for example where 16 bits are available per component, then perceptual uniformity is still useful, but the ratios of luminance or tristimulus values between codes are lower than the visual threshold (even if components are coded in radiometrically linear, “linear-light” manner).

It seems that "perceptual uniformity" (PU) concerns expressed by Poynton might potentially be more relevant in cases where 8-bit JPEG encoded image-data might be "transmitted" through intermediate software/hardware devices prior to (luminous) display-devices ?

(Regarding the subject of still images), has modern hardware evolved to become more "perceptually uniform" with reference to post-processings of JPEG encoded image-data ?
There is one important word, "coding", that is often missing when they speak of perceptual uniformity. Gamma companding is not about achieving a perceptually uniform look, it is about achieving perceptually uniform coding. Perceptually uniform look is linear.
Understood. It would be less confusing to have simply termed it: "arithmetically sound" ?

Iliah, I know rather little about color related subjects, but I wondered if you might possiby consider/comment upon something that has been puzzling me lately. While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides (shrunken) "gamut sizes" of gamma-corrected color-spaces (?):

Author: Douglas Kerr
Author: Douglas Kerr

Source: "The sYCC Color Space", Douglas Kerr, 2015, Pages 6-7

or are such effects not a substantive problem once inverse gamma-correction takes place ?

.
Another wide-spread dogma is that all sensors have linear or very close to linear response.
You recently wrote (IIRC) that (it seems, due to lowering Read Noise in designs) that it was not uncommon (with regards to recent high quality image sensors) for the (effective) 100% maximum linear record-able level to be set by the ADC maximum input level at (something around) a full factor of 2 (-1 EV) beneath CMOS image-sensor (active) photosite "limits".
Solar battery does not. We routinely use sensor originally designed by NIT to capture images of welding arc, they operate in photovoltaic mode and have native logarithmic response.
PN and PIN photodiodes have maximum capacitance at zero and positive voltage bias (when transduced photo-currents flow through the (PN or PIN) photodiode junction) - which is fine if one has a fairly long time to wait around for a measurement voltage reading. (All sources of) low-level leakage current flows become very important operating in logarithmic mode.

Reverse-bias operating modes are significantly lower in capacitance, where the transduced photo-current that is sensed (at least approaches) a linear representation. Presumably all opto-electronic transducers have some per-device (upper) limit of maximum irradiance ?
 
Last edited:
While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides (shrunken) "gamut sizes" of gamma-corrected color-spaces (?)

SHOULD READ:

While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides [ arising out of ] (shrunken) "gamut sizes" of gamma-corrected color-spaces (?)
 
Last edited:
While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides (shrunken) "gamut sizes" of gamma-corrected color-spaces (?)

SHOULD READ:

While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides [ arising out of ] (shrunken) "gamut sizes" of gamma-corrected color-spaces (?)
Changing gamma or data path width dosn't affect gamut.

Maybe I'm missing your point.

If we truncate the data paths, we can expect to start to see mach banding on smooth intensity or hue ramps.

For sRGB or Bt.709, in unfortunate conditions, we might see mach banding with 9 or (rarely) 10 bits/component (upstream of any dithering).

Bt.2020, with its wider gamut is recomended only at 10+ bits, to avoid mach banding.

Unfortunately, hardly anyone seems interested in the constant-luminance variant of Bt.2020.

Maybe you're talking about what curve would give the best dynamic range for some datapath width and gamut without suffering mach banding.

The "traditional" view seemed to be that just-noticeable-differences tended to be ratios (Weber/Fechner), or follow a power law (Stevens). But if that applies, it might only be in dark enviroments, looking at small light patches, and we might need more complex rules in other environments. I don't know much about what the cognitive psychologists make of this now, except that the viewing environment makes a big difference, which is kinda obvious.
 
There is one important word, "coding", that is often missing when they speak of perceptual uniformity. Gamma companding is not about achieving a perceptually uniform look, it is about achieving perceptually uniform coding. Perceptually uniform look is linear.
So the "encoding front-end" consisting of gamma compression (with inherent bit reduction), YCbCr matrixing and chroma subsampling could be considered an integral part of the encoder, while the counterparts at the playback end could be considered parts of the decoder.

By merging them, we would have better control of what those components does (i.e., the subjective-modelling encoder would know exactly how the bits would be recreated into (some) linear rgb, and could act accordingly).

There are arguments for keeping things the way they are, though. If you want to connect your PC to a tv, chances are that you will be using HDMI. Current HDMI cannot handle linear rgb. One could introduce some future HDMI revision to support linear RGB, but more bandwidth would be needed. HDMI seems to be going in the other direction, supporting 4:2:0 in order to offer 4k resolutions at physically/economically constrained links.
Another wide-spread dogma is that all sensors have linear or very close to linear response. Solar battery does not. We routinely use sensor originally designed by NIT to capture images of welding arc, they operate in photovoltaic mode and have native logarithmic response.
While non-linear sensors do exist, it seems that for most photographers, assuming that their sensor is approximately linear up to a saturation point/region is fair?

-h
 
There are arguments for keeping things the way they are, though. If you want to connect your PC to a tv, chances are that you will be using HDMI. Current HDMI cannot handle linear rgb. One could introduce some future HDMI revision to support linear RGB, but more bandwidth would be needed. HDMI seems to be going in the other direction, supporting 4:2:0 in order to offer 4k resolutions at physically/economically constrained links.
Is this description also applicable to HDMI 2.0? I see 4K TV reviews claiming to display 4:4:4 @60Hz. False?
 
While non-linear sensors do exist, it seems that for most photographers, assuming that their sensor is approximately linear up to a saturation point/region is fair?
Not with a range of Panasonic cameras at lowest ISO, where the highlight linearity limit is approximately 1 stop below the saturation limit ;)

But yes, it is fair in most cases to assume linearity within about 10 stops.

However, let's not lose perspective. Sensor linearity is not a given, and raw linearity is even less of a given, due to flare and glare.
 
While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides (shrunken) "gamut sizes" of gamma-corrected color-spaces (?):

Author: Douglas Kerr
Author: Douglas Kerr

Source: "The sYCC Color Space", Douglas Kerr, 2015, Pages 6-7

or are such effects not a substantive problem once inverse gamma-correction takes place ?
Before even discussing the effect gamma has on the colours, there is a problem of implementation. Gamma companding and de-companding are often performed with different, non-matching accuracy. Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma.

Yes, a flat figure is a poor representation for 3D-gamut, because the section changes shape depending on the luminance:

ab12a054a8004e32acaceedf64fe55b3.jpg.png

9b0727f846894cea89a6bb5259e1f56c.jpg.png

The rest boils down to quantization error when coding and decoding, and special attention needs to be payed to the cases of strongly-coloured regions, where the "weak" channel is in fact what adds texture (like blue channel is essential for skin, in terms of details).
You recently wrote (IIRC) that (it seems, due to lowering Read Noise in designs) that it was not uncommon (with regards to recent high quality image sensors) for the (effective) 100% maximum linear record-able level to be set by the ADC maximum input level at (something around) a full factor of 2 (-1 EV) beneath CMOS image-sensor (active) photosite "limits".
Yes.
Solar battery does not. We routinely use sensor originally designed by NIT to capture images of welding arc, they operate in photovoltaic mode and have native logarithmic response.
PN and PIN photodiodes have maximum capacitance at zero and positive voltage bias (when transduced photo-currents flow through the (PN or PIN) photodiode junction) - which is fine if one has a fairly long time to wait around for a measurement voltage reading. (All sources of) low-level leakage current flows become very important operating in logarithmic mode.
Yes, but it is a very important and promising strategy, research is pretty well-funded. They also work on low-flare lenses and coatings.

--
 
Before even discussing the effect gamma has on the colours, there is a problem of implementation. Gamma companding and de-companding are often performed with different, non-matching accuracy. Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma.
Could you explain "LUTs advertised as 10+bits have only 7 bits reserved for gamma", please ?

I fear I have difficulty understanding the idea of "reserving bits for gamma" in a LUT.

In practice, this stuff is often implemented by PieceWise-Linear ("PWL"), or possibly piecewise-quadratic, blocks.

Possibly multi-dimensional PWLs.
 
Last edited:
Before even discussing the effect gamma has on the colours, there is a problem of implementation. Gamma companding and de-companding are often performed with different, non-matching accuracy. Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma.
Could you explain "LUTs advertised as 10+bits have only 7 bits reserved for gamma", please ?
Just that's the way some do it.
 
Before even discussing the effect gamma has on the colours, there is a problem of implementation. Gamma companding and de-companding are often performed with different, non-matching accuracy. Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma.
Could you explain "LUTs advertised as 10+bits have only 7 bits reserved for gamma", please ?
Just that's the way some do it.
Sorry, maybe I'm being dense.

What is "the way that some do it" ?

Like I said, I still don't understand what you meant by "Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma."

I can think of some things that might mean, but I don't know what you meant. At first reading, it doesn't make sense to me.
 
Last edited:
The rest boils down to quantization error when coding and decoding, and special attention needs to be payed to the cases of strongly-coloured regions, where the "weak" channel is in fact what adds texture (like blue channel is essential for skin, in terms of details).
Indeed.

Here is a photo of Megan, with the channels broken out to approximate their relative contribution to luminosity, with everything rescaled to green = 100%.

9b75d224ebf9435b8d5f04e482c4a99d.jpg

The blue channel is rather weak, but it has a lot of skin texture there, which is rather striking when compared to the red channel.

--
 
I still don't understand what you meant by "Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma."
I said all I could, sorry.
Not convinced you've been talking sense, I'm afraid. Not that I don't think you can talk sense about other stuff.

Maybe your friends should try knocking together synthesisable PWQs in matlab.
 
While gamma-corrected compression (per color-channel) can (only potentially) squeeze more (effective) "bits" into a given data-path leading to subsequent processing systems, do there exist corresponding down-sides (shrunken) "gamut sizes" of gamma-corrected color-spaces (?):

Author: Douglas Kerr
Author: Douglas Kerr

Source: "The sYCC Color Space", Douglas Kerr, 2015, Pages 6-7

or are such effects not a substantive problem once inverse gamma-correction takes place ?
Before even discussing the effect gamma has on the colours, there is a problem of implementation. Gamma companding and de-companding are often performed with different, non-matching accuracy. Quite a few LUTs advertised as 10+bits have only 7 bits reserved for gamma.
Not a trouble-free situation (where the format decoding is performed by unknown devices).
Yes, a flat figure is a poor representation for 3D-gamut, because the section changes shape depending on the luminance:

ab12a054a8004e32acaceedf64fe55b3.jpg.png

9b0727f846894cea89a6bb5259e1f56c.jpg.png

The rest boils down to quantization error when coding and decoding, and special attention needs to be payed to the cases of strongly-coloured regions, where the "weak" channel is in fact what adds texture (like blue channel is essential for skin, in terms of details).
My thought was that if it is the case that the size of a 2-D projection of some gamut-space limited the number of usable individual tone-values (particularly surrounding 8-bit data) then that would (in such a case) seem to potentially introduce significant in-process quantization errors. Is it (then) not the case that such a (2-D) description (alone) suffices ?

Interesting about Blue-channel data. I often find it quite important for "details" (in general).
You recently wrote (IIRC) that (it seems, due to lowering Read Noise in designs) that it was not uncommon (with regards to recent high quality image sensors) for the (effective) 100% maximum linear record-able level to be set by the ADC maximum input level at (something around) a full factor of 2 (-1 EV) beneath CMOS image-sensor (active) photosite "limits".
Yes.
Solar battery does not. We routinely use sensor originally designed by NIT to capture images of welding arc, they operate in photovoltaic mode and have native logarithmic response.
PN and PIN photodiodes have maximum capacitance at zero and positive voltage bias (when transduced photo-currents flow through the (PN or PIN) photodiode junction) - which is fine if one has a fairly long time to wait around for a measurement voltage reading. (All sources of) low-level leakage current flows become very important operating in logarithmic mode.
Yes, but it is a very important and promising strategy, research is pretty well-funded.
Found this on a Harvest Imaging blog-page (published in 2011):

Yang Ni (New Imaging Technologies) : “MAGIC : Logarithmic Image Sensing using photodiode in solar cell mode”.

A classical method of doing wide dynamic range is the use of logarithmic pixels based on a transistor operating in weak inversion. This solution is giving quite a bit of FPN, is suffering from a low sensitivity and shows a large image lag. NIT has changed the concept of the logarithmic pixel : the photodiode is used in the solar cell mode, and the voltage across the PD is a logarithmic function of the current generated by light input.

Advantages: physically exact dark reference (no light input means 0 V across the diode), on-chip FPN correction, high sensitivity, no image lag. The noise in this logarithmic mode pixel is equivalent to the noise of a 3T pixel, being the classical kTC noise (around 500 uV). This noise level is constant in the logarithmic mode. It does limit the dark performance of the sensor, but does not limit the dynamic range of the sensor.


Source: http://harvestimaging.com/blog/?m=201103

.

I have long been a lover of various analog/digital logarithmic converter schemes (Gilbert "style" log-antilog current amplifiers and analog computational device-blocks). Designed, developed, built and tested a logarithmic ADC (using an exponentially discharging first-order filter) that compressed around 8.33 bits into 5 bits, and (using IR light) transmitted the logarithmically converted/scaled data up to ~60 Feet, modulated at an ~80 KHz pulse-rate.

Used a 9 PIN-photodiode receiving array (operating in linear mode, into a summing-node) into an active bandpass filter and subsequent (frequency dependent hysteresis) pulse detector followed by digital averaging (via the integration/summation) to produce the telemetry system output. Generated/detected pulses existing within a fixed transmitter determined time-window (to avoid the messy quirks of coherent detectors/demodulators).
 
Last edited:
My opthalmologist tells me that human vision is not linear with respect to luminance -- it is logarithmic (or exponential, depending on your perspective). A gamma curve transforms linear data to logarithmic/exponential to approximate human vision.

It is similar to hearing. For example middle A is vibration at 440 hertz. A below middle A is vibration at 220 hertz. A above middle A is vibration at 880 hertz.

David Dollevoet
 
My opthalmologist tells me that human vision is not linear with respect to luminance -- it is logarithmic (or exponential, depending on your perspective). A gamma curve transforms linear data to logarithmic/exponential to approximate human vision.
When the image is displayed on your monitor, the gamma is canceled out. And the gamma curve is not exponential or logarithmic.
 
My opthalmologist tells me that human vision is not linear with respect to luminance -- it is logarithmic (or exponential, depending on your perspective). A gamma curve transforms linear data to logarithmic/exponential to approximate human vision.
When the image is displayed on your monitor, the gamma is canceled out. And the gamma curve is not exponential or logarithmic.
There is the æther, a space-filling substance, between the monitor and our eyes. Æther is responsible for the compression of the light according to logarithmic/exponential law.
 

Keyboard shortcuts

Back
Top