【发布时间】:2021-12-24 04:12:13
【问题描述】:
我有一个温度值数组 (320x240),我希望它转换为我指定的 rgb 值,例如:
blueRGBValue = (0,0,128)
temperatureArray =(24.532, 24.213, 24.1234, ...)
for i in range(len(temperatureArray)):
if (temperatureArray[i] > 25 and temperatureArray[i]<=30):
imageArray.append(blueRGBValue)
...
对所有温度数组都像这样,但我不能将 rgb 代码作为元组分配给 imageArray。我怎样才能做到这一点? 我的 imageArray 应该首先作为 numpy.zeros 启动为 ndarray
感谢您的建议。
【问题讨论】:
-
我假设您的数组是 320x240 并且在每个位置都包含一个浮点值。请使用
np.savetxt()保存。我想你有一些可以将温度映射到颜色的东西。请彻底澄清。那么请分享所有这些信息——您可能需要使用 Dropbox 或 Google Drive。谢谢。
标签: python arrays numpy opencv