import cv2
import numpy as np
img = 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)
左为原图 右为增强效果图
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)