I'm trying to understand why the output of the getHistogram function is different from what is displayed when I click on the List button at the bottom of the histogram window.
For testing, I created a simple jpeg image in paint - it has a white background (500px x 500px) with a 20x20 black rectangle in the upper left corner.
Here is my script:
////
compiledDataFile=File.open("C:/test/testfile.txt");
open("C:/Users/dnewman/OneDrive - Innovative Micro Technology/Pictures/white and black.jpg");
run("8-bit");
setAutoThreshold("Default dark no-reset");
run("Threshold...");
setThreshold(0, 150);
run("Convert to Mask");
run("Histogram");
getHistogram(values, counts, 256);
Array.print(counts)
////
When I click on the list button at the bottom of the histogram window, it shows as I would expect - 249600 pixels in the 0 size category, and 400 pixels in the 255 size category.
But the "counts" array shows much different values - a majority of the numbers are 10, counts[0] = 944, counts[255] = 67358, and then there are some oddball numbers in the remaining spots where there are no 10's.
The values array outputs as I would expect; 0 - 255.
What am I doing wrong?