If you are prepared to do some complex mathematical programming Fukinaga's 
Mean-Shift algorithm provides an interesting approach. It analyses pixels in an 
image and drives similar values to be the same. The result is an image with 
colors flattened to produce blobs of identical color regions. It is then easy 
to count total numbers of pixels in each color. These are the dominant colors 
perceived by the eye.

A simpler approach is to compute a histogram of the colors in the image and 
analyze that. You can make such a histogram by computing the relative positions 
of the pixel colors in the color wheel and then doing the histogram on an index 
built from that. Note that images composed of similar colors will have similar 
histograms.

Tim

–––––––––––
I object to violence because when it appears to do good, the good is only
temporary; the evil it does is permanent. -Mohandas Karamchand Gandhi
(1869-1948)

On Mar 3, 2012, at 9:03 AM, Alvaro Costa Neto wrote:

> Hi Amy, how are you?
> 
> Sounds quite right to me. There is one catch, though: the definition of 
> "dominant color". If you just count the number of pixels with certain colors 
> and grab the top 10, it may not result in what you want. To our eyes, the 
> most dominant color is, usually, the one that has the largest continuous area 
> (blob) in the picture. Think of it like this: if I create a completely noised 
> picture with more blue pixels than red, you won't notice the difference 
> unless the difference itself is significant.
> 
> What you may be interested at is something called “region growth”, which 
> returns the continuous regions in the picture and their areas. This may give 
> you better results.
> 
> I haven't worked with Quartz Filters, but there may be something there that 
> could help you. Otherwise, grab a region growth algorithm from the web and 
> use it in your code. Just make sure that it will work with you colored 
> pictures (these algorithms are commonly intended to be applied to grayscale 
> images).
> 
> I hope that helps.
> 
> Abraços,
> Alvaro Costa Neto
> 
> Em 03/03/2012, às 10:17, Amy Heavey escreveu:
> 
>> Hi,
>> 
>> I've got an app that is a custom app for me and my home business, it's not 
>> something commercial. It's a core data app and some of the entities have 
>> images associated with them. The images themselves are stored separately, 
>> and the coredata datastore stores the reference to them.
>> 
>> What I'd like to do if its possible is to analyse the images to find the 
>> most dominant colours, then find images with similar colours in them.
>> 
>> I thought I would do this by analysing each image as it is saved and 
>> calculate the most common pixel colours, probably by analysing each pixel in 
>> the image? and saving the most common colours, perhaps 10 colours. Then I 
>> can see what other images have the same colour(s) in.
>> 
>> Does this sound possible at all? I'm a self taught hobby programmer, not an 
>> expert at all.
>> 
>> I appreciate any advice or pointers,
>> 
>> Many Thanks,
>> 
>> Amy
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/nepheus.br%40gmail.com
>> 
>> This email sent to nepheus...@gmail.com
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/timrm%40otelco.net
> 
> This email sent to ti...@otelco.net


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to