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 :
- OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV
- Implementation of KNN using OpenCV
- OpenCV - Overview
- Introduction to OpenCV
- Background subtraction - OpenCV
- OpenCV | Displaying an Image
- OpenCV | Loading Video
- OpenCV | Saving an Image
- Python OpenCV: Meanshift
- OpenCV Python Tutorial
- Saving a Video using OpenCV
- Image Inpainting using OpenCV
- Filter Color with OpenCV
- Gun Detection using Python-OpenCV
- Set up Opencv with anaconda environment
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.