Stack Overflow Asked by Andrew Vo on February 14, 2021
I keep getting a TypeError: Invalid shape (825,) for image data when trying to display the image in grayscale.
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
plt.rcParams['figure.figsize'] = [16, 8]
A = mpimg.imread('image4.jpg')
X = np.mean(A, -1)
img = plt.imshow(X)
img.set_cmap('gray')
plt.axis('off')
plt.show()
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP