Activity 6: Enhancing Color Images
For this activity, I will be using the raw image (Fig. 1a) I took during the FST Week Concert at the College of Fine Arts. I felt this would be a good image to work on since there is a significant and discernible color cast due to the lighting of the venue. The photo was taken with auto white balance (which didn’t do a really good job of white balancing).
Contrast Stretching
I imported the original image as uint8
. However, when performing
any manipulation, I converted it first to float64
before casting
it back to uint8
for displaying and saving purposes. Upon
examination, I realized it was futile to perform contrast stretching since the
maximum value of each channel was already 1.0
. Further reading
brought me to an article [1], where we can discard a certain percentile
from the low and high ends of the histogram
and stretch the remaining bins to fill the full range, according to
where
Gray World
This algorithm assumes that the average color of the image is gray. The pixel values are manipulated according to [2]
where
White Patch
This method is similar to how the White Balance Eyedropper Tool in image processing programs such as Lightroom or Photoshop work. Fig. 2 shows the location where I extracted a patch that is supposed to be white (upper 12th fret marker on the guitar). The result is shown in Fig. 1d. We can see that the guitarist’s skin tone still looks realistic, and the background is now a warmer white as compared to the previous algorithms.
Figure 2: Extracted white patch location. The size of the bounding box has been exaggerated for easy location. The object of interest is the fret marker on the upper portion of the box.
Auto White Balance Algorithm through Average Equalization and Threshold (AWBAAET)
To combine everything, [3] proposes a method that modifies the gray world and contrast-stretching algorithms and uses a weighted sum of them to perform automatic white balancing. The modified gray world algorithm is
and the modified contrast-stretching is
where
where
where
Figure 3: Comparison of the different auto white balance algorithms.
References
S. Wang, Y. Zhang, P. Deng, and F. Zhou, Fast automatic white balancing method by color histogram stretching, 4th International Congress on Signal and Image Processing, 979-983 (2011).
- M. N. Soriano, Enhancing color images (2019).
S. C. Tai, Y. Y. Chang, and C. P. Yeh, Automatic White Balance algorithm through the average equalization and threshold, in [2012 8th International Conference on Information Science and Digital Content Technology (ICIDT2012), vol. 3, 571-576](http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6269338&isnumber=6269316, (2012).