Thursday, July 30, 2009

この学校は、好きですか? (Activity # 11)

Yey.. we finally had an activity which makes me feel that this is an image processing class.. why of course.. the best images are taken with a camera..

This activity is entitled Color Image Processing. We learned that the color captured by a digital color camera is an integral of the product of the spectral power distribution of the incident light source, the surface reflectance and the spectral sensitivity of the camera. We note that from these quantities, a White Balancing constant for the camera can be obtained and this constant explains why sometimes the colors taken by the camera just don't seem right.

There were two White Balancing Algorithms discussed in this activity: the White Patch algorithm which requires a patch or ROI in the image that looks white in the real world to calibrate the colors of the image, and the Gray World algorithm which basically takes the mean value of the pixels in the image for its definition for white.


The images displayed above shows a white-balanced photo (L) using AWB or Auto White Balancing and a poorly white-balanced photo (R) using the Tungsten Bulb setting in my phone's camera. We note that for tungsten, the camera tries to compensate for the orange tone produced by the tungsten bulb by adding more blue. However, Tungsten will make a daylight photo blue, resulting to a loss of color information in the red.

Using the White Patch algorithm, I was able to restore some of the red colors seen in the AWB image. For the Gray World algorithm however, since most of the pixels are cyan in nature--guess what their mean value is? My intuition however tells me that there just doesn't seem to be any point trying to make a bad image look good, so today's valuable lesson would be--Make sure to get your camera settings right!!

Now here's another set of images. To make it challenging, we added items of the same color but different shades in the images:

Guide to the pictures above: Auto-White Balanced (TL), Daylight setting (TR), White Patch (BL) and Gray World (BR). In terms of quality, the ones at the bottom lose unless we consider the fact that Scilab isn't actually equipped with good rendering backends.

The daylight setting is wrong in this case since the light source is mainly flourescent. The white patch algorithm did its best in restoring the original lighting, but I got a lot of noise from its attempt. Same goes for gray world but as expected, the lighting is still to the poorly-white balanced image. The white patch algorithm is definitely better than the gray world algorithm--but a good image taken by a good camera is tens of thousands of times better. ^_^

There goes another 10 for finishing the activity on time.. it's too bad the blog posts never make it in time. xD

2 comments:

  1. I'm surprised the processed colored images in the last row appear to be in low color resolution. You saved these images with imwrite?

    ReplyDelete
  2. nope.. i exported the Scilab figure, which would explain the poorly-rendered image.

    ReplyDelete