遍历高光谱图像中的行

我有显示高光谱图像(立方体)的代码。

我必须图像: 图像1:具有N行和N列的高光谱图像。 图片2:只有一张行,但列数与图片1相同的高光谱图片。

我想创建迭代: 对于图像1中的每一行,我想减去  图片2中的值。 因此,例如,如果在第一列中,图像1的值为10,而图像2的值为4,则新图像的像素值为6。

问题是我不知道如何遍历图像中的行。

这是我到目前为止尝试过的:

import spectral.io.envi as envi
import matplotlib.pyplot as plt
import os
from spectral import *
import numpy as np

#Create the image path
#the path 
img_path = r'N:\this\is\path\emptyname_2019-08-13_11-05-46\capture'
cali_path=r'N:\more\path'

#the specific file 
img_file = 'emptyname_2019-08-13_11-05-46.hdr'
img_dark= 'DARKREF_emptyname_2019-08-13_11-05-46.hdr'
cali_hdr= 'Radiometric_1x1.hdr'
cali_img = 'Radiometric_1x1.cal'

#load the images
img= envi.open(os.path.join(img_path,img_file)).load()
img_dark= envi.open(os.path.join(img_path,img_dark)).load()
img_cali= envi.open(os.path.join(cali_path,cali_hdr),image = os.path.join(cali_path,cali_img)).load()

wavelength=[float(i) for i in img.metadata['wavelength']]

#here I have created image 2- the image with the 1 row 
dark_1024=img_dark.mean(axis=0)


#bad attempt  to iterate through each row.
for index,row in img.iterrows():
    img-img_dark

  

AttributeError:“ ImageArray”对象没有属性“ iterrows”

有什么主意,我如何只“抓住”行并使用新值创建新图像?

wlst34 回答:遍历高光谱图像中的行

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3123682.html

大家都在问