1
\$\begingroup\$

Canon cameras can show a histogram of the images (either in live view or in the preview). There are two modes: an RGB histogram and a "brightness" histogram.

While the RGB histograms can easily be recreated and show a very similar shape than on the camera, the brightness histogram is hard to replicate. Every equation to calculate "brightness" actually gives different results. The overall shape is the similar but not exactly the same.

So far, I tried the following equations (RGB values are in [0, 1]):

  • Normed RGB Norm, as sqrt(R^2 + G^2 + B^2) / sqrt(3)
  • "naive" brightness, as (R + G + B) / 3
  • ITU BT.709 Luminance, as 0.2126*R + 0.7152*G + 0.0722*B
  • ITU BT.601 Luminance, as 0.299*R + 0.587*G + 0.114*B

What other type of "brightness" measure are there and what does the Canon cameras actually show?

Here is an example:

This is the histogram as seen on a Canon RP: Canon Histogram

Now, here is a recreated version from the embedded JPEG of that RAW image using RGB Norm for the "brightness": RGB Norm

It can be seen, that the RGB Histograms look the same, but the brightness is not.

Edit: I have some suspicions what Canon might be doing. The histogram looks a bit spiky, while all my calculations produce a rather smooth histogram. This is likely the case when either using a different number of bins than 256 or when using floor or ceil functions or integer arithmetic. I think that Canon might compute the brightness solely on the uint8 RGB data without float operations. There is a integer approximation given here: https://stackoverflow.com/a/596241/446140

Using this equation, I get this histogram for (2R + 3G + B) / 6:

uint8 based histogram (2R + 3G + B) / 6

and this one for (3R + 4G + B) / 8:

uint8 based histogram (3R + 4G + B) / 8

This already looks much more similar to the Canon one, than the float based rel. luminance. However, there are still distinct differences.

\$\endgroup\$
3
  • \$\begingroup\$ they use sRGB, which follows NTSC, aka ITU BT.709. \$\endgroup\$
    – dandavis
    Aug 22 at 19:22
  • \$\begingroup\$ I played around with the equation and tried different integer ones, but they do not look the same as Canons. So far, the (3R + 4G + B) / 8 is actually the closest I could get... However the ITU BT.709 would look like (2R+7G+B)/10 and is thus not that different. \$\endgroup\$
    – reox
    Aug 23 at 18:02
  • \$\begingroup\$ maybe I just miss the step of sRGB -> linear RGB. I found out that using linear RGB gives a different result but due to the non-linear nature, the bin-widths of the histogram are also non-linear... \$\endgroup\$
    – reox
    Aug 23 at 18:23

1 Answer 1

1
\$\begingroup\$

You would have to actually test/compare...

Many cameras will show luminance clipping if any of the color channels are shown as clipped; which isn't the same thing as actually being blown out (255/255/255).

Many cameras will show a color channel as clipping early (around 250); which compounds with the above issue.

And the camera histograms are based upon the jpeg processing settings, which can be significantly different than the raw data.

Basically, the camera histogram is just giving you a general reference based upon what the manufacturer thinks is best. And, unfortunately, it's not even consistent between different camera models of the same manufacture.

\$\endgroup\$
5
  • \$\begingroup\$ I did not mean the clipping. I specifically meant the histogram. I took the embedded jpeg image and recreated the histogram with a Python script. While the RGB channel histograms look the same, I cannot recreate the "brightness" histogram. My question is: what does Canon mean with "brightness"? (Sometimes they call it "luminance" - but there are also different definitions). I'll edit the question and add some example pictures. \$\endgroup\$
    – reox
    Aug 20 at 17:02
  • \$\begingroup\$ brightness and clipping are the same thing... I.e. clipping occurs when maximum brightness is reached. And if the camera is misrepresenting the clipping point, it is misrepresenting the brightness values across the spectrum. \$\endgroup\$ Aug 20 at 17:34
  • \$\begingroup\$ I get your point and this is definitely the case for the clipping indication. but what is the x-axis of the histogram representing then? \$\endgroup\$
    – reox
    Aug 20 at 18:28
  • \$\begingroup\$ X-axis is brightness, Y-axis is the number of pixels at that brightness (going out the top is not clipping/oversaturation). \$\endgroup\$ Aug 20 at 19:44
  • \$\begingroup\$ But how does Canon computes the "brightness" from the RGB values? That is what I want to know :) Unfortunately, "brightness" is ambiguous. \$\endgroup\$
    – reox
    Aug 20 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.