How can I plot a numpy array with dimensions (x, y, r, g, b) in one image in Python? Basically, I have to convert these three channels to one?
1 Answer
Install Pillow:
python -m pip install Pillow
Assuming your numpy array's shape is in fact (x, y, (r, g, b)) rather than the unlikely (x, y, r, g, b), and for the sake of the example is named arr, run in python:
import PIL.Image
im = PIL.Image.fromarray(arr)
im.save('out.png')
then plot your output image file with any usual means.