<span style="font-size:18px;">clear
inputPath ='D:\数字图像处理\研究方向\Filter Smooth\images\';
filename = [inputPath 'pai.png'];
I = im2double(imread(filename));
if size(I,3)==3
I=rgb2gray(I);
end
nlev=4;
sigma=1;
sigma_r=0.1;
f = [.05, .25, .4, .25, .05];
f = f'*f;
%构建拉普拉斯金字塔
pyr = cell(nlev,1);
J = I;
for l = 1:nlev-1
J_gauss = imfilter(J,f,'replicate');
J_gauss_down = J_gauss(1:2:size(J_gauss,1)-1,1:2:size(J_gauss,2)-1); %downsample
J_gauss_high = imresize(J_gauss_down,[size(J_gauss,1) size(J_gauss,2)],'bilinear');
pyr{l} = J-J_gauss_high;
J=J_gauss_down;
end
pyr{nlev}=J_gauss_down;
% for i=1:length(pyr)
% figure;imshow(mat2gray(pyr{i}));
% end
%从金字塔重建图像
out = pyr{nlev};
for l = nlev-1 : -1 : 1
out = pyr{l} + imresize(out,[size(pyr{l},1) size(pyr{l},2)],'bilinear&
图像拉普拉斯金字塔(laplacian pyramid)并从金字塔重建原图 matlab程序实现
最新推荐文章于 2024-08-14 13:57:02 发布
本文介绍了如何使用MATLAB实现拉普拉斯金字塔算法,并展示了该算法从金字塔重建原始图像的过程及其运行效果。
摘要由CSDN通过智能技术生成