def adjust_contrast(image, contrast):
if (contrast < 0):
contrast = 0
elif (contrast > 200):
contrast = 200
contrast = contrast / 100
img = image.astype(np.float) * contrast
img[img > 255] = 255
img[img < 0] = 0
return img.astype(np.ubyte)
评论列表
文章目录