让我们考虑下面的代码:-which读取图像,应用直方图均衡化程序,并同时显示结果:
import cv2
import numpy as np
img = cv2.imread('original.png', cv2.IMREAD_GRAYSCALE)
assert img is not None, "file could not be read, check with os.path.exists()"
equ = cv2.equalizeHist(img)
res = np.hstack((img,equ)) #stacking images side-by