开发者

Find the most representative color in a grid of pixels

I'm looking for an idea for getting the most representative color in a grid of pixels. There is a开发者_运维知识库ny 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 http://www.stan.mx/images/stackoverflowPixels.gif


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.


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") Lab* 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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜