MATLAB 双通道PCNN算法


 
 
function Fused=Dual_PCNN(Ahigh,Bhigh,Abeta,Bbeta)

SF_Ahigh =SF(abs(Ahigh));
SF_Bhigh = SF(abs(Bhigh));
[p1,q1]=size(Ahigh);
[p2,q2]=size(Bhigh);
if(p1~=p2||q1~=q2)
    error('The size of image A and image B must be the same......');
end

%% set the parameter for dual channel pcnn
alphaL = 0.01;
alphaTheta = 0.1;
Vl = 0.2;
con=1;

%% Dual channel pcnn process
L = zeros(p1,q1);
U = zeros(p1,q1);
Theta = zeros(p1,q1);
Y = zeros(p1,q1);
fuse=zeros(p1,q1);
VTheta = 25;
%beta=2.6;
W=[0.707,1,0.707;1,0,1;0.707,1,0.707];
N1 = 200;%iteration times
for num = 1:N1;
    K = conv2(Y,W,'same');
    L = exp(-alphaL)*L + Vl*K;
    Theta = exp(-alphaTheta)*Theta + VTheta*Y;
    U = max(SF_Ahigh.*(con+Abeta.*L),SF_Bhigh.*(con+Bbeta.*L));
    Y = im2double(U>Theta);
    %Y0 = Y0 +Y;
end
for i = 1:p1
    for j = 1:q1
        if(SF_Ahigh(i,j)*(con + Abeta(i,j)*L(i,j)) == U(i,j))
            fuse(i,j) = Ahigh(i,j);
        else
            if(SF_Bhigh(i,j)*(con + Bbeta(i,j)*L(i,j)) == U(i,j))
                fuse(i,j) = Bhigh(i,j);
            end
        end
    end
end
Fused=fuse;
end


你可能感兴趣的:(MATLAB 双通道PCNN算法)