2013-04-22, 10:24
@Bren730
to find the dominant color for a section DFAtmo generates a histogram for each section. First the captured RGB image is converted to a HSV
image (see Wikipedia for HSV color space). Then a histogram table for hue and saturation is generated by iterating over each pixel of a
section:
hue_histogram_table[pixel->H] += (pixel->V * weight)
sat_histogram_table[pixel->S] += (pixel->V * weight)
In the second step DFAtmo generates windowed histogramm tables from the calculated tables.
(Simplyfied) calculation example for a entry with a window size of 2:
windowed_histogram_table[i] += histogramm_table[i - 2] * 1
windowed_histogram_table[i] += histogramm_table[i - 1] * 2
windowed_histogram_table[i] = histogramm_table[i] * 3
windowed_histogram_table[i] += histogramm_table[i + 1] * 2
windowed_histogram_table[i] += histogramm_table[i + 2] * 1
In the third step DFAtmo evaluates the highest value in the two windowed histogramm
tables. The indices of the entry with the highest value are the hue and saturation value
of the dominant color.
Hopefully this explanation helps.
- durchflieger
to find the dominant color for a section DFAtmo generates a histogram for each section. First the captured RGB image is converted to a HSV
image (see Wikipedia for HSV color space). Then a histogram table for hue and saturation is generated by iterating over each pixel of a
section:
hue_histogram_table[pixel->H] += (pixel->V * weight)
sat_histogram_table[pixel->S] += (pixel->V * weight)
In the second step DFAtmo generates windowed histogramm tables from the calculated tables.
(Simplyfied) calculation example for a entry with a window size of 2:
windowed_histogram_table[i] += histogramm_table[i - 2] * 1
windowed_histogram_table[i] += histogramm_table[i - 1] * 2
windowed_histogram_table[i] = histogramm_table[i] * 3
windowed_histogram_table[i] += histogramm_table[i + 1] * 2
windowed_histogram_table[i] += histogramm_table[i + 2] * 1
In the third step DFAtmo evaluates the highest value in the two windowed histogramm
tables. The indices of the entry with the highest value are the hue and saturation value
of the dominant color.
Hopefully this explanation helps.
- durchflieger