DEV Community

es404020
es404020

Posted on • Updated on

Histogram Equalization for Color Images or Color enhancement using OpenCV

In this tutorial we would try to enhancement this image below to how a brighter and well coloured image using equalizeHist

img = cv2.imread('parrot.jpg', cv2.IMREAD_COLOR)
plt.imshow(img[:,:,::-1])

img_convert = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)

img_convert[:,:,2] = cv2.equalizeHist(img_convert[:,:,2])

img_bgr= cv2.cvtColor(img_convert,cv2.COLOR_HSV2BGR)

plt.figure(figsize=[50,50])
plt.subplot(141);plt.imshow(img[:,:,::-1]);plt.title('Original')
plt.subplot(142);plt.imshow(img_bgr[:,:,::-1]);plt.title('equalize')
Enter fullscreen mode Exit fullscreen mode

oklo

Top comments (0)