tags:

views:

47

answers:

2

Hi, I'm looking for an idea for getting the most representative color in a grid of pixels. There is any algorithm for this? I'm not sure if the most representative is one of the colors appearing in the grid of is the average af all the pixels better?

alt text

A: 

Have a look at some color quantization algorithms. I found them to be the most effective method to generate palettes from photographs. Also, most image manipulation/processing libraries should have some fast quantization built in.

mwc
A: 

You are probably looking at "average" as percepted by human. First you need to change you colors representation in a color space that is specially designed to be "perceptually uniform" (for calculation of color "distances") L*a*b* link text Then, each color is a point in 3D color space. Now you can find the "center" of the cloud of points and this is the "most representative color".

Ross
@Ross this sounds good, I'll try it.
Kiewic