• 大小: 58.08M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-07-12
  • 语言: 其他
  • 标签: 其他  

资源简介

融合.zip

资源截图

代码片段和文件信息

clear
I1=imread(‘C:\Users\攀攀\Desktop\融合\spot.bmp‘);
I2=imread(‘C:\Users\攀攀\Desktop\融合\tm_743.bmp‘);

I1=double(I1);
I2=double(I2);
mI1=mean2(I1);
I2r=I2(::1);
I2g=I2(::2);
I2b=I2(::3);
mI2r=mean2(I2r);
mI2g=mean2(I2g);
mI2b=mean2(I2b);

%加权融合
r_r=sum(sum((I1-mI1).*(I2r-mI2r)))/(sqrt(sum(sum((I1-mI1).^2))*sum(sum((I2r-mI2r).^2))));
r_g=sum(sum((I1-mI1).*(I2g-mI2g)))/(sqrt(sum(sum((I1-mI1).^2))*sum(sum((I2g-mI2g).^2))));
r_b=sum(sum((I1-mI1).*(I2b-mI2b)))/(sqrt(sum(sum((I1-mI1).^2))*sum(sum((I2b-mI2b).^2))));
RHr=((1+abs(r_r)).*I1+(1-abs(r_r)).*I2r)/2;
RHg=((1+abs(r_g)).*I1+(1-abs(r_g)).*I2g)/2;
RHb=((1+abs(r_b)).*I1+(1-abs(r_b)).*I2b)/2;
RH1=cat(3RHrRHgRHb);%融合成三维
RH1=uint8(RH1);

%比值变换
B1=I2r;
B2=I2g;
B3=I2b;
D=I1;
DB1=(B1./(B1+B2+B3)).*D;
DB2=(B2./(B1+B2+B3)).*D;
DB3=(B3./(B1+B2+B3)).*D;
RH2=cat(3DB1DB2DB3);
RH2=uint8(RH2);

%乘积变换
db1=D.*B1/mI1;
db2=D.*B2/mI1;
db3=D.*B3/mI1;
RH3=cat(3db1db2db3);
RH3=uint8(RH3);

%融合后图像显示
subplot(131);imshow(RH1);title(‘加权融合后图像‘);
subplot(132);imshow(RH2);title(‘比值变换后图像‘);
subplot(133);imshow(RH3);title(‘乘积变换后图像‘);

%融合效果评价
RH1=double(RH1);
RH2=double(RH2);
RH3=double(RH3);
hdr = mI2r;
hdg = mI2g;
hdb = mI2b;  %原始多光谱影像
hd1r = mean2(RH1(::1));
hd1g = mean2(RH1(::2));
hd1b = mean2(RH1(::3));   %加权融合后
hd2r = mean2(RH2(::1));
hd2g = mean2(RH2(::2));
hd2b = mean2(RH2(::3));    %比值变换后
hd3r = mean2(RH3(::1));
hd3g = mean2(RH3(::2));
hd3b = mean2(RH3(::3));    %乘积变换后
%相关系数
r1R = sum(sum((I2r - hdr).*(RH1(::1) - hd1r))) / sqrt((sum(sum((I2r - hdr).*(I2r - hdr)))) * (sum(sum((RH1(::1) - hd1r).*(RH1(::1) - hd1r)))));
r1G = sum(sum((I2g - hdg).*(RH1(::2) - hd1g))) / sqrt((sum(sum((I2g - hdg).*(I2g - hdg)))) * (sum(sum((RH1(::2) - hd1g).*(RH1(::2) - hd1g)))));
r1B = sum(sum((I2b - hdb).*(RH1(::3) - hd1b))) / sqrt((sum(sum((I2b - hdb).*(I2b - hdb)))) * (sum(sum((RH1(::3) - hd1b).*(RH1(::3) - hd1b)))));
r2R = sum(sum((I2r - hdr).*(RH2(::1) - hd2r))) / sqrt((sum(sum((I2r - hdr).*(I2r - hdr)))) * (sum(sum((RH2(::1) - hd2r).*(RH2(::1) - hd2r)))));
r2G = sum(sum((I2g - hdg).*(RH2(::2) - hd2g))) / sqrt((sum(sum((I2g - hdg).*(I2g - hdg)))) * (sum(sum((RH2(::2) - hd2g).*(RH2(::2) - hd2g)))));
r2B = sum(sum((I2b - hdb).*(RH2(::3) - hd2b))) / sqrt((sum(sum((I2b - hdb).*(I2b - hdb)))) * (sum(sum((RH2(::3) - hd2b).*(RH2(::3) - hd2b)))));
r3R = sum(sum((I2r - hdr).*(RH3(::1) - hd3r))) / sqrt((sum(sum((I2r - hdr).*(I2r - hdr)))) * (sum(sum((RH3(::1) - hd3r).*(RH3(::1) - hd3r)))));
r3G = sum(sum((I2g - hdg).*(RH3(::2) - hd3g))) / sqrt((sum(sum((I2g - hdg).*(I2g - hdg)))) * (sum(sum((RH3(::2) - hd3g).*(RH3(::2) - hd3g)))));
r3B = sum(sum((I2b - hdb).*(RH3(::3) - hd3b))) / sqrt((sum(sum((I2b - hdb).*(I2b - hdb)))) * (sum(sum((RH3(::3) - hd3b).*(RH3(::3) - hd3b)))));

%均值偏差:
b1R = abs(hdr - hd1r) / hd1r;
b1G = abs(hdg - hd1g) / hd1g;
b1B = abs(hdb - hd1b) / hd1b;
b2R = abs(hdr

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3966  2015-10-29 13:57  融合\Fusion.m
     文件      187904  2015-10-29 14:54  融合\Thumbs.db
     文件    17241982  2015-10-21 20:01  融合\spot.bmp
     文件    51689158  2015-10-22 15:03  融合\tm_743.bmp
     文件         305  2015-10-29 16:49  融合\融合精度.txt
     目录           0  2015-10-29 13:58  融合\

评论

共有 条评论