matplotlib.pyplot.hist(
x, bins=10, range=None, normed=False,
weights=None, cumulative=False, bottom=None,
histtype=u'bar', align=u'mid', orientation=u'vertical',
rwidth=None, log=False, color=None, label=None, stacked=False,
hold=None, **kwargs)
x : (n,) array or sequence of (n,) arrays
这个参数是指定每个bin(箱子)分布的数据,对应x轴;可以是一个图像numpy,但要压缩到一维
numpy的ravel函数功能是将多维数组降为一维数组,还有一个flatten() 可以试一下,将任意数组按照行优先准则转换成一维数组
bins : integer or array_like, optional
这个参数指定bin(箱子)的个数,也就是总共有几条条状图,RGB彩色图像的话就是 256(0-255)