Saturday, October 5, 2013

Activity 14 - Pattern Recognition

This activity aims to recognize objects using their differenct characteristics. Again we will be using our skills in image processing to be able to attain this objective. 

The first thing i thought when I knew this activity, is what object will I classify. So after taking a lot of time thinking of interesting objects to classify, i came up with the following image.

Figure 1. Objects to be recognized.

I bought 4 different candies XO, Maxx, Pochi and Mentos. To further view their differences, the following is an image of the candies themselves.

Figure 2. Different candies, XO (top), Maxx(left),Pochi(right),Mentos(bottom)

After reading the handout it says, I need to take 20 pictures of each type for the training set. I can't afford to buy that much candy, and I don't eat a lot of candies myself. So yeah let me think of another object.
-----------------------------------------------------------------------------------------------------------

OK, i changed my mind with the candies, Now i will classify the contents of the following image. 
Figure 3. Image of Dingdong, mixed snack of chips,nuts and curls.





Activity 13 - Image Compression using Principal Components Analysis

This activity aims to compressed an image using a method called Principal Component Analysis.

Like we previously discussed in Activity 4, image sizes is one of the property of an image that is always looked into. Consequently, a much more detailed image produced a much bigger file sizes. 

In this activity we will try to compressed the image using a particular method without the expense of degrading the quality of the image as well as its dimensions. We will also look into how the image is compressed.

What is PCA?

For a sample image compression, I used the following image taken from [2]
Figure 1. Candies image [2]

This jpeg image has a 700x438 dimensions which consists of a wide variety of colors. This image is converted to the following gray-scaled image using the function rgb2gray()
Figure 2. Gray-scaled image of Figure 1.

With the same dimensions, this gray-scaled image has a file size = 77.6 KB

Using the PCA we obtained reconstructed images with varying PC,


Figure 3. PC =5, 60.4KB

Figure 4. PC = 10, 68.7KB
Figure 5. PC = 25, 75 KB
Figure 6. PC = 50 77.5 KB



Figure 7. Comparison of Gray-scaled(left) image(77.6KB) and PC =100 reconstructed (right) image (76.3KB)

The results showed a slightly lower file size. See that there almost no visible difference unlike the previous samples. I think the objective of this activity is sufficed. Maybe next time i could try a much bigger image, so we can really see a significant change in the size due to compression. I guess a 77.6KB image is maybe a small file for the grayscale of a very colorful object.


References:
[1]AP 186 Handouts. Activity 13 - Image Compression using Principal Components Analysis. Maricor Soriano 2013
[2]http://good-wallpapers.com/misc/12162
------------------------------------------------------------------------------------------------------
Even though I understand the methods, I really dont know how to explain it here, sorry for the poor discussion. I think i can have a grade of  6 or 7 for producing the desired output. I guess I'll go back to this activity next time to improve the discussion.