Python读取图片,并保存为矩阵

 

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

posted @ 2015-12-08 16:04  视觉书虫  阅读(3675)  评论(0编辑  收藏  举报