On Mar 3, 2012, at 5:17 AM, Amy Heavey wrote:

> 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.

The trouble is that images tend to have subtle gradations of color, and even an 
area that looks solid often has adjoining pixels that are almost but not quite 
the same color. So you have to use approximations or averaging.

I haven’t done this myself, but one approach that might work is to lower the 
color resolution. Say you divide the raw pixel components by 16 so they’re only 
in the range 0…15 instead of 0…255. That way nearby colors will clump together 
into the same value. It also gives you only 4096 possible color values to count 
occurrences of, instead of 24 million.

It probably also makes a difference what color space you use. My hunch is that 
HSB or HSV will work better than RGB. Experiment!

—Jens
_______________________________________________

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