image compression using svd and dct - home - · pdf fileimage compression using svd and dct...
TRANSCRIPT
![Page 1: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/1.jpg)
Image Compression using SVD and DCT
Math 2270-003
Spring 2012
Yizhou Ye
![Page 2: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/2.jpg)
Image? Matrix?
![Page 3: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/3.jpg)
Matrix?
![Page 4: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/4.jpg)
Notes
Image File = Header + RGB / GrayScale Maple / Matlab what do they do?
![Page 5: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/5.jpg)
Matlab API
A = imread(filename, fmt) reads a grayscale or color image from the file specified by the string filename.
The return value A is an array containing the image data. If the file contains a grayscale image, A is an M-by-N array. If the file contains a true-color image, A is an M-by-N-by-3 array.
![Page 6: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/6.jpg)
.jpeg, .jpg
Image == matrix? No. Approximate way
![Page 7: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/7.jpg)
Basically
Read Image Matrix SVD / DCT done/ compressed
![Page 8: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/8.jpg)
SVD
SVD: singular value decomposition
![Page 9: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/9.jpg)
SVD
Note that A is m*n, U is m*m orthogonal matrix, Σ is an m*n matrix containing singular values of A, and V is an r*r orthogonal matrix. And the singular values of A are:
All these singular values are along the main diagonal of Σ.
We can rewrite the formula in the following way:
![Page 10: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/10.jpg)
SVD
![Page 11: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/11.jpg)
Approximation
Approximation of SVD is the most crucial part:
We know that the terms {Ai} are ordered from greatest to lowest, thus we can approximate A by varying the number of items. In other words, we can change the rank of A to make the approximation (of course, larger number gives us a more accurate approximation).
![Page 12: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/12.jpg)
Example:
One term Three terms
![Page 13: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/13.jpg)
Examples:
10 terms 50 terms
![Page 14: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/14.jpg)
Examples:
100 terms 300 terms
![Page 15: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/15.jpg)
Examples:
300 terms (rank) Original image
![Page 16: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/16.jpg)
Issues
Compression Ratio: Not exactly (1+m+n) / (m*n) for a m*n A This plot is draw by matlab: Image is more complex
than we thought MatLab Read original size: 24206
Just the RGB / GrayScaler
![Page 17: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/17.jpg)
Ratio
0
0.2
0.4
0.6
0.8
1
1.2
Ratio
Ratio
# of terms
![Page 18: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/18.jpg)
Cost of items
-200
0
200
400
600
800
1000
1200
1400
1600
Cost of one term
index of terms
byte
![Page 19: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/19.jpg)
DCT
“Discrete Cosine Transformation”, which works by separate image into parts of different frequencies.
A “lossy” compression, because during a step called “quantization”, where parts of compression occur, the less important frequencies will be discarded. Later in the “recombine parts” step, which is known as decompression step, some little distortion will occur, but it will be somehow adjusted in further steps.
![Page 20: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/20.jpg)
DCT Equations
i, j are indices of the ij-th entry of the image matrix, p(x, y) is the matrix element in that entry, and N is the size of the block we are working on.
![Page 21: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/21.jpg)
8 * 8 blocks
For a standard procedure where N=8, the equation can be also written as the following form:
![Page 22: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/22.jpg)
T matrix
![Page 23: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/23.jpg)
Procedure
Break the image matrix into 8*8 pixel blocks Applying DCT equations to each block in level
order Each block is compressed through
quantization Basically done. When desired, it can be decompressed, by
Inverse Discrete Cosine Transformation.
![Page 24: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/24.jpg)
Example of DCT
![Page 25: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/25.jpg)
-128 for each entry
Since pixels are valued from -128 to 127
![Page 26: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/26.jpg)
Apply D = TMT’
T matrix is from the previous equations.
![Page 27: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/27.jpg)
Human eye fact
The human eye is fairly good at seeing small differences in brightness over a relatively large area
But not so good at distinguishing the exact strength of a high frequency (rapidly varying) brightness variation.
![Page 28: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/28.jpg)
We know the fact, then
This fact allows one to reduce the amount of information required by ignoring the high frequency components. This is done by simply dividing each component in the frequency domain by a constant for that component, and then rounding to the nearest integer.
This is the main lossy operation in the whole process. As a result of this, it is typically the case that many of the higher frequency components are rounded to zero, and many of the rest become small positive or negative numbers.
![Page 29: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/29.jpg)
Quantization Matrix
![Page 30: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/30.jpg)
Quantization
quantization level = 50, a common choice of Q matrix
![Page 31: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/31.jpg)
Round Equation
Typically, upper left corner. Thus we apply zig-zag order:
![Page 32: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/32.jpg)
Zip-Zag Ordering
![Page 33: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/33.jpg)
Original VS. Decompressed
![Page 34: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/34.jpg)
Examples
![Page 35: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/35.jpg)
More Examples
![Page 36: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/36.jpg)
Finale
Image can be expressed by matrix somehow, but image is much more than that.
SVD and DCT are techniques to compress image, but both of them are “lossy”.
Still many other ways to compress:
![Page 37: Image Compression using SVD and DCT - Home - · PDF fileImage Compression using SVD and DCT Math 2270-003 Spring 2012 ... This plot is draw by matlab: Image is more complex ... where](https://reader034.vdocuments.mx/reader034/viewer/2022051201/5a703a9a7f8b9a9d538bc463/html5/thumbnails/37.jpg)
Thank you!