将PIL Image转成opencv Image
#PIL Image转成opencv Image
#python-Version3.7.1
#
'''Packages&Version
numpy==1.15.3
opencv-python==3.4.2.16
opencv-contrib-python==3.4.2.16
Pillow-PIL==0.1.dev0
'''
from PIL import Image,ImageEnhance
import cv2
import numpy as np
img_split=cv2.imread('../test/j.jpg')#读取图片
contrast_enhancer = ImageEnhance.Contrast(img_split)
img_enhanced_image = contrast_enhancer.enhance(2)
enhanced_image = np.asarray(img_enhanced_image)
r, g, b = cv2.split(enhanced_image)
enhanced_image = cv2.merge([b, g, r])
ouputroots = '../test/'
out_path = ouputroots + image_name
print(enhanced_image) # 调亮为gam2,调暗为gam1
cv2.imwrite(out_path, enhanced_image)
print()