Perhaps this question is too technical for this subsite, if so, please relocate it to a better spot.
I'm doing some research on colors where I need to figure out how common colors are. The end result will be a bunch of charts, somewhat similar to this flag analysis.
I will have 50+ sets of 100 or so images and I want to calculate the color distribution in each set, and then compare the averages of each set. Which is the most common color in all sets, are there changes/trends between sets, and so on. With thousands of images obviously it's not feasible to count all pixels myself and decide what colors are most prominent. So I'd like to automate.
Ideally, I'd have a tool that looks at each set and quantizes colors based on a palette I create myself. I'd also love it if the tool would accept a series of different-sized images, but I'm willing to rescale and combine each series in to a single collage.
Note: I'm looking for something that lists PIXEL colors, not IMAGE AVERAGE colors. Since I will have images that have multiple colors, looking at the average or most prominent color gives misleading results. For example, in the following image there are several images that use a rainbow of colors, but do not get placed near eachother.
And this image is predominantly blue, but should still count for about 1/3rd as green pixels:
Or even worse, the following image uses bright green and red, but would either be categorized as yellow (average hue) or grayish (average of RGB values):
To recap: I'm looking for a tool that can reduce an image to a small (specified) color palette, and then count how many pixels of each of those colors there are.