📅  最后修改于: 2022-03-11 14:47:08.402000             🧑  作者: Mango
import cv2
import numpy as np
from matplotlib import pyplot as plt
file0 = 'image.jpg'
img = cv2.imread(file0)
color = ('b','g','r')
plt.figure()
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()