tailieunhanh - A Concise Introduction to Data Compression- P5
Tham khảo tài liệu 'a concise introduction to data compression- p5', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | The Wavelet Transform 213 clear main program filename lena128 dim 128 fid fopen filename r if fid -1 disp file not found else img fread fid dim dim fclose fid end thresh percent of transform coefficients deleted figure 1 imagesc img colormap gray axis off axis square w harmatt dim compute the Haar dim x dim transform matrix timg w img w forward Haar transform tsort sort abs timg tthresh tsort floor max thresh dim dim 1 cim timg. abs timg tthresh i j s find cim dimg sparse i j s dim dim figure 2 displays the remaining transform coefficients figure 2 spy dimg colormap gray axis square figure 2 image dimg colormap gray axis square cimg full w sparse dimg w inverse Haar transform density nnz dimg disp num2str 100 thresh of smallest coefficients deleted. disp num2str density coefficients remain out of . num2str dim x num2str dim . figure 3 imagesc cimg colormap gray axis off axis square File with two functions function x harmatt dim num log2 dim p sparse eye dim q p i 1 while i dim 2 q 1 2 i 1 2 i sparse individ 2 i p p q i 2 i end x sparse p function f individ n x 1 1 sqrt 2 y 1 -1 sqrt 2 while min size x n 2 x x zeros min size x max size x . zeros min size x max size x x end while min size y n 2 y y zeros min size y max size y . zeros min size y max size y y end f x y Figure Matlab Code for the Haar Transform of an Image. Please purchase PDF Split-Merge on to remove this watermark. 214 5. Image Compression with a little experience with matrices can construct a matrix that when multiplied by this vector results in a vector with four averages and four differences. Matrix A1 of Equation does that and when multiplied by the top row of pixels of Figure generates . Similarly matrices A2 and A3 perform the second and third steps of the transform respectively. The results are shown in Equation Ai 2 1 2 0 0 0 0 0 0 0 0 1 2 1 2 0 0 0 0 0 0 0 0 1 2 1 2 0 0 0 0 0 0 0 0 1 2 1 2 1 2 1 2
đang nạp các trang xem trước