css - search an image by color palette using javascript -


i coding, in html5 , javascript, image search engine (just google image) less complex, it's done offline using offline database, , wondering what's best way search image color palette.

for example type name , select red color , output images name has ton o color red.

i suggested calculate histogram each color in hsv space. don't understand how that, , think if try calculate histogram bunch of images, pixel pixel, 12 colors take lot of time.

it must exist better , faster way this.

thanks in advance.

a histogram way go. easy enough load image into canvas , loop through pixels. have js object keys representing colours 0-255 set 0 , adding 1 colour key whenever colour found in process. that's how rgb histogram. i'm not sure hsv. can't vouch speed, don't think slow, speed depend on dimensions of image.

since offline, may want do, however, use python/python imaging library scan images , load histogram data database , use html , js interrogate database.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -