from scipy.misc import imread,imshow img = imread('D:test.bmp') print img[:,:,2].shape imshow()
注意img[:,:,2]的最后一个维度上的值最大为2,因为是RGB图像,最多是3个2维矩阵的叠加。
print img1[:, :, 3] 会产生 IndexError: index 3 is out of bounds for axis 2 with size 3