美文网首页
Opencv 图片的亮度

Opencv 图片的亮度

作者: 李飞_fd28 | 来源:发表于2020-02-29 16:38 被阅读0次

'''python
def detected_color_brightness(img):
# image = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
# stat = ImageStat.Stat(image)
# r, g, b = stat.mean
# brightness = math.sqrt(0.241 * (r ** 2) + 0.691 * (g ** 2) + 0.068 * (b ** 2))

yuv_img = cv2.cvtColor(img, cv2.COLOR_BGR2YUV)
y,u,v = cv2.split(yuv_img)
y_brightness = np.mean(y)
return y_brightness

'''

相关文章

网友评论

      本文标题:Opencv 图片的亮度

      本文链接:https://www.haomeiwen.com/subject/cfxmhhtx.html