How to determine 'middle grey' in image processing?

Hey there,

there are a lot of discussions going on about the new workflow and how to use the different modules. Often there’s talk about ‘middle grey’ and that this is usually the point your main object should have.

I always thought, there’s standard definition of what ‘middle grey’ actually is, but after looking up, I found several different values defined depending on which colour space or model is used. So I struggling a bit, on how to determine if my main object is in the range of middle grey.
Filmic has a colour picker for it, so that’s quite easy and I don’t have to care, which value middle grey actually is. But if I’m using the exposure module, I can choose a percentile and there’s no indicating, which part of the image actually corresponds to which percentile.

So I wonder, how you guys set or control your grey point in post? Are using the general colour picker in the left menu? I also saw some people using the tone curve to check, but then, which value is right? Wikipedia mentions 6 different values for middle grey.

Middle grey is the “18% grey” your camera usually exposes for. In gamma-corrected color spaces (like sRGB) middle grey is close to the color #888, ie 50% grey.

What should be middle grey in a picture depends on what’s inside, obviously. My process is usually to leave filmic with a 18.45% middle grey, then tweak the exposure until the main subject of my picture looks right.

I define middle grey manually according to my taste. If you want a reference, you can buy a grey card set for a few bucks containing a standardized middle grey:

Okay, so you adjust the brightness of your main subject to your liking and not to a specific number or value. That’s not surprising and is an answer I’d expected. :wink:

Maybe it’s because I like numbers for reference, but I was looking for a more consistent approach, especially if one is not exposing for the subject but uses ETTR. I thought that setting my main subjects brightness to middle grey, would be a starting point. Obviously this should be an equal value for all images, e. g. a value of 50 in Lab.

I guess, the most simple solution is to just use the middle grey slider in filmic to set the main subjects brightness, which limits the usefulness of the exposure module quite a lot. :thinking:

Setting a middle gray should be about knowing a particular patch in the scene should be gray, and setting the exposure so that patch’s RGB values are 18% of the ‘distance’ to white.

For ETTR, my first consideration in post would be to use exposure put the very highest exposed values right up against white. Then, if there’s a patch I want to be 18% gray and it’s not, I might consider a non-linear curve to pull or push it there. But I’ve never done that. To my thinking, I wouldn’t need to consider that unless I were delivering content that was to be integrated with others’; taking us to the “scene-referred” concept we’ve discussed here previously.

Please note the above is a generic cogitation, maybe not directly related to the darktable filmic module…

We all have our way of doing things and that is also true for setting middle grey.

My approach is using a combination of the exposure module and the rgb curve module.
The exposure module will be used to set the middle grey and the rgb curve module is used for selecting/referencing.

How does this work? Here’s a simple example:

After opening an image you activate the exposure module and open the rgb curve module:

You then turn off compensate middle grey and turn on the extended picker. Select the area/subject that needs to be set to middle grey (part of the branch in this example) :

Notice the vertically, dimmed white line with the pink/red around it? That needs to be adjusted to the middle grey point. Each vertical block/square in the rgb curve histogram represents 20%. Far left0% (black), far right 100%(white). You need to play with the exposure setting until the vertical white line is near the right of the first block:

BTW: shortcuts will make switching back-forth between exposure and rgb curve unnecessary.

The branch is now set to middle grey.

If I would have selected the leaves top left the result would have looked like this:

Nobody cares about the value of middle grey. It’s just a math anchor to unroll image processing algos. There is no truth in it. Normalized small dynamic range RGB spaces place it between 18 and 20% luminance, display-referred. Normalized spaces are useful when dealing with non-normalized input and output spaces, so they serve as connection spaces.

Middle-grey is just a concept of an average luminance value, at equal distance between “white” (or max luminance) and “black” (or min luminance). And because, these days, “white” can mean “diffuse white patch at 20% reflectance” or “specular highlights in HDR”, middle-grey is a better anchor than white.

No. Your main object should have the luminance value you want it to have. But in well-exposed image, that luminance often falls close to standard middle grey. So, you might use that property to setup your exposure a priori in case you are lost. But it is a posteriori statistical description, not a an image-processing prescription.

Does it look good ?

  • if yes, keep it this way
  • if no, change it.

You should really relax with numbers (says the guy doing maths).

Except if you have several light sources (and every image is at least direct light + bounced light), you have several “whites” and several “middle-greys”, so you still need to choose which one is your exposure anchor.

4 Likes

I would add that a gray card reflects a particular proportion of incident light. This is useful for standardizing a series of photos. It typically reflects about 18% of incident light, because someone sometime determined this was the average reflectance of “typical” photographic scenes.

But a photo that includes the sky has reflected plus direct light. It may contain elements that are brighter than a 100% reflector would be, perhaps by many stops (ie many powers of two). Hence, a gray card should not always be assumed to be a required “middle” gray.

That’s something, I’ve been looking for. Thanks!

I know, but that’s not easy. :wink: In the past I did better and didn’t care about numbers, but the more I red the more I feel like image processing is a complex thing and this makes me feel like numbers could help to provide some kind of anchor.

Numbers are meaningless till you give them context. It’s like in that Dr who meme:

  • “Is 4 a lot?”
  • “Depends on the context! Dolars? no. Murders? Yes”

as @anon41087856 said - “middle gray” is not a value. It’s a concept :slight_smile:

In situations like this I recommend going to https://hg2dc.com/ and reading everything there :slight_smile: It’s updated every now and then so it helps to be subscribed.

2 Likes

Samuel L. Jackson describing light and color… oh wait, I know that moniker…

Really, though, an excellent treatise.

Numbers are there because pixels are represented by some value. So we can’t escape doing maths on pixels. However, whatever value you read is code for something. Math is a language, numbers are representations of some quantity. Bothering about numbers is like bothering about words in a text. You don’t care about individual words, you care about their meaning.

We are tackling fundamental epistemology here.

Image processing uses models, like science does. Models represent something real in an abstract way that allows general cognition. Using models is nice to get away from empiricism and particular cases.

Your display is modeled as an electron to photon converter. Using that model, we can derivate an (ICC) profile that links input (RGB code values turned into voltage) to output (light interprated as color by the human). That model is based on some assumptions, for example 100% luminance means media white, and RGB values are bounded in [0-100]%. But your actual display can be standard sRGB in dim surround or a custom HDR stuff with a gamma 2.6 in bright surround, it doesn’t matter, as long as we have a standard display against which the non-standard display is profiled. As long as we know how to go from standard RGB space to non-standard display space (which is what the ICC profile is for), we don’t care.

So, whenever you stumble upon some “standard” value for stuff (like middle grey), you need to assert in which standard it belongs, and what the assumptions/expectations of that standard are. Because there are many standards for many uses.

For example, it took me years of diving into color management to finally learn (thanks Troy) that sRGB is a color space meant for dim surround lighting. So, whenever you save or display a JPEG sRGB file, some brightness compensation should be applied to simulate dim viewing conditions if you are not in a dim surround. Well, nobody does that. But using sRGB specs to display whatever in a bright surround will fail. Yet nobody cares.

So, 18% middle grey is part of a standard. Your camera RGB space is not standard, and your display RGB space is probably not standard either. A standard is only a connection space to go from one input/output medium to another, or work images in a reproductable way (for example, if you need to apply styles/presets/batch processing, you need to remove image peculiarities first).

Going from/to standard to/from non-standard only needs a transform. ICC profiles define a kind of transform. Unfortunately, no ICC profile will be able to say where the actual middle-grey is in your sensor raw image, because it depends on your hardware exposure. So you need to define that transform yourself, using digital exposure compensation, to shift the raw mid-tones until they match your display mid-tones.

The only question you need to ask yourself when editing is “how bright is bright enough to see midtones”. The actual value of middle-grey is none of your business, since every color space conversion takes care of that.

3 Likes