Opencv-python 直方图均衡化(亮度提升)

Opencv-python 直方图均衡化(亮度提升)

Opencv-python 直方图均衡化(亮度提升)_第1张图片

import cv2 as cv

original = cv.imread("./sunrise.jpg")
print(original.shape)
cv.imshow("original", original)

# 灰度图
gray = cv.cvtColor(original, cv.COLOR_BGR2GRAY)
cv.imshow("gray", gray)
gray_ = cv.equalizeHist(gray)
cv.imshow("gray_", gray_)

# YUV :亮度 色度 饱和度
yuv = cv.cvtColor(original, cv.COLOR_BGR2YUV)
yuv[..., 0] = cv.equalizeHist(yuv[..., 0])
equalized_color = cv.cvtColor(yuv, cv.COLOR_YUV2BGR)
cv.imshow("equalized_color", equalized_color)

cv.waitKey()

gray
Opencv-python 直方图均衡化(亮度提升)_第2张图片
gray_
Opencv-python 直方图均衡化(亮度提升)_第3张图片
equalized_color
Opencv-python 直方图均衡化(亮度提升)_第4张图片

你可能感兴趣的:(Opencv-python,python)