#灰度图像直方图均衡化
import cv2
img = cv2.imread('ruonan.jpg',1)
gray = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
cv2.imshow('src',gray)
result = cv2.equalizeHist(gray)
cv2.imshow('dst',result)
cv2.waitKey(0)
#灰度图像直方图均衡化
#1分割通道       2 均衡化   3通道合成
import cv2
img = cv2.imread('ruonan.jpg',1)
cv2.imshow('src',img)
(b,g,r) = cv2.split(img)
bh = cv2.equalizeHist(b)
gh = cv2.equalizeHist(g)
rh = cv2.equalizeHist(r)
result = cv2.merge(bh,gh,rh)
cv2.imshow('dst',result)
cv2.waitKey(0)