Thursday, September 23, 2010

AP 186 Activity 14: Image Compression

Eigenvalues and eigenvectors remind me of our Mathematical Physics series, especially 112. I sometimes miss doing just math, without any big idea in mind just solving away.



Fig 1. Original image


Fig 2. Reconstructed images with different eigenvalues:(a) 1, (b) 10, (c) 30, (d) 50, (e) 80.

--
AP 186 handout
Wiki
--
I give myself 8.

AP 186 Activity 13: Color Image Segmentation

I've been meaning to use a picture of my brother Miguel for a long time, just for fun. In this activity, I finally did. I like this picture of him because he's annoyed and laughing at the same time, plus it's quite perfect for image segmentation because a number of colors in the image really stand out. For this activity, let's focus on the corn he's holding. This was taken using my cellphone camera, at 2MP. I love you dear K770i.

Fig 1. My brother Miguel.

Let's have an overview first of the two segmentation techniques we'll be using in this activity. First is Parametric Segmentation; it's basically getting a region of interest (ROI) in the image then transform its color RGB into normalized chromaticity coordinates using the equation below:



Then the probability function of r and g is solved to test the likelihood that a pixel belongs to the ROI. We used the Gaussian function to compute these probabilities.
As for Non-Parametric Segmentation, the 2d histogram of the image was taken and then using this we back project to segment the image. The results are below:

Fig 2. Parametric (left) and Non-Parametric (right) segmentation.

I observed that Parametrically segmented images are cleaner, and the matching parts in the image with regards to the ROI really shine. On the other hand, Non-Parametrically segmented images have a lot of noise and unwanted data. However since I used a colorful picture, and colors all have red, green and blue, the Non-Parametric method was more sensitive to the presence of the hues in the ROI that were present in the image itself.

--
AP 186 handout

--
I give myself 10 for this activity because I think I understood well the concept of these two techniques of color segmentation, plus I got to use a picture of my brother.

AP 186 Activity 12: Color Image Processing

A few days earlier, I became so giddy because of an LX3 promo I saw at Trinoma. For a while, I've wanted to buy a Panasonic Lumix LX3 (may LX5 na, hehe) but I've had fluctuating discipline in saving money and then my Tio gave me a point and shoot. So for this activity, hurrah goes to my Lumix FS8 and its six white balance configurations.

Below are the original images captured using the six white balance setups in the camera. These were captured around lunchtime, with ambient light as the governing light source.
Fig 1. From a-b: white set, auto white balance, daylight, cloudy, shade, halogen

Before processing, I cropped the images to lessen the size as well as to limit the image with the parts we only want to see. There are two white balancing techniques used in this activity, the White Patch Algorithm (WPA) and the Gray World Algorithm (GWA). The WPA makes use of a known white object as a basis for sort of normalizing the whole image. The GWA on the other hand assumes the that the average color of the world is gray. By getting the average RGB value for each pixel, we can use it as the balancing constant.

Fig 2. From a-b: auto white balance, daylight, cloudy, whiteset, shade, halogen.

Then in another setup, we utilize an inept white balance setting and process the images using the two algorithms, shown below. I think, though, that my WPA is a failure. :/
Fig 3. In the halogen white balance setting, for colors red, blue, green and yellow.

--
Thanks to BA and the AP 186 handout :)

--
I give myself 9/10 because I think my White Patch Algorithm did not give me the best results