MATLAB Curvelet-4PCNN图像融合算法核心源码


%% by Vincent 
path(path,'PCNN_toolbox/')
path(path,'FusionEvaluation/')
path(path,'fusetool/')
%%
%Low_Coeffs_Rule='PCNN'; %'ave','PCNN','SF-PCNN'
%High_Coeffs_Rule='PCNN'; %'max','PCNN','SF-PCNN'
%
%% Parameters for Curvelet
im1=double(imread('lena_1.png')); 
im2=double(imread('lena_2.png')); 
im3=double(imread('lena_3.png')); 
im4=double(imread('lena_4.png')); 
im1=im1(:,:,1); 
im2=im2(:,:,1); 
Im3=im3(:,:,1); 
Im4=im4(:,:,1); 
%% Parameters for PCNN
Para.iterTimes=200;
Para.link_arrange=3;
Para.alpha_L=0.06931;% 0.06931 Or 1
Para.alpha_Theta=0.2;
Para.beta=3;% 0.2 or 3
Para.vL=1.0;
Para.vTheta=20;
%%
disp('Decompose the image via curvelet ...')
yA = fdct_wrapping(im1,1,2); 
yB = fdct_wrapping(im2,1,2);
yC = fdct_wrapping(im1,1,2); 
yD = fdct_wrapping(im2,1,2); 
n = length(yA);

%% Initialized the coefficients of fused image
Fused=yA;

for l = 1:n
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    for d = 1:length(yA{l})
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        Ahigh = yA{l}{d};
        Bhigh = yB{l}{d};
        Chigh = yC{l}{d};
        Dhigh = yD{l}{d};
       [Abeta,Bbeta] = weighting(yA{l}{d},yB{l}{d});
       [Cbeta,Dbeta] = weighting(yC{l}{d},yD{l}{d});
       Fused{l}{d} = Four_PCNN(Ahigh, Bhigh,Chigh,Dhigh,Abeta,Bbeta,Cbeta,Dbeta);      
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    end
end
%=============================================
f_im = real(ifdct_wrapping(Fused,1)); 
disp('Reconstruct is ended...')
%%
Fusion=Fusion*255;
Fusion(Fusion<0)=0;
%disp('F>255')
Fusion(Fusion>255)=255;
Fusion=round(Fusion);
%%
Eval=Evaluation(double(ori_A),double(ori_B),Fusion,256);
disp(Eval)
%%


你可能感兴趣的:(图像处理)