Compute the Color of the Foto

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
binfch
Posts: 1
Joined: 2011-07-25T10:34:59-07:00
Authentication code: 8675308

Compute the Color of the Foto

Post by binfch »

Hi there

I have 10 different preset RGB colors (example red, blue, green, etc...).

Now I need to read foto files (.jpg, .gif, .png) and decide to what preset color the images best fits to. Example -> Let's supose on the foto there is a white cloud in the center surrounded by blue sky -> The result should then be the color "white". Or a black dog on a green lawn -> The result should be the color "black".

P.S: Google image search has such a functionality.

I was wondering how such a functionality could be implemented resp. what would be the most "performant" solution. An idea that comes to my mind is to simple resize the images to 3x3 pixel, then read the center pixel and decide what color is closest to it !?

Thx & cheers,
Peter
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Compute the Color of the Foto

Post by anthony »

This is basically working out rough category or metrics for a photo.
I have note on this in IM Examples, Image Comparing
Image Types (BW, line, grayscale)
http://www.imagemagick.org/Usage/compare/#type_general
But I think it is more like image metrics
http://www.imagemagick.org/Usage/compare/#metrics
Which includes discussions of predominate color, central color, and 3x3 color matrix determination.

I would be interested in your views on this and how they fit in what you are after.


However Google is probably doing something I don't currently discuss. Its a metric that looked for rough ellipses of color in an image which is then used as the metric. Unfortunately the paper's original source is no longer online but a reference is
http://citeseerx.ist.psu.edu/viewdoc/su ... .1.80.3503
(there is a cache copy of the PDF there, but it is more of a starting point for the algorithms involved)

I have not looked into this method myself (which is why I don't discuss it), but will like to at some point.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply