• 大小: 16KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-21
  • 语言: Matlab
  • 标签: 互信息  matlab  

资源简介

matlab连续计算图像间的互信息值程序~一共计算了配准前配准后的图像间的互信息值,一套数据图片760张

资源截图

代码片段和文件信息

%%   设置参数  %%%%%%%%%%%%%%%%%%%%%%%%
picture_number=760;
Result3_1=zeros(1picture_number-1);
Result3_2=zeros(1picture_number-1);

%%  配准前互信息的计算  %%%%%%%%%%%%%%%

for m=1:picture_number-1;    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   if m<=3
               
    a=‘Mouse000‘;
    b=‘_RT8_p‘;
    c=‘a‘;
    d=‘.jpg‘;
    I1=strcat(aint2str(2*m)bint2str(2*m)cd);
    F1=imread(I1);
    I2=strcat(aint2str(2*m+2)bint2str(2*m+2)cd);
    G1=imread(I2);
    F1=rgb2gray(F1);
    G1=rgb2gray(G1);
    Pf=imhist(F1)./numel(F1);         
    Pg=imhist(G1)./numel(G1);
    Pfg=zeros(256256);
    for i=1:2704
        for j=1:4064
            Pfg(F1(ij)+1G1(ij)+1)=Pfg(F1(ij)+1G1(ij)+1)+1;
        end
    end
    W=sum(Pfg(:));
    Pfg=Pfg/W;
    N1=-sum(Pf.*log10(Pf+eps));
    N2=-sum(Pg.*log10(Pg+eps));
    Pfg=Pfg.*log10(Pfg+eps);
    N12=-sum(Pfg(:));
    Result3_1(m)=N1+N2-N12;
    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    elseif m==4
        
        
               F1=imread(‘Mouse0008_RT8_p8a.jpg‘);
               G1=imread(‘Mouse0010_RT8_p10a.jpg‘);
               F1=rgb2gray(F1);
               G1=rgb2gray(G1);
               Pf=imhist(F1)./numel(F1);         
               Pg=imhist(G1)./numel(G1);
               Pfg=zeros(256256);
                for i=1:2704
                   for j=1:4064
                       Pfg(F1(ij)+1G1(ij)+1)=Pfg(F1(ij)+1G1(ij)+1)+1;
                   end
               end
               W=sum(Pfg(:));
               Pfg=Pfg/W;
               N1=-sum(Pf.*log10(Pf+eps));
               N2=-sum(Pg.*log10(Pg+eps));
               Pfg=Pfg.*log10(Pfg+eps);
               N12=-sum(Pfg(:));
               Result3_1(m)=N1+N2-N12;   
               
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%               
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    elseif m>=5
        
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            if m<=48   
                 
             a=‘Mouse00‘;
             b=‘_RT8_p‘;
             c=‘a‘;
             d=‘.jpg‘;
             I1=strcat(aint2str(2*m)bint2str(2*m)cd);
             F1=imread(I1);
             I2=strcat(aint2str(2*m+2)bint2str(2*m+2)cd);
             G1=imread(I2);
             F1=rgb2gray(F1);
             G1=rgb2gray(G1);
             Pf=imhist(F1)./numel(F1);         
             Pg=imhist(G1)./numel(G1);
             Pfg=zeros(256256);
              for i=1:

评论

共有 条评论