On Tue, 26 Jun 2012 11:11:50 -0700, Guilherme Utrabo wrote:If you need to do many lookups against a fixed set of colours, the fast
> In my application I have a list of RGB colors. The user then chooses one
> color and I have to find the nearest color. I know there is more than one
> method to do this, using hue and saturation, etc. That's not what I need
> help with. My problem is to find an optimal algorithm to find the nearest
> color. Today my approach is very straight foward, but lacks performance:
> Get the RGB for the user color. Then I sort my list by the sum of the
> Do you guys suggest me an algorithm to do that search? Thanks for your
solution is a lookup table, but it requires 2^24 ~= 16 million entries for
a 24-bit colour.
If you can't afford that much memory, then use a coarser lookup table
If you don't perform many lookups or if the list changes frequently, then
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.