首页 > 代码库 > 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。