3

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.

enter image description here

And this image is predominantly blue, but should still count for about 1/3rd as green pixels:

enter image description here

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): enter image description here

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.

  • The tool you use will introduce some bias into the results depending on the image you scan and the means by which you use to down or up sample it to the desired size for pixel counting. Be also aware that counting pixels can be misleading based on pixel size and white-point of the image and display, among other factors. – Stan Jun 19 '16 at 1:15
1

Interesting question.

On Photoshop:

1) Multiply your image dimensions. For example 640x480= 307,200 Save this number (total value), probably on an excell table.

2) Convert your image to 8 bit

  • Mode > 8 bit

  • Choose an amount of colors. Lets say the double of the palete you can refine the palete later. Keep it in manageable values. for example 16-24 colors to refine it later to 8.

  • Palete Local, dither none.

3) Adjust the palete as needed

  • Image > Mode > Color Table

4) Select Color range and choose one or several similar colors using the tolerance slider.

5) Open the histogram and turn on the extended view. Window > Histogram.

  • This is now counting the pixels inside the selection.

6) Divide the total value / selected value and you now have the percentage of thoose colors.

7) Repeat as necesary depending on the palete you choosed.

0

The best statistical tool for this kind of pixel analysis is a "histogram." Typical ones divide an image vertically by percentage and 256 columns wide for each of different luminances from black to white. You can capture a histogram for each of the image colour channels you wish to compare. They can be viewed separately by channels such as red, green, blue, and combinations of those. Hue, saturation, and value are interrelated components of a colour.

Photographers have a histogram to assess the image displayed on the camera screen after an image is captured. Some software displays histograms also. The shapes will be different for each of the image samples you show. Your link shows a project with a limited palette of a few basic flat colours. Your gamut is much larger and more nuanced.

Histograms will not be so distinctive as the simple flat colours used on flag designs in your link; but, differences will be more evident as they are overlaid upon one another to accentuate variations.

Make a histogram for comparison here

There's a more detailed description of the process and some variations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.