def change_brightness(image, brightness=1.0):
"""
Change brightness of image.
>>> image = np.eye(3, dtype='uint8') * 255
>>> change_brightness(image, 0.5)
array([[127, 0, 0],
[ 0, 127, 0],
[ 0, 0, 127]], dtype=uint8)
See
http://pillow.readthedocs.io/en/3.1.x/reference/ImageEnhance.html#PIL.ImageEnhance.Brightness
:param numpy array image: Numpy array with range [0,255] and dtype 'uint8'.
:param float brightness: Brightness [0, 1]
:return: Image with changed brightness
:rtype: numpy array with range [0,255] and dtype 'uint8'
"""
return enhance(image, ie.Brightness, brightness)
评论列表
文章目录