2. Histogram equalization

2. Histogram equalization2.1. Histogram equalization2.2 Actual effect display

2.1. Histogram equalization

Image spatial domain processing is an important image processing technology. This type of method is directly based on the pixel operation of the image and is mainly divided into two categories: grayscale transformation and spatial domain filtering. Histogram equalization is a commonly used grayscale transformation method. Usually, the components of the dark image histogram are concentrated at the lower grayscale end, while the components of the bright image histogram tend to the higher grayscale end.

If the grayscale histogram of an image almost covers the entire grayscale value range, and except for the number of individual grayscale values that are more prominent, the entire grayscale value distribution is approximately uniform, then this image has a larger grayscale dynamic range and higher contrast, and the image details are richer. It has been proved that relying solely on the histogram information of the input image, a transformation function can be obtained, and the input image can achieve the above effect using this transformation function. This process is histogram equalization.

The left side of the picture is the histogram, and the right side is the histogram equalization effect.

Histogram equalization is to stretch the original histogram so that it is evenly distributed in the entire grayscale range, thereby enhancing the contrast of the image.

The central idea of histogram equalization is to change the grayscale histogram of the original image from a relatively concentrated area to a uniform distribution in the entire grayscale range.

It aims to make the overall effect of the image uniform, and the points between each pixel level between black and white are more uniform.

Function: cv2.equalizeHist()

2.2 Actual effect display

Source code path:

/home/pi/DOGZILLA_Lite_class/4.Open Source CV/D.Image_Enhancement/02_Histogram_Equalization.ipynb