Prerequisite : Analyze-image-using-histogram
Histogram equalization is a method in image processing of contrast adjustment using the image’s histogram.
This method usually increases the global contrast of many images, especially when the usable data of the image is represented by close contrast values. Through this adjustment, the intensities can be better distributed on the histogram. This allows for areas of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values. The method is useful in images with backgrounds and foregrounds that are both bright or both dark.
OpenCV has a function to do this, cv2.equalizeHist(). Its input is just grayscale image and output is our histogram equalized image.
Input Image :
Below is Python3 code implementing Histogram Equalization :
- Image Inpainting using OpenCV
- Filter Color with OpenCV
- OpenCV: Segmentation using Thresholding
- Set up Opencv with anaconda environment
- Draw a triangle with centroid using OpenCV
- Python | Smile detection using OpenCV
- Image Processing without OpenCV | Python
- Image Translation using OpenCV | Python
- Image Pyramid using OpenCV | Python
- Reading an image in OpenCV using Python
- Python | Play a video using OpenCV
- Python | Grayscaling of Images using OpenCV
- Python OpenCV | cv2.imread() method
- Python OpenCV | cv2.imshow() method
- Python OpenCV | cv2.imwrite() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.