如何从面部opencv消除眩光

时间:2018-06-22 08:31:24

标签: python-3.x opencv

我正在尝试使用opencv对图像进行后期处理。这是输入enter image description here

我添加了以下脚本that i found here以实现后代效果:

[x] Convert build output

这是我通过设置import numpy as np import cv2 im = cv2.imread('messi5.jpg') n = 2 # Number of levels of quantization indices = np.arange(0,256) # List of all colors divider = np.linspace(0,255,n+1)[1] # we get a divider quantiz = np.int0(np.linspace(0,255,n)) # we get quantization colors color_levels = np.clip(np.int0(indices/divider),0,n-1) # color levels 0,1,2.. palette = quantiz[color_levels] # Creating the palette im2 = palette[im] # Applying palette on image im2 = cv2.convertScaleAbs(im2) # Converting image back to uint8 cv2.imshow('im2',im2) cv2.waitKey(0) cv2.destroyAllWindows() 得到的输出,它接近我的期望输出

enter image description here

但是,原始图像上的眩光会影响最终的输出(我需要一个具有几乎相同颜色的面部的输出)。如何从原始输入中消除眩光

0 个答案:

没有答案