直接用matplotlib画出直方图 def plot_demo(image): plt.hist(image.ravel(), 256, [0, 256]) # image.ravel()将图像展开,256为bins数量,[0, 256]为范围 plt.show() 图像直方图 def image_hist(image): color = ('blue', 'green', 'red') for i, color in enumerate(color): # 计算出直方图,calcHist(i…