[英]How to plot 2D numpy coordinate array with corresponding RGB array?
[英]How do I plot a numpy rgb array?
How can I plot a numpy array with dimensions (x, y, r, g, b) in one image in Python? 基本上,我必须将这三个通道转换为一个?
安装枕头:
python -m pip install Pillow
假设您的 numpy 阵列的形状实际上是 (x, y, (r, g, b)) 而不是不太可能的 (x, y, r, g, b),并且为了示例而命名为arr
,运行python:
import PIL.Image
im = PIL.Image.fromarray(arr)
im.save('out.png')
然后 plot 您的 output 图像文件使用任何常用方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.