11 篇文章 1 订阅

# 多分辨率分析—高斯金字塔与拉普拉斯金字塔

## 示例代码

• demo.m

clc;
clear;
close all;

img=imread('timg.jpg');
[m,n]=size(img);

if size(img,3)==3
img = rgb2gray(img);
end

gauss_pyr=gauss_pyramid2(img,5);

% for i=1:length(gauss_pyr)
%    figure;imshow(gauss_pyr{i});
% end

for i=1:length(gauss_pyr) -1          %获得残差图像，i级预测残差
imgn{i}=gauss_pyr{i} - expand(gauss_pyr{i+1});
end

for i=1:length(imgn)
figure;imshow(imgn{i});
end

• gauss_pyramid2.m

function pyr = gauss_pyramid2(I,nlev)

pyr = cell(nlev,1);
pyr{1} = I;
G_LOWER = I;

f = [0.05 0.25 0.4 0.25 0.05];
f = f'*f;

for l = 2:nlev
G_LOWER=G_LOWER(1:2:size(G_LOWER,1)-1,1:2:size(G_LOWER,2)-1); %downsample
pyr{l}=imfilter(G_LOWER, f, 'replicate');
end

end

• expand.m

function re=expand(img)

%双三次内插
img = imresize(img, 2, 'bicubic');

re = img;
end

08-02
03-03 1万+

07-05 1506
02-18 1万+
07-16 7472
05-10 1209
08-16
07-24 2170
©️2022 CSDN 皮肤主题：大白 设计师：CSDN官方博客

¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。