import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('./image/dog.png')
histb = cv2.calcHist([img],[0],None,[256],[0,255])
histg = cv2.calcHist([img],[1],None,[256],[0,255])
histr = cv2.calcHist([img],[2],None,[256],[0,255])
plt.plot(histb, color='b',label='blue')
plt.plot(histg, color='g',label='green')
plt.plot(histr, color='r',label='red')
plt.legend()
plt.show()