150 likes | 260 Views
Image Compression by Singular Value Decomposition. Presented by Annie Johnson MTH421 - Dr. Rebaza May 9, 2007. The Quandary. Storing/sharing high resolution digital images comes at a cost Obviously, the larger the file(s), more memory is needed to share/accept/store such file(s)
E N D
Image CompressionbySingular Value Decomposition Presented by Annie Johnson MTH421 - Dr. Rebaza May 9, 2007
The Quandary • Storing/sharing high resolution digital images comes at a cost • Obviously, the larger the file(s), more memory is needed to share/accept/store such file(s) • Web sites on the internet are generally made up of many pictures – systems can become completely clogged with the storage/transmission of images • This can lead to spending a lot of time online (slow speed) • You need capable machinery
Resolution to the Quandary • Using Singular Value Decomposition for image compression is a very useful tool: • With SVD, we can reduce the sizes of image matrices • By transforming the original matrices into UΣVT • Then, using the rank of a matrix, we can remove redundant information • Which leads to us approximating the matrix by using fewer entries • In turn, we get images indistinguishable from their original images - only using a percentage of the original storage space
The Idea Summarized • So to summarize, what we are doing is applying SVD to images and then extracting "enough" information from the images to recreate images that are "close" to their originals. • Based on the level of detail that is needed in an image, we can choose to store more or less bytes in the compressed file.
Details of How it Works • Suppose we have a grayscale image • (126x128 pixels) • We can use a matrix to represent this image • Each component is represented by a 0-255 • Write it as a 126X128 matrix A • Next, we can decompose A by SVD which gives us A= UΣVT • U is 126x126, Σ is 126X128, and V is 128x128 • columns of U= are eigenvectors of AAT • diagonal entries of ∑= the normalized singular values (√λ for ATA) • columns of V= are eigenvectors of ATA • U and V are orthogonal matrices
Details of How it Works Cont. • SVD, singular values = rank(A) • Furthermore, the matrix A can also be written as a sum of rank 1 matrices • A = σ1u1vT1 + σ2u2vT2 +…+ σnunvTn • each rank 1 matrix ukvTk is the size of the original matrix. Each one of these matrices is a called a mode. • Since the singular values σi are ordered as σ1 ≥ σ2 ≥…≥ σn ≥ 0, significant compression of the image is possible if the spectrum of singular values has only a few very strong entries.
Details of How it Works Cont. • By eliminating small singular values, we can approximate A • We can therefore reconstruct the image from just a subset of modes.
Examples • Now for some Matlab examples demonstrating the image compression application of SVD. • Command [U,S,V]=svd(A) factors A in Matlab • The first example I will show you, displays side-by-side an original gray-scale image and a sequence of increasingly better approximations • The second example prompts for the number of singular values to use in the compression. Then it displays the original image in figure 1, compressed image in figure 2, and outputs the number of entries in original and compressed images, and the compression factor.
Space Saved How much space is this process saving? Given an image with a x b pixels: r + r(a) + r(b) = size, where r = singular values = rank 8 + 8(126) + 8(128) = 2040 20 + 20(126) + 20(128) = 5100 (~31.6%) 50 + 50(126) + 50(128) = 12750 (~79.0%) Original size: (126)*(128) = 16128
Cost of SVD and Conclusion • When some of the values are discarded an image loses clarity, but this loss in precision is made up for by the reduction in space needed to store the image. • Obviously, this can be applied to color images as well • As you have seen, SVD is a powerful tool. Image compression is just one application.
References • Abrahamsen and Richards, Image Compression Using Singular Value Decomposition, December 14, 2001 <http://online.redwoods.cc.ca.us/instruct/darnold/laproj/Fall2001/AdamDave/textwriteup.pdf> • Bardsley, Lossy Compression using SVD <http://edbardsley.org/classes/15-211/lab4/lossy.html> • Arnold, An Investigation into using Singular Value Decomposition as a method of Image Compression, September 2000 <http://www.cs.bgu.ac.il/~na031/Arnold.pdf> • Buhr and White, Digital Image Compression via Singular Value Decomposition, May 3, 2006