compare_compress.m
来自「为stanford大学donoho教授所编写的redgit变换源代码。是用c编写」· M 代码 · 共 32 行
M
32 行
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 + =
减小字号Ctrl + -
显示快捷键?