资源简介

用matlab实现图像融合,代码+图像,已运行通过。

资源截图

代码片段和文件信息


clear
g_R=0;                                        %r清晰度描述
g_G=0;                                        %g清晰度描述
g_B=0;                                        %b清晰度描述
h_R=0;                                        %熵的描述 
h_G=0;
h_B=0;
u1=zeros(31);
u2=zeros(31);
v11=zeros(31);               %高分辨率RGB值
v12=zeros(31);               %低分辨率RGB值
AA=zeros(33);
BB=zeros(33);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AA=[1/sqrt(3)1/sqrt(3)1/sqrt(3);       
    1/sqrt(6)1/sqrt(6)-2/sqrt(6);                    %RGB->IHS正变换矩阵
    1/sqrt(2)-1/sqrt(2)0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BB=[1/sqrt(3)1/sqrt(6)1/sqrt(2);
    1/sqrt(3)1/sqrt(6)-1/sqrt(2);                    %IHS->RGB逆变换矩阵
    1/sqrt(3)-2/sqrt(6)0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RGB_up=imread(‘high.jpg‘);         %读图像
RGB_low=imread(‘low.jpg‘);         
figure(1)
imshow(RGB_up);   
title(‘IHS-RGB表示的高分辨率图像‘);
figure(2)                              
imshow(RGB_low); 
title(‘IHS-RGB表示的低分辨率图像‘);

[MNcolor]=size(RGB_up);

R_up=RGB_up(::1);
G_up=RGB_up(::2);
B_up=RGB_up(::3);
[hangliecolor]=size(RGB_up);
for i=1:hang
    for j=1:lie
       v11(1)=double(RGB_up(ij1));             %把函数类型unit8为double型
       v11(2)=double(RGB_up(ij2));
       v11(3)=double(RGB_up(ij3));  
       v12(1)=double(RGB_low(ij1));            %把函数类型unit8为double型
       v12(2)=double(RGB_low(ij2));
       v12(3)=double(RGB_low(ij3)); 
       u1=AA*v11;                               %正变换
       u2=AA*v12;
       u2(1)=u1(1);                             %交换空间明度
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%空间信息明度定义????????
       v12=BB*u2;
       RGB(ij1)=v12(1);                       %逆变换
       RGB(ij2)=v12(2);
       RGB(ij3)=v12(3);   
   end
end
%subplot(235);
r=RGB(::1);
g=RGB(::2);
b=RGB(::3);
RGB=uint8(round(RGB)); 
figure(3)
imshow(RGB);
title(‘IHS-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   R的清晰度为:%.4f\n   G的清晰度为:%.4f\n   B的清晰度为:%.4f‘...
           g_R/(M-1)/(N-1)g_G/(M-1)/(N-1)g_B/(M-1)/(N-1));



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

     文件      17263  2011-03-30 16:43  图像融合\high.jpg

     文件       2888  2011-03-30 20:50  图像融合\IHS_use.asv

     文件       2859  2011-03-30 16:42  图像融合\IHS_use.m

     文件      12150  2011-03-30 16:43  图像融合\low.jpg

    ..A.SH.     12288  2011-11-10 20:32  图像融合\Thumbs.db

     目录          0  2012-02-21 15:37  图像融合

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

                47448                    6


评论

共有 条评论