Can We Get The Mean Value?

The Histogram displays the "Mean " value. Is it possible to get this value from anywhere?
I have looked through Alchemist but cannot seem to see it.

Screenshot 2023-09-08 at 10.21.55

If Alchemist is blind to the Mean, it means you have to calculate it yourself from the histogram.

const histogram = [ /* long array of numbers */ ];

let totalValue = 0;
let totalCount = 0;

for (let i = 0; i < histogram.length; i++) {
    totalValue += i * histogram[i];
    totalCount += histogram[i];

const mean = totalValue / totalCount;

Thank you Davide, that is exactly what I am looking for

Is there any reason why the following returns undefined when the image is in GrayScale


It works fine if the image is RGBColor