Friday, October 14, 2011

thirteen

In compression, you have to find the balance between things.  You must find a means of compressing that saves both data and space without sacrificing either.  In this activity, we use Principal Components Analysis or PCA to compress images. 

PCA basically allows one to obtain the eigenimages, their relative significance and principal components. For a more in-depth discussion on PCA, see this. Forgive me for pointing you to a Wikipedia entry, but I must since I’m not that good at briefly explaining complicated concepts, I’d rather not attempt to do so.

The image I will attempt to compress is a gray-scale version of an image of a jellyfish.  This image is from the My Pictures folder of my computer.  Thank you, Windows.

Jellyfish
Jellyfish_gray
Figure 1. Image of a jelly fish in (top) True Color and (bottom) gray scale.

PCA was done on this gray-scale image for different numbers of eigenvectors and the results are shown below.  Truthfully, when 20 eigenvectors are used, the image quality is actually not so different from the original gray scale image.

Jellyfish_all
Figure 2. Results of PCA on the gray-scale image of a jellyfish for (left to right, top to bottom) 1, 3, 5, 10, 15, 20, 25 and 30 eigenvectors.

I actually performed PCA with numerous eigenvector values with the maximum number of eigenvectors set at 100.  Looking at the file compression size, a 5% reduction for this image using 20 eigenvectors seems acceptable. 

Jellyfish_graph
Figure 3. Plot of the percent reduction versus the number of eigenvectors for the jellyfish image.

One of the things I wondered about this technique was if the same number of eigenvectors could produce a compressed image of good quality for another image.  Turns out, this technique is image specific as shown by PCA done on the image of a koala taken from the same folder as the jellyfish picture.  When using 20 eigenvectors, the image quality is not very good.  Even at 30 eigenvectors, the quality is still not as good as it was with the previous data set.  It’s also laughable that a negative reduction happens when you use 20 eigenvectors or more.  In that case, the image wasn’t being compressed but it was becoming enlarged.

Koala
Koala_gray
Figure 3. Image of a koala in (top) True Color and (bottom) gray scale.

Koala_all
Figure 5. Results of PCA on the gray-scale image of a koala for (left to right, top to bottom) 1, 3, 5, 10, 15, 20, 25 and 30 eigenvectors.

Koala_graph
Figure 6. Plot of the percent reduction versus the number of eigenvectors for the jellyfish image.

Overall, I think PCA is cool and all but I still think there’s the problem of not having one number of eigenvectors be suitable for all images. 

Contrary to popular belief about the title and unlike my previous entry, the thirteenth activity seems to be lucky for me.  I mean, I was able to do something at the least.  I think a 10/10 would be a suitable score for being able to finish the activity and do more than what was required albeit having finished it beyond the allotted time.

REFERENCES:
1. A14 – Image Compression, Applied Physics 186 Manual
2. “Principal Component Analysis”, http://en.wikipedia.org/wiki/Principal_component_analysis

No comments:

Post a Comment