[Home]

Gray World Algorithm Results


Result Analysis 1 -- Input and Output R, G & B Values

To understand the effects of Gray World algorithm on the images, we first look at the mean R, G, B and Gray values of the input images and Gray World output images. We plot these values in three dimension figures with the background wavelength, target wavelength and R, G, B or Gray values. The plots of the input are done by InputPlot.m The plots of Gray World output are done by GrayWorldPlot.m The plots are shown as following.

From the plots, we can see the plots of Gray World algorithm have similar shapes as input plots, but it scales down the part of the input with high R, G, B or Gray values and scales up the part of the input with low R, G, B or Gray values. It makes sense because Gray World Algorithm uses average values as scale factors which will scale R, G, B and Gray values toward average R, G, B and Gray values, and make their outputs closer to average R, G, B and Gray values.


Input

Gray World Output




Result Analysis 2 -- Difference of Input and Output R, G & B Values

After we get the mean output values of R, G, B and Gray for all output images of Gray World algorithm, we can compute the difference of target colors between the original images and the algorithm output images. Since we know the R, G & B values are the same for all target patches in algorithm's output images, we can obtain the target colors from the output images by averaging the target patch in the upper left corner. Then we plot the differences relative to the background colors of the original image. The above process that compares the differences of inputs and Gray World algorithm outputs is done by GrayWorldCompare.m

We show the result plots as following and the data is stored in GWDiff.mat

From the plots, we can see the differences of inputs and algorithm outputs are around zero, but have the large differences in some special areas. For instance, the differences of Red values are very high around two target wavelengths which are in the middle and high wavelength. Also at the high wavelength of background color, we get large negative differences. Although R, G & B differences vary in a large value range, the differences of gray values keep in [-100, 100].


Differences of Red Values

Differences of Green Values

Differences of Blue Values

Differences of Gray Values




Result Analysis 3 -- Compare Algorithm Difference with Camera Difference

After we get the following information:

We can compute the differences of target colors of the algorithm output images and the camera output images. Then we plot the differences relative to the background colors of the original image. The above process that compares the differences of Gray World algorithm outputs and camera outputs is done by GrayWorldCompare.m

We show the result plots as following and the data is stored in GWDiff.mat

We can see the plots of differences of algorithm output and camera output have similar shapes and the differences are around zero, although there are large differences in some special area. Despite R, G & B differences vary in a large value range, the differences of gray values of algorithm and camera output keep in [-50, 50].


Differences of Red Values

Differences of Green Values

Differences of Blue Values

Differences of Gray Values




Result Analysis 4 -- Real Image

As we can see from Gray World Algorithm, adding a bright patch does not bring in any visible difference comparing to the output image without the bright patch. As we said this is because Gray World algorithm scales R, G & B values of the input images by the average of R, G & B values relative to the average gray value. Although the small bright area brings up the average values a little bit, it does not impact the whole picture largely.

From this result, we can see Gray World algorithm is good at processing the images that have relative small contrast between the bright part or dark part. If images only have small area of very bright parts or very dark parts, the bright and dark parts do not change the output images a lot. On the other hand, if the input images contain large area of very bright parts or dark parts, the output images will be scaled down and up a lot respectively. Therefore, in general, Gray World algorithm reduces bright and dark contrast and makes the output images look like more gray.

We can not see obvious differences for the camera outputs of these two images.

We list the R, G, B & Gray values for experiment 2 as following. If we look at the result data carefully, we can see, for both input images, the output R, G, B & Gray values of Gray World algorithm are a little bit high than camera's. But for both Gray World algorithm and camera, adding the bright patch decreases the R, G, B & Gray values by a very small amount that can not be detected when we view the output images.

  • Stanford Tower without Bright Patch:

    R G B Gray
    Input
    0.4978
    0.4751
    0.4773
    0.4834
    Camera Output
    0.4539
    0.5179
    0.5666
    0.5128
    Gray World Output
    0.5836
    0.5836
    0.5836
    0.5836


  • Stanford Tower with Bright Patch:

    R G B Gray
    Input
    0.4990
    0.4775
    0.4796
    0.4853
    Camera Output
    0.4464
    0.5172
    0.5659
    0.5098
    Gray World Output
    0.5835
    0.5770
    0.5835
    0.5813


    trek@alumni.stanford.edu
    lihui@leland.stanford.edu