自定义函数:

function BF=Brovey_fuse(Hyperspectral_image,High_resolution_image)
x0=imread(Hyperspectral_image); %高光谱影像
[a,b,c]=size(x0);
x=double(x0)/255; 
y=imread(High_resolution_image); %高分辨率灰度影像
y1=double(y)/255;     
xx=zeros(a,b,c);
p=zeros(a,b,c);
for f=1:a
    for e=1:b
        xx(f,e)=x(f,e,1)+x(f,e,2)+x(f,e,3);   
        p(f,e,1)=x(f,e,1)*y1(f,e)/xx(f,e);
        p(f,e,2)=x(f,e,2)*y1(f,e)/xx(f,e);
        p(f,e,3)=x(f,e,3)*y1(f,e)/xx(f,e);
    end
end
BF=uint8(round(p*255));
%imshow(BF);

在命令行中输入:

>> a=Brovey_fuse('f1.jpg','f2.bmp');
>> imshow(a)

 

f1.jpg

 

f2.bmp

融合结果: