[PD] Can GEM select a color from an image?

Roman Haefeli reduzent at gmail.com
Mon Sep 12 10:56:36 CEST 2011

On Sat, 2011-09-10 at 22:33 -0400, Mathieu Bouchard wrote:
> On Sun, 11 Sep 2011, Olivier B wrote:
> > I think [pix_mean_color] is what you need.
> This only finds the average colour, which is usually not the same as the 
> most prevalent colour, even though it is the best estimator.
> The best estimator means that it's your best guess when someone asks you 
> to predict pixels picked randomly in the image. It leads to least square 
> error : (predicated - random)² is as low as it can be, on the long term.
> In statistics, we learn about Average, Median and Mode, usually all 3 at 
> once, as 3 basic approaches, three kinds of «middles» of the data. What 
> Sebastian is looking for is more like Mode, which looks like the easiest 
> of the 3, but is actually the hardest of the 3, especially when doing in 
> multidimension spaces (such as red,green,blue) and on continuous scales 
> (256 values per dimension is continuous enough for what I'm talking 
> about).
> There are several gotchas about peaks in statistical distributions.

I wonder how one should go about this:

Let's assume an image consisting of the major parts of pixels that are
at most -/+3 values (from 256) apart from each other in every plane (R,
G, and B). So this pixels would be spread across 7x7x7 = 343 different
colors, but would look still very similar to each other. Now, the rest
(minor part) of the image consists of all the exact same color value,
which is much different from the colors in the major part.

Am I right in thinking, that the Mode would detect the minor part (with
all the exact same color values) as the most prevalent color, while the
human eye most likely would see a mix of the previously described color
variation as the most prevalent color? How would an algorithm work, that
would take into account that all the pixels from the major part are very
similar and thus would detect a mix of those as the most prevalent


More information about the Pd-list mailing list