import cv2 import numpy as np from matplotlib import pyplot as plt
file_name = ‘Fig0316(4)(bottom_left).tif’ I = cv2.imread(file_name, cv2.IMREAD_GRAYSCALE) J = cv2.equalizeHist(I)
plt.subplot(2,2,1), plt.imshow(I, cmap=‘gray’) plt.title(‘Original Image’) plt.subplot(2,2,2), plt.hist(I.ravel(),256,[0,256]) plt.title(‘Original Image hist’) plt.subplot(2,2,3), plt.imshow(J, cmap=‘gray’) plt.title(‘The image of using histeq’) plt.subplot(2,2,4), plt.hist(J.ravel(),256,[0,256]) plt.title(‘The hist of using histeq’)
plt.show()