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
- 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:
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:
and this one for
(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.