How to save historgam image to database and search

I need to write webapp where the user will be able to search by image colors. My question is how to store color data? I think the best solution would be to reduce the color of the images and prepare a histogram for each channel r, g and b, but I have no idea how to create a database. I want to use MySQL DBMS. Can someone point me in the right direction?

Hi

+5
source share
2 answers

Several ideas come to mind for storing histogram data. The obvious choice is to have one table (or three for individual R / G / B channels) that represents a (normalized) histogram, with a column for each bin. If you are in 24-bit color (8 bits / channel), you can divide each channel into 16 bits ([0-15], ..., [240-255]), and in each column the percentage of pixels that hit to this basket.

Something like that:

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 design, the entire (normalized) histogram for each image will be presented as a single line in the table.

The queries will be a little complicated - you will need to generate them dynamically in order to include the names of the desired columns for the range of values ​​of interest.

Perhaps the best way would be a HistogramBins table with a row for each image and each 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...

, . , , , "bin 1" . , , , .

, , "", , binning .

, . , !

+3

RGB , Hue, Saturation, Luminance, . , : : : , , . , - , . figure "a" .

, ? ? ? , , . , .

HSL . "" , . , , , , , , , , ( ) ( ). ..

+2

All Articles