Bababa ba?
Just another WordPress.com site

Activity 12 – Color Image Processing


An obviously wrongly balanced image which was done on purpose to enhance the mood.

In the previous entry, I mentioned that I am a musician, though informally trained. It’s one hobby that I pursue because I just want to enjoy it, so I don’t need to make it more complicated than what it really is for me.

Another hobby that I pursue is photography, a field in which yet again, I am informally trained. I do not own professional grade cameras and equipment, nor have I attended any workshop on teaching me how to capture the perfect images. I just capture memories (yes, that’s what I think of my photos) on the go without any forethought on how to optimize the end product.

But one aspect in photography that I always am conscious of are the white balance settings.

This setting allows the modification, or more of adaptation of the camera to compensate for the light present in the scene. For example, you have a yellowish light illuminating the object, a white balance setting would negate the yellow effect on the object, allowing the capturing of the object’s true color.

So how do these white balance settings work?

Our memory machine, err, our camera basically stores color information by storing intensities of three different colors: red green and blue.

To illustrate mathematically, we have the following equations from our lab manual [1]

where S(λ) is the spectral power distribution of the incident light source, ρ(λ) is the surface reflectance and η(λ) is the spectral sensitivity of the camera. Note that all these values are different for the red, green and blue plane. K is the balancing constant for the capturing process.

So now that we know how the camera captures images, we now look into how to balance our images. We look at two white balancing algorithms: the white patch algorithm and the gray world algorithm.

White Patch Algorithm
In the white patch algorithm, what we do is simply select a true white patch from a wrongly balanced image. We want this white patch’s value to be 1 for all color planes (when R=G=B=1, we get the color white), so what we do is we get the values of red, green and blue from that white patch. After we obtained these values, we divide it from the whole image to get our balanced image.

Gray World Algorithm
The gray world algorithm on the other hand utilizes the whole image rather than a patch of white. We get the average the values of each pixel from red, green and blue, and then divide the obtained value from their respective color plane. In using this algorithm, we assume that the mean color of the world is gray.

Above is an application of both the white patch algorithm and gray world algorithm on wrongly balanced images.

Notice that both algorithms worked properly, as we can distinguish each color properly.

So now we have two algorithms, when would we know when to choose one over the other?

Say in our image, each of the colors red, green and blue are not well represented, ie we have a set of similar colored objects. Invoking the white patch algorithm as seen above, we can be able to distinguish the different tones of red. However, invoking the gray world algorithm, the balancing goes awry.

How is this so?

Since the gray world algorithm requires the average value for each of the colors, we need to make sure that each color (or also the color white which is the combination of all colors) is well represented to avoid overbalancing (is there such a term?) of the image. This occurs when we divide the planes of the image wrong constants derived from getting the mean.

So now that we learned about white balancing, we try to apply it to real life.

Pictured above is our favorite seatmate, Jhona Rhaye who is coincidentally wearing white. Obviously, the image at first is wrongly balanced as Jonats seems like to be suffering from carotenosis (his skin is yellow-orangish). Using his shirt on the white patch algorithm we balance his photo. Also since the photo is mostly white from the CSRC environment and since white represents R, G and B equally, we can also use the gray world algorithm.

Conclusion
We were able to automatically balance images through 2 algorithms, white patch algorithm and gray world algorithm. Since we were able to produce visually pleasing results, we give BA a grade of 10/10

Acknowledgments

  • Dennis for collaborating with me on taking the photos.
  • May Ann and Tisza for their materials.
  • And Jonathan for his face.

[1] Soriano, “A12 – Color Image Processing”

As a post-script
At the top of this entry is a photo of the beautiful Mucci taken using a Nikon D3000. It was an inviting bright, warm and sunny morning and Mucci was unusually behaved and sweetly affectionate. To preserve the warmness of the memory, I chose a white balance that would enhance the warm colors (yellow and orange). For me, it was effective because I feel warm and comfortable every time I see this photo. :)

No Responses to “Activity 12 – Color Image Processing”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.