Re: Fastest color detection in image?
Re: Fastest color detection in image?
- Subject: Re: Fastest color detection in image?
- From: Ricky Sharp <email@hidden>
- Date: Fri, 26 Sep 2008 09:47:31 -0500
On Friday, September 26, 2008, at 09:04AM, "Christian Klotz" <email@hidden> wrote:
>I'm trying to scan an image for existence of a given color. So I was
>wondering what the most performing way is to achieve this goal.
You probably want to look into direct-pixel access (there are some code examples out there that show you how)
>Basically I want to find out which amount of the given color that
>image has.
>Furthermore, are there ways to find all regions of the image having
>the color? So it would be easy to show the user which parts of the
>image are matching.
Sounds like Photoshop's feature of showing "non-NTSC" colors.
I would create a secondary bit-map image. I would then read the first one and for each pixel that matches your criteria, I would add a pixel to the secondary image of a certain color. Such a color could be in a user-preference. I think Photoshop defaults to bright red. Then, when rendering your image, you can optionally composite the secondary image to show the matching pixels.
Important: your matching logic should take color spaces into account when comparing values. This actually gets a bit tricky. You may also choose to define a certain amount of "slop" when comparing actual RGB, HSB, CMYK, etc. values.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden