Monday 9 September 2013

Color Constancy :Gray World Algorithm

Color Constancy Algorithms

Color Constancy

Color constancy is a mechanism of detection of color independent of light source. The light source many introduce color casts in captured digital images To solve the color constancy problem a standard method is to estimate the color of the prevailing light and then, at the second stage, remove it. Once the color of light in individual channels is obtained the each color pixel is normalized by a scaling factor .
One of most  simple technique for estimating the color of the light is the Grey-World algorithms. The  method will work well in practice if the average scene color is gray or the maximum is white

Gray world assumption

The Gray World Assumption is a white balance method that assumes that your scene, on average, is a neutral gray. Gray-world assumption hold if we have a good distribution of colors in the scene. Assuming that we have a good distribution of colors in our scene,the average reflected color is assumed to be the color of the light. Therefore, we can estimate the illumination color cast by looking at the average color and comparing it to gray.
Gray world algorithm produces an estimate of illumination by computing the mean of each channel of the image.
One of the methods of normalization is that the mean of the three components is used as illumination estimate of the image. To normalize the image of channel i ,the pixel value is scaled by $s_1 = \frac{avg}{avg_i} $ where $avg_i$ is the channel mean and $avg$ is the illumination estimate .
Another method of normalization is normalizing to the maximum channel by scaling by $s_i$ \[ r_i = \frac{max(avg_R,avg_G,avg_B)}{avg_i} \]
Another method of normalization is normalizing to the maximum channel by scaling by norm $m_i$ \[ m_i = \sqrt{(avg_r*avg_r+avg_g*avg_g+avg_b*avg_b)} \] \[ r_i = \frac{max(m_R,m_G,m_B)}{m_i} \] Attached are output of standard contrast stretching and present algorithm

original
ld normalization method 1
normalization method 2
normalization method 3


Example 1.1:gray world

original
ld normalization method 1
normalization method 2
normalization method 3


Example 1.2:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.3:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.4:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.4:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.5:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.5:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.6:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.7:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.8:gray world

original
ld normalization method 1
normalization method 2
normalization method 3
Example 1.9:gray world

original
normalization method 1
normalization method 2
normalization method 3
Example 1.10:gray world
Some of the images are taken from http://research.edm.uhasselt.be/~oancuti/Underwater_CVPR_2012/ image set

Code

For code refer to site http://www.gihub.com/pi19404/m19404/master/ColorConstancy/ The files are color\_constancy.cpp and color\_constancy.hpp.
The class for performing gray world transformation is gray_world.
The norm factor is $p=1$ for gray world algorithm and various normalization techniques can be passed as $m=(1,2,3)$.

No comments:

Post a Comment