I am building a image galley using PHP and MySQL where I want to implement Image search by it\'s color. By following Imagick::getImageHistogram i got the mo
How about you first times all the red values by the number of times they appeared and then add those values together to get the overall red value. Then divide by the total number of times appeared. Do the same for Green and Blue.
For example:
total red = ((252*125)+(194*126)+(109*11440)+(2*12761)+(255*40769))
/ (125 + 126 + 11440 + 12761 + 40769)
= 180
Then just store them in the database like
id red green blue image_path
Image 1 1 225 134 4 /dir/
Image 2 2 143 0 145 /dir/
Image 3 3 239 200 111 /dir/
If you were searching for Red images you could do something like:
SELECT id, image_path WHERE red > 200 AND blue < 100 AND green < 100
Im not sure of the specifics, but you could mess around with the values.