I have a list of numpy arrays that are RGB values of 3 images, as below:
array([[ 38, 45, 48],
[ 38, 45, 48],
[ 38, 45, 48],
...,
[134, 125, 101],
[134, 125, 101],
[134, 125, 101]], dtype=uint8)
This has been generated with the code as shown below:
r, c, l = img_array.shape
img_disp = np.reshape(image, (r, c, l), order="C")
arr = img_disp.astype(dtype='uint8')
img = np.asarray(Image.fromarray(arr, 'RGB'))
img_to_display = np.vstack(img)
I'm trying to plot these images in a jupyter notebook.
Using plt.figure() and imshow() as suggested in other posts gives the following error.
for ima in images:
plt.figure()
plt.imshow(ima)
Error:
TypeError: Invalid shape (3,) for image data
May be a small thing, but I'm not able to get this around. The shape of my list is (255440, 3).
Appreciate any help!
question from:
https://stackoverflow.com/questions/65903833/plot-list-of-images-with-rgb-values-in-numpy-arrays 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…