带有多个频谱的子图。Imshow()objec
我想用sp.imshow绘制多个高光谱图像。我知道这返回A R,G,B可视化。我有13个HSI文件(13个.hdr和13个.img文件)。我知道如何绘制和分析单个文件,但我希望在网格中概述所有样本。
我也知道以前创建无花果,轴。但是子图仍然令人困惑。 这就是我到目前为止的。
from pathlib import Path
import spectral as sp
import matplotlib.pyplot as plt
files_path = Path(r"C:\data\Reflectance_Calibrated")
hdr_list = list(files_path.glob('*.hdr'))
bin_list = list(files_path.glob('*.img'))
targets = list(zip(hdr_list,bin_list))
i = 0
## Here is where I tried doing a for loop, yet it did not work.
for k, target in enumerate(targets):
target_open = sp.envi.open(targets[i][0], targets[i][1])
sp.imshow(target_open)
i += 1
我正在寻找 sp.imshow(target_open).add_subplot(ax)
是否有人尝试过使用Spectral.imshow对象进行子图?
任何帮助将不胜感激。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一些选择可以实现您想要的东西。一种是使用
plt.subplot
选择每个网格单元格,然后当您调用sp.imshow
时,传递fignum
keyword。例如,要创建图像的NX1网格(即,一个带有单列的网格):另一个选项是使用
sp.get_rgb
来检索每个图像的RGB图像数据,然后使用plt.imshow
进行渲染而不是sp.imshow
。There are a few options to achieve what you want. One is to use
plt.subplot
to select each grid cell, then when you callsp.imshow
, pass thefignum
keyword. For example, to create an Nx1 grid of images (i.e., a grid with a single column):Another option is to use
sp.get_rgb
to retrieve the RGB image data for each image, then useplt.imshow
to do the rendering instead ofsp.imshow
.