import cv2import numpy as npimg = cv2.imread("C:\\Users\\dwx\\Desktop\\00312.jpg", 1)imgYUV = cv2.cvtColor(img, cv2.COLOR_BGR2YCrCb)channelsYUV = cv2.split(imgYUV)t = channelsYUV[0]# 限制对比度的自适应阈值均衡化clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))p= clahe.apply(t)channels = cv2.merge([p,channelsYUV[1],channelsYUV[2]])result = cv2.cvtColor(channels, cv2.COLOR_YCrCb2BGR)cv2.imshow("dst", result)cv2.imwrite("C:\\Users\\dwx\\Desktop\\a_6.jpg",result)#图像保存位置cv2.waitKey(0)
左为原图右为增强效果图
如果觉得《彩色图像增强(限制对比度直方图阈值均衡化)Python Win10》对你有帮助,请点赞、收藏,并留下你的观点哦!