March 2019
Intermediate to advanced
532 pages
13h 2m
English
Using the cv2.equalizeHist() function with the purpose of equalizing the contrast of a given grayscale image is pretty easy:
image = cv2.imread('lenna.png')gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)gray_image_eq = cv2.equalizeHist(gray_image)
In the grayscale_histogram_equalization.py script, we apply histogram equalization to three images. The first one is the original grayscale image. The second one is the original image but modified, in the sense that we have added 35 to every pixel of the image. The third one is the original image but modified, in the sense that we have subtracted 35 from every pixel of the image. We have also calculated histograms before and after the equalization of the histogram. ...