⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lpdemo.m

📁 This toolbox contains Matlab files that implement the Laplacian pyramid (LP) decomposition and the
💻 M
字号:
% LPDEMO% Demo of the Laplacian pyramid functionsx = imread('cameraman.tif');x = double(x)/256;% Laplacian decomposition using 9/7 filters and 5 levelspfilt = '9/7';n = 5;y = lpd(x, '9/7', n);% Display outputfigure(1)colormap(gray)nr = floor(sqrt(n+1));nc = ceil((n+1)/nr);for l = 1:n+1    subplot(nr, nc, l);     imageshow(y{l});end% Reconstructionxr = lpr(y, pfilt);% Show perfect reconstructionfigure(2)colormap(gray)subplot(1,2,1), imageshow(x, [0, 1]);subplot(1,2,2), imageshow(xr, [0, 1]);title(sprintf('SNR = %.2f dB', SNR(x, xr)))% Reconstruction with only R percent of most significant coefficientsr = input('Enter the percentage of retained coefficients (say 10): ');if isempty(r)    r = 10;endif ~isnumeric(r) | (r < 0) | (r > 100)    error('Please enter a number between 0 and 100');end% Put all coefficients in one column vector for processing[c, s] = lp2vec(y);% Sort the coefficient in the order of magnitudecsort = sort(abs(c));csort = flipud(csort);% Threshold to retain only R percent of most significant coefficientsnc = sum(prod(s, 2));m = round(nc/100*r);thresh = csort(m);cr = c .* (abs(c) >= thresh);% Reconstructiony = vec2lp(cr, s);xr = lpr(y, pfilt);figure(2)colormap(gray)subplot(1,2,1), imageshow(x, [0, 1]);subplot(1,2,2), imageshow(xr, [0, 1]);title(sprintf('New reconstruction with %.1f%% of coefs\nSNR = %.2f dB', ...    r, SNR(x, xr)));% Now compare with the old reconstruction methodinput('Press Enter key to continue...');xr1 = lpr_old(y, pfilt);subplot(1,2,1), imageshow(xr1, [0, 1]);title(sprintf('Reconstruction using the old method\nSNR = %.2f dB', ...    SNR(x, xr1)));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -