about average of histogram

How is the “average” shown in the histogram of GIMP calculated?

I am not sure where you are seeing"average" as I am only seeing mean. The mean is the average of the numbers. It is calculated by adding up all the numbers, then divide by how many numbers there are.

sorry
I only looked at the multilingual version and saw [AVERAGE] in the translation, so that’s what I wrote.
Please tell me how you calculated the [Mean] part of the image.
image (1)

It is just the mean of the values. Which means it is not really the equivalent uniform color. For instance the image of a thin checkerboard pattern will have a mean of 0.5 in all three channels, when the “equivalent gray” is (.733,.733,.733) (which is what you find if you use Filter > Blur > Pixellize with a single block that covers the whole area) (you can verify this by looking at an image that is one half the checkerboard pattern and one half the color, you shouldn’t see much difference if you are sufficiently far away to no longer distinguish the pattern).

However, empirically, .733=exp(0.5,1/2.24) where 2.24 is the usual gamma. But I am not convinced that this will holds for all distribution of values. So, if you want the average color of an area, make a copy, pixelize it, and sample the result.

Edit: unfortunately, this is distribution dependent, for instance, with a pattern like this (the two gray squares are (128,128,128)) :

image

the average is still 0.5, but the equivalent gray is .631. What still holds though is that the “linear value” of the gray squares (0.216), makes the average of the four squares be (0.0+.216*2+1.0) / 4 = 0.358, and exp(0.358, 1/2.24)=0.632 so the average color seems to be the gamma-corrected value of the average of the linear values.

But there is unfortunately no API for this average of linear values, at least for 2.10.

GIMPの[Mean]の項目では
白黒の平均色を求めることはできないが、ヒストグラムの平均の値を求めているということで合っていますか?

In the [Mean] item of GIMP
Is it correct that you cannot find the average color of black and white, but you are trying to find the average value of the histogram?

What is the “average color”? In color models where the hue is a circular value (such as HSV , HSL or LCh) defining an average is complicated.

I prefer to use the term “equivalent color” which is the uniform color that looks the same as the area under study when you cannot distinguish the details.

And since the “linear light” values of a pixel are the measures of the light emitted in each channel, it makes sense to add these to obtain the whole light emitted in each channel by the whole area, and then divide this by the number of pixels to find the average “linear light” values of the pixels in a uniform equivalent color.

Sorry, I made a mistake in the translation
What is equivalent color?
Also, is it possible to find the average value of a histogram using [Mean]*255?

What is equivalent color?

Open the image below in a new tab (to see it a normal scale , it’s 600x600px)

image

If you are sufficiently far away from your display to not distinguish the checkers pattern, which square has the color closest to the central square? This is the “equivalent color”. While the “mean color” is #808080

Also, is it possible to find the average value of a histogram using [Mean]*255?

If you have a floating point value in the [0.0 …1.0] range you can convert is to [0 … 255].

But what I stress here is that the “mean” that you get from Gimp doesn’t tell you much.

Yes, is it possible to find the average value of a histogram using [Mean]*255?

You can also make the histogram X scale 0-255 by setting the image precision to 8-bit.


Observe that the conversion from 32-bit floating point to 8-bit integer causes a significant change to the mean fraction. No idea why …

Observe that the conversion from 32-bit floating point to 8-bit integer causes a significant change to the mean fraction. No idea why …

It’s not the 8Int/32FP at play, it is the “gamma corrected” vs “linear” setting of your histogram:

Thank you for the clear explanation.
Finally, when are the significant figures calculated?
After all calculations or during the process?

Oops, that makes sense … I missed that,

Thanks for the heads-up. :slightly_smiling_face: