基于EM算法的图像融合算法,对图像不用进行多尺度分解

1.问题描述:

 基于EM算法的图像融合算法,对图像不用进行多尺度分解

2.部分程序:

 

function [Z] = imagefision(mean,x,y,M,iterations);
% Simple function to do EM for a mixture of Gaussians.imagefision
% by Carl Edward Rasmussen, 2006-01-18.

% Initialise parameters
%x=[0.2877  0.7258 -1.465 -0.5883 1.1909 2.1832 1.1892 -0.1364 -0.0376   0.3273 1.0668  0.1746  0.593];
x=x';
%y=[0.2977  0.7958 -1.195 -0.583  1.1909 3.6662 1.9692 -0.1884  -0.1376  0.2273 1.0868  0.1446  0.193];
y=y'; 
n = length(x);        % number of observations
t1 = [0.5 0.5];      % mixing proportions
t2 = [0.5 0.5];
u1 = mean*ones(1,2);      % means
u2 = mean*ones(1,2);
Ic          = ones(n,1);                        % - enable a row replication by the * operator
Ir          = ones(1,2); 
s1=ones(1,2)*var(x);
s2=ones(1,2)*var(y);

for t=1:iterations

  % Do the E-step:
    Q = 0.399 ./ (Ic*sqrt(s1+[eps eps])) .* exp( -((x*Ir - Ic*u1).^2)./(2*Ic*s1+ones(n,2)*eps));
    for m = 1:2
        Z1(:,m)  = (Q(:,m)*t1(m))./(Q*t1(:)+ones(n,1)*eps);
    end
      
    H = 0.399 ./ (Ic*sqrt(s2+[eps eps])) .* exp( -((y*Ir - Ic*u2).^2)./(2*Ic*s2+ones(n,2)*eps));
    for m = 1:2
        Z2(:,m)  = (H(:,m)*t2(m))./(H*t2(:)+ones(n,1)*eps);
    end
  % Do the M-step:

    Z3              = sum(Z1);               % sum each column
    Z3(find(Z3==0)) = eps;                  % avoid devision by zero
    u1               = (x')*Z1 ./ Z3;
    s1              = sum(((x*Ir - Ic*u1).^2).* Z1) ./ Z3;
    t1               = Z3/n;
    Z4              = sum(Z2);               % sum each column
    Z4(find(Z4==0)) = eps;                  % avoid devision by zero
    u2               = (y')*Z2./ Z4;
    s2              = sum(((y*Ir - Ic*u2).^2).*Z2) ./ Z4;
    t2              = Z4/n;
    
end
    
Z= (sum((x')*Z1,2)+sum((y')*Z2,2))./ (sum(Z3,2)+sum(Z4,2)+eps);

3.仿真结论:

D00005

猜你喜欢

转载自blog.csdn.net/ccsss22/article/details/114645581