r/GIMP • u/BeeTeaLove • 1d ago
Incorrect histogram statistics?
I need to compute image statistics (mean, standard deviation) for a jpg RGB image, for each color layer. I have an Excel VB tool to do so, but wanted to cross check with GIMP. Looking at the GIMP histogram stats, the results seem incorrect. I used MATLAB as a third check, and it agrees with my Excel results.
Any idea what might be up with GIMP? I set the scale value to 100, so I'm multiplying the reported stats by 100. For example, for red, linear...


Here's a comparison table...

6
Upvotes
3
u/ofnuts 1d ago
What formula do you use? On what values? You might have to apply a non-linear gamma function, and the average of the converted values isn't the same as the converted value of the average of the raw values.
1
u/BeeTeaLove 1d ago
Okay, I figured it out. I was incorrectly using the scale value. When I set it to 100, that was telling GIMP to calculate stats only over pixel R values from 0 to 100. Resetting this to 255 gives full-scale stats, as decimal percent.
Then multiplying by 255 gives results that match the other two methods. All is good. see next comment