问题
I am wanting to sample an image to return a single color that "looks" that a good representation of the colors sampled. I have tried two methods:
- Taking an average of all the red, greens, and blues and creating an image from that. This rarely produces a color that looks like it came from the image.
- Finding the "dominant" color from the image. This entails finding the most common color from the image. This is better, but for example, the Mona Lisa produces a dark purple color. This seems to capture the darker areas of the image, but it is ignoring all of the lighter areas in the top corners and on her skin. I would like a color that represents the dark areas and the light areas.
Photoshop has a "average blur" that produces a single color for an image. For the Mona Lisa, this looks like:

In this case, each quarter represents the respective quarter of the Mona Lisa. This is eventually what I am looking for, but let's start with the image as a whole.
I would love to know how photoshop gets these colors.
Thanks!
来源:https://stackoverflow.com/questions/26478533/java-find-a-color-representing-all-colors-in-an-image