I have three (241, 241) numpy arrays which I would like to treat as the Red, Green and Blue components of an image.
I have tried this:
import numpy as np
from PIL import Image
arr = np.zeros((len(x), len(z), 3))
arr[:,:,0] = red_arr
arr[:,:,1] = green_arr
arr[:,:,2] = blue_arr
img = Image.fromarray(arr, 'RGB')
img.show()
But the resulting image just looks like noise:
Can anyone tell me what I am doing wrong please?
As an example, my red_arr is an array of floats that looks like this:
解决方案
In your comment you specify that the red_arr, etc. are arrays of the range -4000 to 4000.
But if we take a look at the specifications of the Image.from_array modes, then