for k =1:bands1
for i =1:lines2
for j =1:samples2
Image3(i,j,k)=Image2(i,j,k)*Image1(i,j,k)/sum(Image1(i,j,:));
end
end
end
figure(1)subplot(1,3,1);imshow(uint8(Image1));title('高光譜影像');subplot(1,3,2);imshow(uint8(Image2));title('全色影像');subplot(1,3,3);imshow(uint8(Image3));title('Brovey變換融合後的影像');
2.乘積變換
for k =1:bands1
for i =1:lines2
for j =1:samples2
Image3(i,j,k)=Image1(i,j,k)*Image2(i,j,k);
end
end
end
Image3 =round((Image3 -min(Image3))*255./(max(Image3)-min(Image3)));figure(2)subplot(1,3,1);imshow(uint8(Image1));title('高光譜影像');subplot(1,3,2);imshow(uint8(Image2));title('全色影像');subplot(1,3,3);imshow(uint8(Image3));title('乘積變換融合後的影像');
3.PCA變換
AY =PCA(Image1);
A =cell2mat(AY(1));
Y =round(cell2mat(AY(2)));
YY =matching(Image2(:,:,1),reshape(Y(1,:),[lines1,samples1]));Y(1,:)=reshape(YY,[1,lines2*samples2]);
X =double(uint8(inv(A)* Y));for i =1:bands1
Image3(:,:,i)=reshape(X(i,:),[lines1,samples1]);
end
figure(3);subplot(1,3,1);imshow(uint8(Image1));title('高光譜影像');subplot(1,3,2);imshow(uint8(Image2));title('全色影像');subplot(1,3,3);imshow(uint8(Image3));title('PCA融合後的影像');
4.HSI變換
HSI =RGB2HSI(Image1);
max =max(max(HSI(:,:,3)));
min =min(min(HSI(:,:,3)));HSI(:,:,3)=round(HSI(:,:,3));
I =matching(Image2(:,:,1),HSI(:,:,3));% I =Image2(:,:,1);HSI(:,:,3)= I;
Image3 =HSI2RGB(HSI);figure(4)subplot(1,3,1);imshow(uint8(Image1));title('高光譜影像');subplot(1,3,2);imshow(uint8(Image2));title('全色影像');subplot(1,3,3);imshow(uint8(Image3));title('HSI變換融合後的影像');