Image luminosity

Hi,

I am brand new to GIMP and am trying to statistically match 2 picture sets on brightness, contrast, and luminosity for a psychology research study. I’ve done a ton of online searching and figured out how to find values for brightness and contrast. Using the histogram, I used the mean of the “Value” channel to determine each picture’s brightness, and the standard deviation of the “RGB” channel to identify contrast.

However, I am at a standstill for extracting values for each image’s luminosity. Please let me know if you’re aware of how I may go about this. I know spatial frequency can be used, but am unable to locate the value for each image in GIMP.

Thanks!
Will

GIMP’s “Value” channel actually just takes the maximum of the R, G, and B channel values. So whatever you might mean by “brightness”, it’s not likely to have any psychologically straightforwardly meaningful relationship to GIMP’s “Value” channel. Another potential problem with this metric is that the maximum of R, G, and B do vary depending on what color space the pictures are in when you check the histogram, and will vary depending on the color space primaries and tone response curve

Regarding the standard deviation of the RGB channels as a measure of whatever you mean by “contrast”, this also depends on the color space’s primaries and tone response curve.

“Luminosity” is an ambiguous term. You might mean “relative luminance”. If you download an appimage for GIMP-2.9.8, the histogram provides information on relative luminance. But then you’ll have to decide if you want to use the “linear histogram” or the “perceptually uniform (meaning the sRGB TRC encoding) histogram”.

“Brightness” is also ambiguous unless you specify some sort of framework, such as CIECAM02 with its measures of brightness and lightness.

A useful metric for “contrast” surely depends on what you mean by contrast, which in turn probably depends on what information you are trying to extract from your research subjects’ responses to the two different sets of images.

I don’t mean to say that the metrics you are thinking about using for whatever you might mean by “luminosity”, “contrast”, and “brightness” are inadequate to capture whatever subject responses you are interested in capturing for your study. It’s just that the terminology you’ve used is open to interpretation, and the metrics you’ve described are ambiguous until you specify an RGB working space, which I’m guessing you are using sRGB. So although your questions sound perfectly straightforward and unambiguous, they really aren’t.

It might be that something like your proposed metrics are absolutely perfect for capturing whatever it is you are interested in for your study. And it might be that really you need to delve into color appearance models and come up with better metrics.

1 Like

Hey Elle,

Thanks so much for your quick and detailed response. My definitions for brightness and contrast in GIMP were pulled from this online source: 2.5. Histogram dialog. However, luminosity was not described anywhere.

I can appreciate that there’s significant ambiguity in defining brightness, contrast, and luminosity characteristics. For the study I am doing, the results are driven by picture content rather than picture characteristics. I’m really just trying to avoid picture characteristics confounding content-related findings. Hopefully, that helps clarify how particular I’m going with this.

Thanks,
Will

@Wmusc It depends on what your research is about and how technical you are willing to get. Unless you give us the specifics, we won’t know what to recommend you. E.g., what are your hypothesis and research methods?

So, I just googled “brightness vs luminosity”, and got a boatload of returns from the astronomy crowd. They have a rather specific distinction between the two, but I don’t think it’ll help you characterize photographs. Well probably not; won’t know for sure until you tell us a bit more about your objective. I do believe you’re in the right place to discuss it; there are a goodly number of folk here who are adept at the ways of imaging and color… oh, not me, I’m just learning from them. I do understand research, however; what @afre asked of you would be helpful in helping you find the best measurements for your endeavor.

Yes, exactly. Brightness and luminosity both have technical meanings in astronomy. By “technical” I mean well-defined and accepted concepts defining properties of objects in the sky, which properties can be measured using particular instruments designed to measure such things.

“Brightness” has a technical meaning in color appearance models, which is relevant to color perception and also to algorithms provided in photographic editing applications that support CIECAM02 (or other color appearance model), but it’s not the same as “brightness” in astronomy.

GIMP (I mean GIMP-2.9, I don’t use GIMP-2.8) doesn’t support CIECAM02 or other color appearance model, though it does support LAB (GIMP-2.8 LAB has serious errors, don’t use it), which is a color difference model.

RawTherapee does support CIECAM02, but using this module wisely requires learning a bit about color appearance models. I’m not really sure how easy it would be to use the RT module to extract “metrics” for one image vs another image.

In photography and image editing, “luminosity” is a totally non-technical term used by different people to mean different things. One meaning is a “feeling” of “oh, that photograph is so luminous!” (whatever that might mean), and eliciting this “feeling” is a goal for certain tutorials on image editing. Another meaning is “luma”, which is well-defined (look it up in Wikipedia) . Another is “relative luminance”, which is also well-defined (look it up in wikipedia).

Well, that page uses “bright” in a very non-technical, general sense of “this looks brighter than that”. As I already noted, the Value “channel” is the maximum of the R, G, and B channel values. This is a very poor metric for “how bright” something is. Using the Value "“channel” as a metric for brightness would tell you that solid sRGB blue (0,0,255), red (255,0,0), green (0,255,0), yellow (255,255,0), and white (255,255,255) are all equally “bright”, which is clearly not the case whether by “bright” you mean “appearance of brightness” or “relative luminance”:

equal-value-channels-vs-brightness-luminance

Using the Value “channel” (it’s not really a channel, it’s the maximum of the R, G, and B channels) as a metric for “brightness” also would also tell you that sRGB red is equally as bright as AdobeRGB red. But if you put samples of each red side by side in a paper print or on a monitor with a color gamut large enough to hold both colors without clipping, you would easily see that AdobeRGB red is brighter than sRGB red.

There are two technical metrics that reflect non-technical uses of “bright” in photography. One is relative luminance, which is well-defined and for which formulas are easily found on the internet, though sadly many of the available formulas are “wrong/only apply to a specific color space/fail to account for the color space tone response curve”.

The other is brightness, which is a matter of how we actually perceive colors. The difference between relative luminance and brightness is easy to illustrate: Take two colors with the same relative luminance, and make one of the colors low-chroma or even gray, and make the other color for example a very saturated red. The red will look “brighter” than the gray, even though the same amount of light will be reflected by both color samples. In other words, brightness is a matter of “color appearance”, whereas relative luminance is a matter of how much light is reflected from a surface, relative to whatever has been defined as “white”, which in a photograph will be “paper white” if the image is printed, or “monitor white” if displayed on a screen.
relative-luminance-vs-brightness

In the above image, we perceive the red square in the middle as “brighter” than the surrounding gray, even though both colors have the same relative luminance. This perception of “brighter” is a matter of color appearance models and is not captured by any metric available in GIMP.

4 Likes

Regarding “luminosity” for GIMP-2.8, and also regarding the inadequacies of “Value” as a substitute for anything useful, see this section of this article:

Regarding “brightness” and “contrast”, in image editing these terms usually refer to algorithms that allow you to move the entire histogram up or down (change “Brightness”) and also allow you to expand or contract the histogram (change “Contrast”). Neither of these algorithms provides a metric.

Regarding “ambiguity in defining”, I’ve been trying to provide context for removing said ambiguity. The stuff that’s calculated and displayed in GIMP’s histogram isn’t ambiguous - it’s just a bunch of statistical calculations, which might or might not be useful in capturing “something” that you might be interested in, regarding an image having characteristics that are not too “something” that you’ve labeled as “brightness, contrast, and luminosity”. I’ve suggested that “Value” is useless for whatever it is you might want to capture, and I’m not too sure of your other suggested metrics from the image histogram.

For your purposes, it seems to me that the important “ambiguities In defining” are in whatever it is that you might actually be wanting to capture with various metrics, that you’ve been referring to as “brightness”, “contrast”, and “luminosity”. I think you want pictures that are somehow “average”.

Regarding “picture characteristics confounding content-related findings”, well, the question is whether your chosen metrics allow you to accomplish defining a set of images with particular characteristics of being somehow “average”, which I’m guessing might mean something like this:

  • not high key and not low key
  • not black and white or all soft pastels, and also not outrageously saturated
  • not overly tone-mapped (faux “HDR” stuff) and also not with a very flat tonality
  • with areas of colorfulness and brightness more or less evenly distributed (no “red square in the middle of a gray field” type images)

If you toss in some pictures that you’ve already decided (by simply looking at them) “don’t look average”, do your chosen metrics pick these images out?

Regarding the comment about finding an intern to run a script to extract data from your image set (from the discussion over on the GIMP users list), two comments are in order:

  1. garbage in/garbage out: One type of garbage that I’m thinking of has to do with given areas of high/low colorfulness and/or high/low brightness (in color appearance terminology) concentrated in one or more specific areas, vs spread out more evenly over the image. I don’t know of any metrics that capture this sort of information, but surely it does affect selection of images that aren’t “too this or that”.

  2. ImageMagick can quickly calculate a lot of metrics for an entire image, and so would probably be a better tool to use than GIMP. Which or even whether any of the imagemagick-provided metrics would be useful in picking out which images in a set might be “too this or that” is another question altogether.

I rather suspect that getting a group of volunteers (not the ones that will participate in the study) to agree that “all these images are average” and “these other images are ‘too whatever’” would be equally or even more useful than running a lot of metrics that might not be picking up on the characteristics you are actually looking for.

If you really do want the comfort level provided by a bunch of metrics, it would probably be a good idea to test your chosen metrics:

  • throw in some images that you already think are “too whatever”, and see if your metrics consistently pick out these images as “not average”

  • also throw in some images that you already think are average (not “too whatever”) and check to see if your metrics agree with your own judgement that “these images are average”.

@Wmusc: I don’t understand what you want to do. If you have two sets of pictures and you want to find which in one set are identical to those in the other set, the job is simple.

Perhaps you need to find similar pictures. Similarity might be based on colour or tonality or shapes, etc, or on semantic content (“pictures of chairs”, etc).

Perhaps you can post or link to some sample pictures, with the desired output of your matching process.