如何生成高光谱图像某一点像素值的反射光谱图
在做高光谱图像超分辨率对比实验的时候需要画光谱反射折线图,在网上找了好久也不知道怎么画。
然后我再外网找到了用MATLAB画的方法,亲测可用!
reflectance = squeeze(img(i, j,:));
reflectance = reflectance/max(reflectance(:));
plot(reflectance)
我自己又稍微修改了一下,方便多个模型进行对比,仅供参考 :
clc
clear
close all
fig_path='/pics/reflectance/cave';
%图片路径
cd (fig_path);
file=dir('*.mat');
fig_num=length(file);
i = 10;
j = 70;
%i,j代表像素点的位置
for i=1:fig_num
oldname=file(1).name;%原文件名
[filepath,name,ext] = fileparts(oldname);%原文件名拆解
img=load(strcat(fig_path,'/',name));
name=img.pred;%重建的图片
reflectance = squeeze(name(i, j,:));
reflectance = reflectance/max(reflectance(:));
plot(reflectance);
hold on;
end