Thursday, September 23, 2010

Entry 20: Image Compression

In previous times, every bit of storage seems so significant , but because of recent technological developments, storage capacity has been developed to quite large sizes that even a megabyte seems so useless already.

Even though the "phenomenon" of less storage size appreciation and the prices of storage media are decreasing, compression techniques to minimize the storage size of files are still being used and developed.

In this activity, we come to realize a basic method of compressing an image file through the discrimination of some of the image's details without so much information loss brought to the compressed image.

The method used in this activity is called PCA or the Principal Components Analysis.  It is based on the concept of identifying the eigenvectors of the image with the highest information contribution based on the eigenvalue of the diagonalized covariance matrix of the  n-dimensional "observations".  This results to a minimized number of information stored in the resulting compressed image, thus, the image size is smaller than the original.

For this activity, I chose the image in Fig. 1 to be my test image to be compressed.

Figure 1:  Original image to be compressed.

We first sampled the image such that size of each subimage is 10x10.  From the ensemble of these subimages, we computed the PCA using the pca() function in scilab.

One of the results after computing the PCA is the eigenvectors of the image.  The eigenvector of the image used here is shown in Fig. 2,

Figure 2:  Eigenvectors for the image.

After the eigenvectors were computed, we identified the eigenvectors with high explained variance to be used on the compression.  In the plot below (Fig. 3), we can see the variance explained by each eigenvectors.

Figure 3:  Scree plot.  Blue) Percent of variance explained by each eigenvector; Red) Cumulative sum of the variance explained of the eigenvectors.


We utilized different number of eigenvectors to achieve certain compression levels.  Some compressed images at different compression levels are shown in Fig. 4,

Figure 4:  Samples of compressed images using PCA. (from top to bottom) 92%, 95%, 97%, 99% and 100% compressed images.  The number of eigenimages required to compress the image to these compression levels are (from top to bottom) 1, 2, 4, 13 and 100 eigenimages, respectively.

For the compression, the number of stored information is decreased depending on the number of eigenimages utilized.  It is nice to know that the highest eigenvector explains almost 92% of the entire image.  This implies that even if small number of eigenimages were used in the reconstruction, the quality of the result will not deteriorate much.

In this activity I would rate myself 10/10.

Source:
    Activity Sheet for Activity 14 - Dr. Maricor Soriano

No comments:

Post a Comment