- divide the image to 8x8 matrices
- use DCT to each 8x8 matrix
- sum up all the 8x8 matrices and get a matrix sum_mat
- sort the elements of 8x8 matrix(sum_mat) from the highest to the smallest, and get the indices list
- choose (some) highest coefficients: the ratio: (some high energy)/(total energy) is good enough (or pick the first N highest coefficients)
- save the index list of the high energy (coefficient). In each 8x8 matrix, only save these coefficients.
- build 8x8 matrices with zero and store the right coefficient in the right place with the index list.
- use IDCT to each matrix
- 8x8 matrices to big image size matrix. (restored_img)
- Calculate SNR: SNR = (sum(original_img(:).^2)) / (sum(original_img(:)-restored_img(:)).^2)
Tuesday, October 30, 2007
JPEG compression
The basic jpeg compression steps (only think of gray level image):
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment