1

我正在尝试使用 imread() 为 1400x1400 bmp 图片获取这些颜色。当我打印 imread 结果时,我得到一个包含 1400x1400 数字的整数数组。不应该有 5 个数字对应于 RGBAX,如下所示: http ://en.wikipedia.org/wiki/BMP_file_format

import numpy as np
from scipy.misc import imread
from scipy import *
tally=0
#Read in the image
img = imread('M10.bmp',flatten=False)
print len(img[0])  #elements of first array element
print len(img)     #elements of array
print img,         #see what the array looks like
for line in img:
    for ch in line:
        print ch

print tally       #amount of numbers
print len(img[0])*len(img)   #amount of spaces in arrays (to check)
4

0 回答 0