我想创建图像的直方图。我试过这些代码:
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('bin_003.png')
color = ('b','g','r')
for i,col in enumerate(color):
histr = cv2.calcHist([img],[i],None,[256],[0,256])
plt.plot(histr,color = col)
plt.xlim([0,256])
plt.show()