Hello!
Based on suggestions here @ SO, I have cataloged the average color for a set of stock images.
r,g,b = image.convert("RGB").resize((1,1), Image.ANTIALIAS).getpixel((0,0))
Now, I would like to present a color wheel to the user and run a search against my catalog to find images that are the closest match to the color selected.
I have read through several questions posted here that recommend "finding the distance between two colors", and reference the Flickr Hacks book.
The Flickr Hack distance algorithm seems to be basically:
diffr = checkImage.r - search_r
diffg = checkImage.g - search_g
diffb = checkImage.b - search_b
distance = (diffr * diffr + diffg * diffg + diffb * diffb)
if distance < threshold then matched.
This method would require me to calculate the distance between my search color and every image's color fingerprint. I was wondering if there is a way to somehow specify a "search area" based on the selected color (center point) and a pre-determined threshold (or search radius). Then construct a SQL like query to return all images that fall within this area.
Is this possible??
BTW, I'm implementing this in Python using PIL and related libraries.
Thanks for your help SO!
SR