3

I try to extract the dominant color from a image by using 3 different tools, i.e.:

However, the result are different after I used them to analysis one same PNG image, e.g., the dominant colors I extracted from the image are:

  • rgb(185, 199, 123)

  • rgb(176, 192, 116)

  • rgb(189, 202, 122)

I wonder why this happened and is there anything I can do to make the results better? Do I need to create a histogram of the image? Do they extract the color by analyzing pixels?

  • 1
    Define better? Dominant color is a duffuxe subject and has no goo definition mainly because of how our eyes process color so dominant by human is totally different from how data is stored. Allo of the rsults are close to same color. – joojaa Oct 25 '15 at 8:05
  • "Dominant color" means the color that is most prevalent in the image. – sunzhida Oct 25 '15 at 12:01
  • 1
    Yes but measured how. If you just count the colors together you will have all kinds of problems with color noise etc. Depending on exactly how you process you get different results. That is expected nothing better or worse about the methods. – joojaa Oct 25 '15 at 12:27
  • 1
    There is an aditional tool besides the ones you posted... YOU! - Make your own choices! :o) – Rafael Oct 25 '15 at 14:16
3

Dominant color may refer to many things. There is no one formula for getting this value. As such there is no better method, unless you can define what better in your use case means. Since your not providing a use case they are all as good.

The real problem is that a human sees colors differently than a computer take this illusion:

Object to be extended to artboard size
(source: mit.edu)

Image 1: Our brain interprets the B tile lighter than A tile even tough they are as dark. Illusion source, with deeper explanation.

Just doing a naive color search is going to fail. Calculating the most common color would fail in many cases because the image may have lot of slightly discolored hues of same color, because of noise. So the colors have to be binned with some metric, finding these bin cluster centers isn't really a straightforward deal.

Take this image

Image 2: What is the dominant color of this image? Black 0 0 0 pixels are the most common if you'd just calculate their number. Humans would still say green is most dominant.

In addition the computer should be able to eliminate the effect of light and shadow on the surfaces of the image as this is what human eyes do anything other feels somewhat off. So you should boost the color a bit. How much is a hard to say you would need complex heuristics.

As a result theres no right solution to the problem. Certainly looking at minute differences in RGB values is a bit over the top as most humans can not recognize those colors as different unless they can compare them next to each other. So for all intents and purposes for humans thse represent the about the same color.

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.