Histogram Equalization OpenCV

In this OpenCV Tutorial, you’ll learn how to perform histogram equalization in OpenCV Python. Histogram equalization is used in image processing for contrast adjustment. I highly recommend you get the “Computer Vision: Models, Learning, and Inference Book” to learn computer vision. In the following example, I will use this image.

# import OpenCV module
import cv2

# Read the image
img = cv2.imread('C:\\AiHints\\car.jpg')

# Convert the image to grayscale
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# Apply histogram equalization on the grayscale image
hist = cv2.equalizeHist(gray_img)

# Display the image
cv2.imshow('Final Image', hist)

# Wait until a key is pressed

# Destroy all windows


Histogram Equalization

Leave a Comment

Your email address will not be published.