📄 compare_compress.m
字号:
function compare_compress(im, ratio)
% Compare compression performance using FRITO and WAVEDEC2
% compare_compress(im, ratio)
%
% IM is the input image of size 257 by 257. RATIO is the compression
% ratio, between 0 and 1 (O for no compression, typically 0.99)
% Wavelet parameters
wname = 'coif2';
nlevels = 8;
% Compression using FRITO
[r, l, m] = frito(im, wname);
rc = compress(r, ratio);
rim = ifrito(rc, l, m, wname);
% Compression using WAVEDEC2
im1 = im(1:end-1,1:end-1); % dyadic length
[w, wl] = wavedec2(im1, nlevels, wname);
wc = compress(w, ratio);
wim = waverec2(wc, wl, wname);
% Display
subplot(1,2,1), imagesc(rim, [0, 1]), axis square,
title(sprintf('Compressed image using FRIT\n(Ratio = %.1f %%; SNR = %.2f dB)', ...
100*ratio, SNR(im, rim)), 'FontSize', 12);
subplot(1,2,2), imagesc(wim, [0, 1]), axis square,
title(sprintf('Compressed image using WAVEDEC2\n(Ratio = %.1f %%; SNR = %.2f dB)', ...
100*ratio, SNR(im1, wim)), 'FontSize', 12);
colormap('default');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -