Sunday, September 29, 2013

Image Compression

This activity, I used Scilab to reconstruct an image using the PCA function in Scilab. PCA stands for Principal Component Analysis. This method utilizes the eigenvalues and eigenvectors idea. Since I was dealing with images, the components are called eigenimages. The idea is that all images can be reconstructed by superimposing the eigenimages multiplied to their corresponding weights or the eigenvalues.

The image that I used for this activity is my favorite fruit of all time.... bananas! This is shown in Figure 1. I obtained this image from Wikepedia. [1] The main function that I used is pca(). This function produces 3 outputs: lambda, comprinc and facpr. Each represents different information. The 2 outputs that I used in this activity is facpr and comprinc. Facpr represents the eigenimages and comprinc respresents the eigenvalues corresponding to the eigenimages.

Figure 1. Original image to be compressed.

Using the pca() function, the eigenimages that I obtained is shown Figure 2.
Figure 2. Eigenimages of the original image.

From each of the eigenimages, a weight is multiplied to it to determine which of this images contributes to the desired image. There are 100 eigenimages to choose from, some contributed more than the others and the comprinc values determine that. The reconstructed image is shown below in Figure 3.

Figure 3. Reconstructed image using the PCA method.

This is a cool process to compress and decompress images that is transferred through limited media. Sending the eigenimages saves up space but the quality is not compromised. For this activity, I give myself a grade of 10/10 because I was able to reconstruct my image.

[1] http://en.wikipedia.org/wiki/Banana
[2] Soriano, Maricor. Activity 13 manual.

No comments:

Post a Comment