EDA365电子论坛网
标题:
基于matlab CBF算法之图像融合
[打印本页]
作者:
uperrua
时间:
2021-4-28 11:02
标题:
基于matlab CBF算法之图像融合
% j, t* t% O: r/ l! k1 L; f' q
一、源代码
2 H2 q0 n w. g8 N. X' w
' G: h% t% @, p
close all;
clear all;
clc;
%%% Fusion Method Parameters.
cov_wsize=5;
%%% Bilateral Filter Parameters.
sigmas=1.8; %%% Spatial (Geometric) Sigma. 1.8
sigmar=25; %%% Range (Photometric/Radiometric) Sigma.25 256/10
ksize=11; %%% Kernal Size (should be odd).
arr=['A';'B'];
for m=1:2
string=arr(m);
% inp_image=strcat('images\med256',string,'.jpg');
inp_image=strcat('images\office256',string,'.tif');
% inp_image=strcat('images\gun',string,'.gif');
x{m}=imread(inp_image);
if(size(x{m},3)==3)
x{m}=rgb2gray(x{m});
end
end
[M,N]=size(x{m});
%%% Cross Bilateral Filter.
tic
cbf_out{1}=cross_bilateral_filt2Df(x{1},x{2},sigmas,sigmar,ksize);
detail{1}=double(x{1})-cbf_out{1};
cbf_out{2}= cross_bilateral_filt2Df(x{2},x{1},sigmas,sigmar,ksize);
detail{2}=double(x{2})-cbf_out{2};
%%% Fusion Rule (IEEE Conf 2011).
xfused=cbf_ieeeconf2011f(x,detail,cov_wsize);
toc
xfused8=uint8(xfused);
if(strncmp(inp_image,'gun',3))
figure,imagesc(x{1}),colormap gray
figure,imagesc(x{2}),colormap gray
figure,imagesc(xfused8),colormap gray
else
figure,subplot(131);imshow(x{1});title('图1')
subplot(132);imshow(x{2});title('图2')
subplot(133),imshow(xfused8) ;title('融合后')
end
% axis([140 239 70 169]) %%% Office.
fusion_perform_fn(xfused8,x);
" C; @# i9 [1 l
?' d, [9 A% m% X3 E
- k$ D1 x2 P, }- X$ Y
二、运行结果
0 o8 \. x4 g1 L* W l9 d7 x
' b9 @/ `6 R W, e0 b) u- C
2.png
(284.2 KB, 下载次数: 8)
下载附件
保存到相册
2021-4-28 11:01 上传
作者:
youOK
时间:
2021-4-28 13:11
基于matlab CBF算法之图像融合
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2