When I do np.asarray(my_img) or array(my_img).shape it returns (2412L, 3600L, 3L) on a jpg image,but I just want a 2D (2412L, 3600L) array, so how to convert it correctly? Thanks in advance.
my_image = "AI.jpg"
from matplotlib.pyplot import imread
from PIL import Image
fname = "images/" + my_image
image = Image.open(fname)
print(image.size) # output: (3600, 2412)
print(np.asarray(image).shape) # output: (2412L, 3600L, 3L)
print(np.array(image).shape) # output: (2412L, 3600L, 3L)