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.
If Alchemist is blind to the Mean, it means you have to calculate it yourself from the histogram.
Say,
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;
2 Likes
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
app.activeDocument.histogram
It works fine if the image is RGBColor