Python opencv光照影响

import numpy as np
import argparse
import cv2
# 加载图像
image = cv2.imread('jobs.jpg')
(B, G, R) = cv2.split(image)
imageBlueChannelAvg = np.mean(B)
imageGreenChannelAvg = np.mean(G)
imageRedChannelAvg = np.mean(R)
K = (imageRedChannelAvg+imageGreenChannelAvg+imageRedChannelAvg)/3;
Kb = K/imageBlueChannelAvg;
Kg = K/imageGreenChannelAvg;
Kr = K/imageRedChannelAvg
B = cv2.addWeighted(B, Kb, 0, 0, 0)
G = cv2.addWeighted(G, Kg, 0, 0, 0)
R = cv2.addWeighted(R, Kr, 0, 0, 0)
image_new = cv2.merge([B, G, R])
cv2.imshow("src", image)
cv2.imshow("des", image_new)
cv2.waitKey(0)

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页