Pages: [1] 2   Go Down

Author Topic: Does changing exposure (camera or pp) produce hue shifts? (ETTR and HDR related)  (Read 8597 times)

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com

In this thread, an off topic about hue shifts when modifying exposure has arised. My opinion is that:
  • A sensor is a linear photon counter, so changing exposure in the camera won't change captured hue in the RAW file, which only consists in RGB ratios (proportional photon counts in the CFA)
  • For the same reason, changing exposure in postprocessing should never produce hue shifts as long as it consists in a linear scaling of all RAW values by a constant number

In the real world these hue shifts happen when using common RAW developers. However it is not due to the physics of digital cameras but because of the way commercial software is implemented: non-linear processing (exposure dependent colour profiling, gamma, shadow/highlight recovery strategies,... whatever they put into the black box) ruins the linear properties of RAW data. Fortunately these hue shifts are not huge, so perhaps only colour peepers should worry about them.

I can think however of two real world cases where moderate/strong exposure adjustments are common:
  • ETTR, where camera exposure is deliberately set to a different value from the desired output image exposure in order to push it back in postprocessing
  • HDR, where a row of bracketed shots will be merged to form a single output composite, involving strong exposure correction inside the blending algorithm

To prove that in both cases hues can (if properly manipulated) be preserved unaltered, I have used Zero Noise to perform the exposure correction from a bracketed series of 5 shots 1 stop apart over the same colourful scene, so that all images get the same exposure as the least exposed in the set. ZN is a piece of software I trust because I coded it and it performs exposure correction by linearly scaling the RGB input values from the also linearly developed DCRAW output TIFF files. It not only applies the exposure correction but numerically calculates with high precision the needed scaling factor according to exposure levels in the RAW data (ignoring EXIF info).

As can be seen (the 5 images can be ovlerlapped in Photoshop for comparision), all colours match perfectly:












These were the relative exposures by which the 4 most exposed shots were corrected down (the +1EV was corrected by -0,93EV, the +2EV was corrected by -0,93-1,04=-1,97EV and so forth):




The only slight hue difference occurs in the dark areas of the least exposed shot. It is a blue tint specially visible in the B channel of the rendered image, and it is not because of the exposure correction of the higher exposure shots but because of sensor read noise in the least exposed shot itself. In other words: the exposure corrected images got the right hue!.

(100% crops)



Regards


« Last Edit: April 22, 2015, 01:53:28 pm by Guillermo Luijk »
Logged

bernie west

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 323
    • Wild Photo Australia

A question about colour spaces, thrown in amongst this:

How does colour space affect the linear rgb transforms?  My knowledge of colour spaces is rusty, so I could be way off the mark here... is it a case that a linear rgb transform in one colour space wouldn't equal a linear transform in another space if the original and the transformed where shifted to that other space?  So, if I had an image in prophoto and did a linear rgb scale on it like you've done, Guillermo, and then transformed both the original image and the scaled image to sRGB, would they show a linear relationship in sRGB?  i.e. would the r:g:b ratios be the same?
Logged

Simon Garrett

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 742
« Last Edit: April 20, 2015, 06:57:27 am by Simon Garrett »
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com

A question about colour spaces, thrown in amongst this:

How does colour space affect the linear rgb transforms?  My knowledge of colour spaces is rusty, so I could be way off the mark here... is it a case that a linear rgb transform in one colour space wouldn't equal a linear transform in another space if the original and the transformed where shifted to that other space?  So, if I had an image in prophoto and did a linear rgb scale on it like you've done, Guillermo, and then transformed both the original image and the scaled image to sRGB, would they show a linear relationship in sRGB?  i.e. would the r:g:b ratios be the same?


As long as the profile conversion is performed using a linear matrix (like DCRAW does) there is no change in the result:

Rout = Rin * a11 + Gin * a12 + Bin * a13
Gout = Rin * a21 + Gin * a22 + Bin * a23
Bout = Rin * a31 + Gin * a32 + Bin * a33

If we now scale (Rout, Gout, Bout) by K we get (Rout', Gout', Bout') = (K * Rout, K * Gout, K * Bout)

What if we had scaled (Rin, Gin, Bin) by K prior to the conversion? (K * Rin, K * Gin, K * Bin)

Rout' = (K * Rin) * a11 + (K * Gin) * a12 + (K * Bin) * a13 = K * (Rin * a11 + Gin * a12 + Bin * a13) = K * Rout
Gout' = (K * Rin) * a21 + (K * Gin) * a22 + (K * Bin) * a23 = K * (Rin * a21 + Gin * a22 + Bin * a23) = K * Gout
Bout' = (K * Rin) * a31 + (K * Gin) * a32 + (K * Bin) * a33 = K * (Rin * a31 + Gin * a32 + Bin * a33) = K * Bout


The problem is that colour conversions in commercial software are not likely to behave this way; I recall conversations in the forum confirming ACR profile conversions are not so straightforward. They are more complex, surely for a good reason, but losing linearity.

Then you have the added difficulty that some popular colour spaces (e.g. sRGB) don't have a pure gamma. The sRGB gamma curve again breaks the ideal linearity while Adobe RGB and ProPhoto RGB pure gammas don't.

Regards
« Last Edit: April 22, 2015, 01:49:51 pm by Guillermo Luijk »
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1862
    • Frank Disilvestro

Two comments

1) Adobe implementation of the AdobeRGB color space is not a pure gamma, but a linear slope and then a gamma. (refer to http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf on page 20)

2) The potential issue with the scaling before or after the conversion is if the results are truncated or not. I mean, after you convert to a color space, the negative values and those above 100% are truncated since they cannot be represented by a phisical device (mostly they are Out of Gamut values)

If the scaling after conversion is performed on the truncated data, then it would make a big difference, especially in color saturation.

In my experience, not al raw converters handle ETTR well. LR is Ok, DxO is not good (at least until version 8)

Rawtherapee is an example of a raw converter that allows you to scale the raw values before demosaicing.

joofa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544

A question about colour spaces, thrown in amongst this:

How does colour space affect the linear rgb transforms?  My knowledge of colour spaces is rusty, so I could be way off the mark here... is it a case that a linear rgb transform in one colour space wouldn't equal a linear transform in another space if the original and the transformed where shifted to that other space?  So, if I had an image in prophoto and did a linear rgb scale on it like you've done, Guillermo, and then transformed both the original image and the scaled image to sRGB, would they show a linear relationship in sRGB?  i.e. would the r:g:b ratios be the same?

If it is a simple linear scaling then, yes. But, if it is non-uniform scaling, or in the general case, no.
Logged
Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8915

1) Adobe implementation of the AdobeRGB color space is not a pure gamma, but a linear slope and then a gamma. (refer to http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf on page 20)

Hi Frank,

Not exactly, according to the link you provided, it only uses a simple gamma value (2.19921875) for all three channels.
Quote
The inverse color component transfer function shall be a simple power-law function using a gamma value of 2.19921875,

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

Plateau Light

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 52
    • Robert Park Fine Art Photographer

I am in total agreement. I use either capture1 pro n the linear raw mode or Camera Raw with a linear DNG variant profile. Even with the linear DNG profile there is still some issue with ACR vs C1. I use this workflow to photograph flat repro work where I don't want an added contrast curve that effects the reproduction.

I will have to look into your converter for my repro work and give it a try.
Thanks for the info and work
.

AlterEgo

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1995

I use either capture1 pro in the linear raw mode

the only more or less close to linear mode in C1 is to appropriate "linear scientific" curve intended for C1 CH edition, which is thankfully available in a regular editions too
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1862
    • Frank Disilvestro

Hi Frank,

Not exactly, according to the link you provided, it only uses a simple gamma value (2.19921875) for all three channels.
Cheers,
Bart

Hi Bart,

On page 20 it states that there is an implementation aspect that limits the slope to 1/32,

Quote
Many color converters and products impose slope limits on gamma curves found in the rTRC, gTRC, and bTRC tags of ICC profiles. For an arbitrary slope limit of x (where x < 1), the effective
gamma curve as used in the color converter has a slope of x or greater.

When used with the Adobe RGB (1998) ICC profile, the slope limit should not be greater than 1/32. A slope limit of 1/32 affects 8-bit integer values 1 to 14.

At the time of writing, the Adobe color conversion engine, ACE, included with Adobe Photoshop and other products from Adobe Systems, imposes a slope limit of 1/32. The effective inverse transfer
function for Adobe RGB (1998) when used with ACE thus becomes:

C = Max (C'^2.19921875 , C'/32)  for C’ in the range [0, 1]

Note that the above slope limit is an implementation aspect, not an attribute of the Adobe RGB (1998) color space encoding. Different implementations may use different slope limits.

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8915

Hi Bart,

On page 20 it states that there is an implementation aspect that limits the slope to 1/32,

Quote
Note that the above slope limit is an implementation aspect, not an attribute of the Adobe RGB (1998) color space encoding. Different implementations may use different slope limits.

That's it, it's not part of the Adobe RGB space encoding, but something that some implementations (e.g. Adobe Conversion Engine) may (or may not) additionally apply to the image data afterwards for an inverse transform. Since the image file data is already gamma pre-compensated (by approx gamma 1/2.2) there is plenty precision in encoding the lower levels, but the inverse transform (back to 'linear gamma') may lose precision because some different values can become the same value. It is a kludge that is used for not working with adequate numerical precision.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

Jim Kasson

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2370
    • The Last Word

In this thread, an off topic about hue shifts when modifying exposure has arised. My opinion is that:
  • A sensor is a linear photon counter, so changing exposure in the camera won't change captured hue in the RAW file, which only consists in RGB ratios (proportional photon counts in the CFA)
  • For the same reason, changing exposure in postprocessing should never produce hue shifts as long as it consists in a linear scaling of all RAW values by a constant number

In the real world these hue shifts happen when using common RAW developers. However it is not due to the physics of digital cameras but because of the way commercial software is implemented: non-linear processing (exposure dependent colour profiling, gamma, shadow/highlight recovery strategies,... whatever they put into the black box) ruins the linear properties of RAW data. Fortunately these hue shifts are not huge, so perhaps only colour peepers should worry about them.

I can think however of two real world cases where moderate/strong exposure adjustments are common:
  • ETTR, where camera exposure is deliberately set to a different value from the desired output image exposure in order to push it back in postprocessing
  • HDR, where a row of bracketed shots will be merged to form a single output composite, involving strong exposure correction inside the blending algorithm

There's another thing that can cause hue shifts on PP, and that's improper black point subtraction, either in camera or in post.

The Leica M240 suffers from improper black point subtraction at low ISOs that can cause green shadows when the images are pushed.

http://blog.kasson.com/?p=6717

At high ISOs, the improper subtraction either doesn't occur, or is of lesser consequence because the signal levels are higher.

In the D810, the nominal black point is 600. I have observed ISO-dependent small departures from that value in dark-field photographs.

It is also possible to have hue shifts that are non-uniform, if local heating changes offsets.

Jim

AlterEgo

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1995


It is also possible to have hue shifts that are non-uniform, if local heating changes offsets.



and sensor "stitching"
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com

A seamless composite in animated GIF:

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com

Another test: two shots over a colourchecker card 2 stops apart. The inner sub-patches correspond to the lower exposure RAW file:




Once exposure is linearly matched the sub-patches become invisible (just the darkest ones are very slightly recognisable in 100% crops by the presence of noise):



Regards
« Last Edit: May 09, 2015, 05:35:44 am by Guillermo Luijk »
Logged

alain

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 465

Another test: two shots over a colourchecker card 2 stops apart. The inner sub-patches correspond to the lower exposure RAW file:




Once exposure is linearly matched the sub-patches become invisible (just the darkest ones are very slightly recognisable by the presence of noise):



Regards


Very nice example, thanks
Logged

Jim Kasson

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2370
    • The Last Word

Another test: two shots over a colourchecker card 2 stops apart. The inner sub-patches correspond to the lower exposure RAW file:


Once exposure is linearly matched the sub-patches become invisible (just the darkest ones are very slightly recognisable by the presence of noise):



Elegantly done!

Jim

BobShaw

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2235
    • Aspiration Images

Does changing exposure produce hue shifts?

If you are working in RGB then my understanding is it has to change the hue if you change luminance.
An RGB space is like a rugby ball lying on its side. If the valve is up then the white is where the valve is and black is at the bottom. All reproducible colours are somewhere in the middle. Moving up or down (changing luminance) will change every red, green and blue value. as there is no separate value for luminance.

Peter Eastway (who knows more about colour management than I will ever know) says that if you use the LAB colour space you overcome the problem because L (luminance) is changeable without changing the A and B values, which are the colour.
Les Walkling (who has forgotten more about colour management than I will ever know) says LAB doesn't completely overcome it, but working in HSL does. You then have complete control over Hue, Saturation and Luminance directly.

Whatever. In short, the answer is yes.
Logged
Website - http://AspirationImages.com
Studio and Commercial Photography

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com

This is not the question I wanted to answer. I am not interested in finding out how hue changes in colour models like L*a*b, HSL,... when exposure is modified (after all they are just numerical models, not real hues which would need an spectral description), but if hues are going to differ if we change exposure in the camera AND compensate for this in pp. So the images that are to be compared have always THE SAME FINAL EXPOSURE.

In other words, I want to know how interchangeable camera and pp exposure are. Perhaps I didn't choose the right title for this thread.

This is the test that answers key questions such as:
  • Will my colours change if I practice ETTR to reduce noise?
  • Will my colours change if I deliberately underexpose a bit (ETTL) in order to better preserve highlights information?
  • Will necessarily my colours change if I shot a bracketing for HDR and the blending algorithm picks the higher exposure shots and corrects them down in the software?
  • Will my colours change if I make an exposure mistake in the camera and rely on the RAW developer's exposure slider to fix it?

And the answer to these questions is: as long as the software exposure correction is properly applied (exact amount of stops and linear process), colours remain identical.

The only diferences can ocurr in the dark areas, where noise and imprecise black point substraction (as Jim mentioned), can end in hue shifts/tints in the lower exposure shots. This means increasing exposure for ETTR for instance not only doesn't create false colours, but can improve colour accuracy!.

Regards
« Last Edit: May 08, 2015, 04:39:12 am by Guillermo Luijk »
Logged

BobShaw

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2235
    • Aspiration Images

Sorry, the question was Camera or PP>
In the camera it is raw, so I don't expect it would change the colour. Even if you shoot jpg the processing would be raw.
However in PP you are in RGB usually.
Logged
Website - http://AspirationImages.com
Studio and Commercial Photography
Pages: [1] 2   Go Up