I have to write webapp where user will have the ability to perform search according to images colors. My question is how you can store color data? I believe that best answer is to reduce image colors and make preparations histogram for every r, g and b funnel however i do not have idea how you can design database. I wish to use MySQL DBMS. Could someone point me into right direction?
A few ideas spring to mind for storing histogram data. The apparent option is to possess one table (or three for separate R/G/B channels) that signifies the (stabilized) histogram, having a column for every bin. If you are in 24 bit color (8 bits/funnel), you can break each funnel into 16 bins ([-15], ..., [240-255]), as well as in each column keep area of pixels that fell into that bin.
Something similar to this:
id imgID R_0_15 ... R_240_255 G_0_15 ... G_240_255 B_0_15 ... B_240_255 1 1234 0.1 0.23 0.023 0.234 0.11 0.01
With this particular design, the whole (stabilized) histogram for every image could be symbolized like a single row within the table.
Queries could be a little challenging--you'd need to generate them dynamically to connect the best column names for that value selection of interest.
Possibly an easy method will be a HistogramBins table having a row entry for every image and every bin:
id imgID component bin_min bin_max percentage 1 1234 R 0 15 0.1 ....omitted rows... 1 1234 R 240 255 0.23 ...etc...
With this storage format, queries might be prepared instead of dynamically calculated. It isn't obvious in my experience if the components ought to be damaged out when i did or should you store one row for "bin 1" of three color components. I'd most likely wish to write some queries and find out what felt perfect for the application.
Also, the main reason I continue to say 'normalized' is this fact plan will make your binning separate from image size.
Hope this can help enable you to get began. Tell us that which you finish track of!
RGB values don't have any meaning to human perception but they may be easily converted to Hue, Saturation, Luminance that is more sensible to individuals. Regrettably, saturation and luminance are pretty intuitive: more potent:paler and lighter:more dark, but we've no natural ordering for colors so hue is expressed being an arbitrary quantity of levels around a circle. Used, asking individuals to make fine hue discriminations, especially when looking for something yet unseen is fairly hard. Therefore, you might like to limit your groups towards the vertices from the hexagon in figure "a".
Then you definitely encounter the question of what's the representative colour of an image? May be the image that's half blue sky and half tan sand blue or tan? Are you currently selecting a dominant hue? You might like to use a huge Gaussian blur after which average the resultant hues. You most likely have to refine your question and goals further.
Idle musing on perceptual models
Even HSL has its own descriptive restrictions. I mention "tan" above because the colour of sand. Most visitors most likely don't have any problem whatsoever perceiving or naming it, but unless of course you've an excessive amount of experience having fun with color, it's pretty non-apparent the hue of tan is orange but pale (less saturated) and vibrant (greater value). Contributing to another from the hue circle is dedicated to vegetables, etc.