• 大小: 85KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: Matlab
  • 标签: 图像融合  

资源简介

PCA和IHS图像融合的matlab源代码,学习这方面的试试吧

资源截图

代码片段和文件信息

clear
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‘);

figure(1)
imshow(up);                                     %读RGB数值

[MNcolor]=size(up);

title(‘加权-RGB表示的高分辨率图像‘);

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));              
              
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(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   resultR的清晰度为:%.4f\n   resultG的清晰度为:%.4f\n   resultG的清晰度为:%.4f‘...
        g_R/(M-1)/(N-1)g_G/(M-1)/(N-1)g_B/(M-1)/(N-1));





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

     文件       2627  2012-04-23 15:49  PCA和IHS图像融合\add_image_use.m

     文件      17263  2004-06-13 15:46  PCA和IHS图像融合\high.jpg

     文件       2870  2012-04-23 15:45  PCA和IHS图像融合\IHS_use.m

     文件      20091  2004-06-14 20:04  PCA和IHS图像融合\IHS融合.JPG

     文件      12150  2004-06-13 15:47  PCA和IHS图像融合\low.jpg

     文件       5678  2012-04-23 15:46  PCA和IHS图像融合\PCA_Fusio_use.m

     文件      19390  2004-06-14 20:06  PCA和IHS图像融合\PCA融合.JPG

     文件      15238  2004-06-14 20:00  PCA和IHS图像融合\加权融合.JPG

     目录          0  2012-07-24 09:07  PCA和IHS图像融合

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

                95307                    9


评论

共有 条评论