[Digital image processing matlab] (Brovey transform fusion algorithm)

[Digital image processing matlab] (Brovey transform fusion algorithm)

Input a high-resolution panchromatic image HighResult, a low-resolution multispectral image Multispectral, use the Brovey algorithm to achieve image fusion, and multispectral resampling uses the nearest neighbor interpolation algorithm of the imresize() function .

function F=Broveymelt(HighResultion,Multispectral)
%调用代码-------------------------------------------------
%Image1=imread('HR.jpg');Image2=imread('MS.jpg');
%%Image1为高分辨率,Image2为多光谱
%Broveymelt(Image1,Image2);
%------------------------------------------------------

subplot(1,3,1),imshow(HighResultion);
title('原高分辨率图');
subplot(1,3,2),imshow(Multispectral);
title('原低分辨率图');
HighResultion=im2double(HighResultion);
Multispectral=im2double(Multispectral);
[row,column,bands]=size(HighResultion);   %求高分辨率的size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % B = imresize(A,[nrows ncols],method)
  %method的几种可选值:
          %'nearest'最近邻插值(默认值)
          % 'bilinear'双线性插值
          % 'bicubic'双三次插值
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
r=Multispectral(:,:,1);   R=imresize(r,[row,column]);
g=Multispectral(:,:,2);   G=imresize(g,[row,column]);
b=Multispectral(:,:,3);   B=imresize(b,[row,column]);

Xr=zeros(row,column);Xg=zeros(row,column);Xb=zeros(row,column);
for i=1:row
    for j=1:column
        sum=R(i,j)+G(i,j)+B(i,j);
        Xr(i,j)=HighResultion(i,j)*R(i,j)/sum;
        Xg(i,j)=HighResultion(i,j)*G(i,j)/sum;
        Xb(i,j)=HighResultion(i,j)*B(i,j)/sum;
    end
end

X=cat(3,Xr,Xg,Xb);
subplot(1,3,3),imshow(X);
title('Brovey变换融合后的图像');

end

test:
insert image description here

Guess you like

Origin blog.csdn.net/gsgs1234/article/details/124144109