I don't know what the best technology to use here is, I know PHP can do vaguely similar things but point me in the right direction if I'm wrong.
I'm building an online store and I'd like an easy (automated) way to categorise the colours of each item for sale.
I've seen numerous posts on Stack which are related to this, here are some good discussions for those interested:
Programmatically determine human readable colours
Detect overall average colour of a picture
These are all well and good. However, my issue is a little different. The images in question are all on different coloured backgrounds, and these affect the "average colour" of the image. I've tried resizing my images down to 1px to get a colour average, but this doesn't quite work.
As you can see, for image #1 the average colour is going to be a lot whiter than the product colour; for #2 and #3 it's going to be a lot more brown.
Can anyone think of any methods I could use to get the right average colour, in an automated way, with PHP, Ruby, Python, or anything similar? My idea was to take a section from the middle of each photo (which is usually where the product in question is) and take the average of that. For instance, get a 30px x 30px square in the centre of the image and process that.
This won't be absolutely perfect though, and I'm completely new to this sort of programming - is there any better way to determine foreground colour?