International Journal of Advancements in Research & Technology, Volume 2, Issue 8, August-2013 ISSN 2278-7763 244 Image Compression using Singular Value Decomposition Miss Samruddhi Kahu Associate Engineer Marvell Technologies Pune, India. samruddhikahu@gmail.com Abstract: The Singular Value Decomposition expresses image data in terms of number of eigen vectors depending upon the dimension of an image. The psycho visual redundancies in an image are used for compression. Thus an image can be compressed without affecting the image quality. This paper presents one such image compression technique called as SVD. Basic mathematics of SVD is dealt with in detail and results of applying SVD on an image are also discussed. The MSE and compression ratio are used as thresholding, parameters for reconstruction. SVD is applied on variety of images for experimentation. The work is concentrated to reduce the number of eigen values required to reconstruct an image. Keywords – SVD, Image Compression techniques, Image Processing. Ms. Reena Rahate Professor, Department of Electronics and Communication Shri Ramdeobaba College of Engg. and Management Nagpur, India. reenapalashn@rediffmail.com maximum. It is observed that if the value of k chosen is equal to the rank of the image, the reconstructed image is closer to the original image. As the value of k decreases from the rank image quality degrades. Second observation is that as the compression ratio is high image quality is poorer and if compression ratio is low, image with superior quality can be reconstructed but with less compression. Therefore compression ratio and image quality is required to select appropriately. Section I presents literature survey and brief outline of the paper. Section II presents the SVD computations on images. Section III presents the experimentation and the proposed procedure to estimate the percentage of eigenvectors required to reconstruct the original image using the SVD and PSNR. Section IV presents the results and the discussions. Finally Section V presents the conclusion. IJOART I. INTRODUCTION With the advancement in technology, multimedia content of digital information is increasing day by day. Which mainly comprises of images either pictures or video frames. Hence storage and transmission of these images requires a large memory space and bandwidth. The solution to this problem is to reduce the storage space required for these images which can be done by compressing the image while maintaining acceptable image quality. Many methods are available for compression of still images. But the most widely used image compression technique today is JPEG (Joint Photographic Experts Group) which uses DCT (Discrete Cosine Transform) for compression of images. In this paper we are discussing a image compression technique called SVD (Singular Valued Decomposition). Even though DCT gives high energy compaction as compared to SVD which gives optimal energy compaction, SVD performs better than DCT in case of images having high standard deviation (i.e. higher pixel quality). SVD is a linear matrix transformation used for compressing images. Using SVD an image matrix is represented as the product of three matrices U, S, and V where S is a diagonal matrix whose diagonal entries are singular values of matrix A. The image A can also be represented by using less number of singular values, thus, presenting necessary features of an image while compressing it. The compressed image requires less storage space as compared to the original image. To choose the value of k i.e. number of Eigen values for compression and reconstruction of the image is an important decision for acceptable reconstruction. It varies with application and in this work compression ratio is used to select the number of Eigen values out of the Copyright © 2013 SciResPub. II. BASIC MATHEMATICS Singular Value Decomposition(SVD) is a linear image matrix transformation in which an image matrix G is decomposed into 3 component matrices L, D & R such that G = LDRT (1) where G is a m × n matrix D is a m × n diagonal matrix in which the entries along the diagonal of D are singular values of G. Singular value of a matrix is calculated by taking square root of its eigen value. L is a m × m matrix containing left singular vectors of G and R is a n × n matrix containing right singular vectors of G. L and R are orthonormal matrices which means LLT = I and RRT = I In matrix form equation (1) can be written as 0 σ 1 0 0……… 0 σ 2 0 0 ………….0 G = [l 1 , l 2 ,………,l m] 0 0 σ 3 0 0 0 …… . . . σr 0 0 ……………. σ N r1 r2 . . . rn IJOART International Journal of Advancements in Research & Technology, Volume 2, Issue 8, August-2013 ISSN 2278-7763 Where l 1 , l 2 , …………… l m are m×1 column vectors r 1 , r 2 , …………... r n are 1×n row vectors and σ i for i=1, 2,…….N are the singular values of matrix G. The singular values are arranged along the diagonal of D in such a way that σ 1 ≥σ 2 ≥σ 3 ………..≥σ N ≥0 Also, σ i = √λ i where λ i for i = 1, 2,……….,N are the eigen values of image matrix G. Calculating L, D & R: From equation (1), we know that G = LDRT T Therefore, G = (LDRT)T = RDTLT GGT = LDRT × RDTLT = LDDTLT = LD2LT T (since RR =I) (2) From above equation, it is clear that matrix L is obtained from the eigenvectors of GGT. Similarly, it can be shown that, Image compression techniques reduce the number of bits required to represent an image by taking advantage of these redundancies. Removing the redundancies is equivalent to reducing the number of bits required to represent an image without much compromise in the image quality. Different image compression techniques apply different methods or more appropriately coding algorithms to achieve this. Now let us see how this is achieved using SVD. By applying SVD on an image, the image matrix G is decomposed into 3 different matrices L, D and R. However, simply applying SVD on an image does not compress it. To compress an image, after applying SVD, only a few singular values are retained while other singular values are discarded. This follows from the fact that singular values are arranged in descending order on the diagonal of D and that first singular value contains the greatest amount of information and subsequent singular values contain decreasing amounts of image information. Thus, the lower singular values containing negligible or less important information can be discarded without significant image distortion. Furthermore, property 1 of SVD (section 3) says that “the number of non-zero singular values is equal to the rank of G.” But even if the lower order singular values after the rank of the matrix are not zero, they have negligible values and are treated as noise. Equation (1) above can also be written as IJOART GTG = RDTDRT = RD2RT Therefore, eigenvectors of GTG gives R. III. 245 PROPERTIES OF SVD Following are some of the important properties of SVD 1. The rank of matrix G is equal to the number of non-zero singular values. 2. GGT = LD2LT and hence L daigonalizes the matrix G and column vectors of L are the eigenvectors of GGT. 3. Similarly, GTG = RD2RT, R diagonalizes G and hence eigenvectors of GTG are column vectors of R. 4. The singular values of matrix G i.e. σ 1 , σ 2 , σ 3 ……….., σ N are unique, however the matrices L and R are not unique. IV. IMAGE COMPRESSION USING SVD Image compression involves reducing the redundant or irrelevant information in an image. Redundancies in an image may be in the form of 1. Psycho visual redundancy, which is due to the limitations of the human visual system to interpret very fine details in an image.(i.e. visually nonessential information) 2. Inter pixel redundancy, due to similarities in the neighboring pixels. 3. Coding redundancy, in which more number of bits than required are used to encode the image data for transmission.(i.e. less than optimal code words are used) Copyright © 2013 SciResPub. G=l 1 σ 1 r 1 T + l 2 σ 2 r 2 T ……+ l r σ r r r T ……. +l N σ N r N T (2) where r is the rank of G. From property 1 of SVD (refer section 3 above), it follows that truncating equation (2) till r values does not make any significant change in the image. But then the amount of compression achieved will be very less while the image quality is nearly same as original. For good amount of compression to be achieved, only the first k values of equation (2) are taken so that equation (2) becomes G = l 1 σ 1 r 1 T + l 2 σ 2 r 2 T …………+ l k σ k r k T (3) where k < r The image reconstructed using equation (3) above will reduce the storage space requirement to k*(m+n+1) bytes as against the storage space requirement of m*n bytes of the original uncompressed image. Now, our goal of compression is achieved if the storage space required by the compressed image is less than that required by the original image. In other words, m*n > k*(m+n+1) (4) IJOART International Journal of Advancements in Research & Technology, Volume 2, Issue 8, August-2013 ISSN 2278-7763 246 This implies that value of k should be smaller than m*n/(m+n+1) in order to compress any image thus putting an upper limit on the value of k. In short, value of k is chosen such that good amount of compression is achieved while image quality is maintained above the minimum acceptable limit. To compare the results of different compression techniques and also to measure the degree to which an image is compressed, many performance measures are available such as 1. Compression Ratio: Compression Ratio is the ratio of the storage space required to store original image to that required to store a compressed image and is given by Compression Ratio = m*n / (k*(m+n+1)) It measures the degree to which an image is compressed. 2. Mean Square Error(MSE): MSE is the measure of deterioration of image quality as compared to the original image when an image is compressed. It is defined as square of the difference between pixel value of original image and the corresponding pixel value of the compressed image averaged over the entire image. Mathematically, MSE = [ ∑ ∑ g(x,y) – g’(x,y) ] / (m*n) Fig. 1 k = 5 Fig. 2 k = 8 Fig. 4 k = 25 Fig. 3 k = 16 IJOART 3. Power Signal to Noise Ratio (PSNR): As the name suggests, Peak Signal to Noise Ratio (PSNR) is the ratio of maximum signal power to the noise power that corrupts it. In Image compression maximum signal power refers to the original image and noise is introduced to compress it. In other words, noise is the deviation of the compressed image from the original one. Therefore, it follows that PSNR gives the quality of the reconstructed images after compression. Mathematically, PSNR is given by PSNR = 10*log 10 [255/√MSE] Fig. 5 k = 32 Fig. 6 k = 128 V. RESULTS AND DISSCUSSION Images given below show the results of applying SVD on frames of video, taking different values of k. fig. 8 shows the original frame. When the value of k is taken as 5, the image is very blurred which is shown in fig. 1. k = 5 means that the image is reconstructed considering only the first five eigen values of the matrix D. Fig. 2 shows the reconstructed image with k = 8 which is somewhat less distorted than fig. 1. By observing figures 1 to 6, it is clear that as the value of k (i.e. number of Eigen values used for reconstruction of the compressed image) is increased, the compressed image approaches the original image. This implies that image quality goes on increasing as the value of k is increased. When k is equal to the rank of the image matrix, the reconstructed image is almost same as the original one. Mean Square Error (MSE) in this case is very less and PSNR is very high. This can be observed in fig. 7. Fig. 7 k = 392 Fig. 8 Original Image All the above observations can be summarized in the form of a table as shown below: TABLE I SUMMARY OF RESULTS Value of k 5 8 16 25 32 128 392 Compression Ratio 50.52 31.577 15.788 10.1046 7.89 1.973 0.644 MSE (dB) PSNR (dB) 35.192 38.8 35 32.21 30.58 29.047 -79.5 -32.32 -30.2716 -26.478 -23.68 -22.05 -9.2022 240.77 (rank of image) Copyright © 2013 SciResPub. IJOART International Journal of Advancements in Research & Technology, Volume 2, Issue 8, August-2013 ISSN 2278-7763 400 405 410 415 0.632 0.624 0.616 0.609 -79.48 -79.47 -79.47 -79.46 247 240.75 240.75 240.74 240.73 In the above table, degree of compression is measured using compression ratio and MSE & PSNR values expressed in dB are used as a measure of image quality. Following conclusions can be drawn on the basis of the above table 1 and figures (a) to (h):1. 2. 3. 4. 5. 6. 7. Value of k represents the number of Eigen values used in the reconstruction of the compressed image. Smaller the value of k, the more is the compression ratio (i.e. less storage space is required) but image quality deteriorates (i.e. larger MSE and smaller PSNR values). As the value of k increases, image quality improves (i.e. smaller MSE and larger PSNR) but more storage space is required to store the compressed image. Thus, it is necessary to strike a balance between storage space required and image quality for good image compression. And from the above observations, it is found that optimum compression results are obtained when MSE of the compressed image is just less than or equal to 30dB (i.e. MSE ≤ 30dB). In our case, this is obtained when value of k is 128. Generally, choice of k depends on the application. For instance, in some applications, if image quality is important then higher values of k are chosen. But sometimes storage space is more important than image quality , in that case lower k values are taken. But, from equation (4) of section 4 above, it follows that value of k should be chosen such that, k < m*n/ (m+n+1). Therefore, in our case value of k should be smaller than 253 in order to achieve compression. When k is equal to the rank of the image matrix, the reconstructed image is almost same as the original one. And as k is increased further, there is very negligible decrease in MSE and increase in PSNR values. This means that there is very negligible improvement in the image quality. Fig. 9 PSNR (dB) vs Normalized number of Eigen values plotted on logarithmic scale. IJOART Fig. 10 MSE(dB) vs Normalized number of Eigen values All the above results can be graphically expressed as: Fig. 11 Compression Ratio vs Normalized number of Eigen values Copyright © 2013 SciResPub. IJOART International Journal of Advancements in Research & Technology, Volume 2, Issue 8, August-2013 ISSN 2278-7763 248 VI. CONCLUSIONS Thus it is observed that SVD gives good compression results with less computational complexity compared to other compression techniques. A certain degree of compression as required by an application can be achieved by choosing an appropriate value of k (i.e. the number of eigen values). In other words, degree of compression can be varied by varying the value of k. However to achieve high value of compression ratio image quality is to be sacrificed .Therefore it is required to select proper value of k to choose between compression ratio and image quality. Once the value of k is selected for specific application or for specific video the same benchmark can be used for all the frames. Besides image compression, SVD finds application in noise reduction, face recognition, water marking, etc. REFERENCES [1] S. Jayaraman, Essaki Rajan, T. Veerakumar, Digital Image Processing, PSG College of Technology, Coimbatore, Tamil Nadu, India, TMH, 2010. [2] Dr.Tinku Acharya and Dr.A. K.Ray , Image Processing principles and applications. [3] Rafael Gonzales, Richard Woods, Digital Image Processing. [4] Singular Value Decomposition Applied To Digital Image Processing by Lijie Cao, Division of Computing Studies, Arizona State university Polytechnic Campus, Arizona. [5] The Singular Value Decomposition and Its Applications on Image Processing by Christopher Jason Ogden, Tammie Huff, Math 45, College of the Redwoods, December 17, 1997. [6] A Hybrid DCT-SVD Video Compression Technique (HDCTSVD) by Tong, Lin; Rao, K.R. [7] Image Compression using Singular Value Decomposition by Adam Abrahamsen and David Richards, December 14, 2001. [8] M. Mahalaxmi, ‘Real Time Vision Based Object Tracking using CAMSHIFT Algorithm with Enhanced Color Image Segmentation’, Second International Conference on Computing Communication and Networking Technologies, 2010, DOI-971-14244-6589-7/10 IEEE [9] Friedman, B , “Eigenvalues of compound matrices”, Research Rept. No. TW-16, Math. Res. Group. New York U., New York, 1951. [10] Eldrich, John (2006), "Eigenvalue, eigenfunction, eigenvector, and related terms ", in Jeff Miller (Editor), Earliest Known Usesof Some of the Words of Mathematics, http://jeff560.tripod.com/e.html, retrieved 2006-08-22; Strang, Gilbert (1993), Introduction to linear algebra, WellesleyCambridge Press, Wellesley [11] Eigenvalue, eigenvector and eigenspaceFrom Wikipedia, the free encyclopedia IJOART Copyright © 2013 SciResPub. IJOART