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

Mathieu Bouchard matju at artengine.ca
Mon Sep 12 22:09:12 CEST 2011

On Mon, 12 Sep 2011, Roman Haefeli wrote:

> 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,
> 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 color?

It depends...

a strict Mode with smallest histogram bins (one per value) will find the 
minor part.

a strict Mode with big histogram bins (one for 16*16*16 values, for 
example) will find the major part only if their values don't overlap 
several bins, which is some kind of vote-splitting.

but if you do a Mode-like thing with smallest histogram bins AND a 
convolution by a window, you will get the major part in all circumstances, 
without «posterisation» artifacts.

however, if you don't want to make a 3-D histogram data structure taking 
64 megs and a lot of CPU for applying a 3-D blur on that, you have to get 
trickier than that... does anyone have any ideas how to find a «blurry 
Mode» without using much RAM & CPU ?

| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC

More information about the Pd-list mailing list