首页 > 代码库 > IMAGE FUSION USING LAPLACIAN PYRAMID

IMAGE FUSION USING LAPLACIAN PYRAMID

拉普拉斯金字塔也可以用于融合图像,具体运行结果和图像如下:

原图像:

 

融合后图像:

代码如下:

%清屏clear all; close all; clc;%读取图像及尺寸fimg=double(imread(1807i_12.bmp));simg=double(imread(1807v_12.bmp));[fm,fn]=size(fimg);[sm,sn]=size(simg);%高斯滤波器w=1/8*[0,1,0;1,4,1;0,1,0];fimgn{1}=fimg;%滤波,下采样for i=2:5                     fimgn{i}=imfilter(fimgn{i-1},w,replicate);   fimgn{i}=fimgn{i}(1:2:size(fimgn{i},1)-1,1:2:size(fimgn{i},2)-1); %i-1级近似%    figure;%    imshow(uint8(fimgn{i}));%    imwrite(uint8(fimgn{i}),strcat(fimg_,num2str(i-1),.bmp));endfor i=5:-1:2        %调整图像大小   fimgn{i-1}=fimgn{i-1}(1:2*size(fimgn{i},1),1:2*size(fimgn{i},2)); endsimgn{1}=simg;%滤波,下采样for i=2:5                     simgn{i}=imfilter(simgn{i-1},w,replicate);   simgn{i}=simgn{i}(1:2:size(simgn{i},1)-1,1:2:size(simgn{i},2)-1); %i-1级近似%    figure;%    imshow(uint8(simgn{i}));%    imwrite(uint8(simgn{i}),strcat(simg_,num2str(i-1),.bmp));endfor i=5:-1:2        %调整图像大小   simgn{i-1}=simgn{i-1}(1:2*size(simgn{i},1),1:2*size(simgn{i},2)); endfor i=1:5    averimgn{i}=(1/2)*(fimgn{i}+simgn{i});%     figure;%     imshow(uint8(averimgn{i}));%     imwrite(uint8(averimgn{i}),strcat(averimg_,num2str(i-1),.bmp));end for i=1:4          %获得残差图像,i级预测残差    averimgn{i}=averimgn{i}-pyexpand(averimgn{i+1},w);     end  for i=4:-1:1        %残差图像重构原图像    averimgn{i}=averimgn{i}+pyexpand(averimgn{i+1},w);%     figure;%     imshow(uint8(averimgn{i}));%     imwrite(uint8(averimgn{i}),strcat(averimg_,num2str(i-1),.bmp)); end  figure; imshow(uint8(averimgn{1})); imwrite(uint8(averimgn{1}),strcat(averimg.jpg));

 

IMAGE FUSION USING LAPLACIAN PYRAMID