资源简介

利用典型的加权平均融合算法进行灰度或彩色多模态医学图像融合,程序具体很好的通用性,并且提供几种图像融合客观评价指标,还给出3组宝贵的已配准的待融合图像。

资源截图

代码片段和文件信息

clear all;
clc;


 g_R=0;
 g_G=0;
 g_B=0;

% h_R=0;
% h_G=0;
% h_B=0;

% fenzi_R=0;
% fenzi_G=0;
% fenzi_B=0;

% fenmu_up_R=0;
% fenmu_up_G=0;
% fenmu_up_B=0;

% fenmu_low_R=0;
% fenmu_low_G=0;
% fenmu_low_B=0;

% tableR=[];
% tableG=[];
% tableB=[];

% up = imread(‘high.jpg‘);         %读图像
% low = imread(‘low.jpg‘);

% up=imread(‘lab1.bmp‘);         %读图像
% low=imread(‘lab2.bmp‘);    

% up=imread(‘medA.bmp‘);         %读图像
% low=imread(‘medB.bmp‘);     


% up=imread(‘020_MR_T2.bmp‘);         %读图像
% low=imread(‘020_SPECT_Tc.bmp‘);

% up=imread(‘030_Gad.bmp‘);         %读图像
% low=imread(‘030_T2.bmp‘); 


% up=imread(‘4901i_1.jpg‘);         %读图像
 %low=imread(‘4901v_1.jpg‘); 
 
%  up=imread(‘clockA_1.jpg‘);         %读图像
% low=imread(‘clockB_1.jpg‘); 
 
 
% up=imread(‘clockA.bmp‘);         %读图像
% low=imread(‘clockB.bmp‘);   不可运行,Index exceeds matrix
% dimensions.只有两个分量,不是三维的  512 X 512  uint8

% up=imread(‘ifsr_book1.jpg‘);         %读图像
% low=imread(‘ifsr_book2.jpg‘); 


 [fn1pn1]=uigetfile({‘*.bmp;*.jpg;*.tif‘}‘请选择待融合图像1‘);
 up = imread([pn1 fn1]);  

 [fn2pn2]=uigetfile({‘*.bmp;*.jpg;*.tif‘}‘请选择待融合图像2‘);
 low = imread([pn2 fn2]); 
 
 

figure(1)
imshow(up);                                     %读RGB数值
% title(‘加权-RGB表示的高分辨率图像‘);


[MNcolor]=size(up);


figure(2)
imshow(low); 
% title(‘加权-RGB表示的低分辨率图像‘);


r=double(up(::1));
g=double(up(::2));
b=double(up(::3));

r_low=double(low(::1));
g_low=double(low(::2));
b_low=double(low(::3));

RGB(::1)=0.5*r+0.5*r_low;
RGB(::2)=0.5*g+0.5*g_low;
RGB(::3)=0.5*b+0.5*b_low;

R=RGB(::1);
G=RGB(::2);
B=RGB(::3);

RGB=uint8(round(RGB)); 

figure(3)
imshow(RGB)
% title(‘加权-RGB转化后的图像‘);




              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
              %                       下面是计算平均梯度G                          %
              %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     


for ii=1:M-1
    for jj=1:N-1
        g_R=g_R+sqrt((((r(ii+1jj)-r(iijj))^2+(r(iijj+1)-r(iijj))^2))/2);
        g_G=g_G+sqrt((((g(ii+1jj)-g(iijj))^2+(g(iijj+1)-g(iijj))^2))/2);
        g_B=g_B+sqrt((((b(ii+1jj)-b(iijj))^2+(b(iijj+1)-b(iijj))^2))/2);

    end
end
fprintf(‘\n\n   highR的清晰度为:%.4f\n   highG的清晰度为:%.4f\n   highG的清晰度为:%.4f‘...
            g_R/(M-1)/(N-1)g_G/(M-1)/(N-1)g_B/(M-1)/(N-1));              
              
g_R=0;
g_G=0;
g_B=0;
              

for ii=1:M-1
    for jj=1:N-1
        g_R=g_R+sqrt((((r_low(ii+1jj)-r_low(iijj))^2+(r_low(iijj+1)-r_low(iijj))^2))/2);
        g_G=g_G+sqrt((((g_low(ii+1jj)-g_low(iijj))^2+(g_low(iijj+1)-g_low(iijj))^2))/2);
        g_B=g_B+sqrt((((b_low(ii+1jj)-b_low(iijj))^2+(b_low(iijj+1)-b_low(iijj))^2))/2);

    end
end
fprintf(‘\n\n   lowR的清晰度为:%.4f\n   lowG的清晰度为:%.4f\n   lowG的清晰度为:%.4f‘...
         g_R/(M-1)/(N-1)g_G/(M-1)/(N-1)g_B/(M-1)/(N-1));  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     196662  2015-11-27 14:40  medical_weight_average_fusion\011_CT_1.bmp

     文件     196662  2015-11-27 14:34  medical_weight_average_fusion\011_T2.bmp

     文件     196662  2015-12-01 18:32  medical_weight_average_fusion\030_Gad.bmp

     文件     196662  2015-12-01 22:13  medical_weight_average_fusion\030_Tl_7.bmp

     文件       3644  2015-12-12 11:59  medical_weight_average_fusion\add_weight_imagefusion.m

     文件     196662  2015-07-16 10:40  medical_weight_average_fusion\medA.bmp

     文件     196662  2015-07-16 10:40  medical_weight_average_fusion\medB.bmp

     目录          0  2015-12-17 15:30  medical_weight_average_fusion

----------- ---------  ---------- -----  ----

              1183616                    8


评论

共有 条评论