How to fast change image brightness with python + OpenCV?

前端 未结 12 904
感动是毒
感动是毒 2020-12-05 10:42

I have a sequence of images. I need to average brightness of these images.

First example (very slow):

img = cv2.imread(\'test.jpg\')         


        
12条回答
  •  悲&欢浪女
    2020-12-05 11:28

    def change_brightness(img, alpha, beta):
       return cv2.addWeighted(img, alpha, np.zeros(img.shape, img.dtype),0, beta)
    

    Here alpha & beta are input parameters. Each pixel of the input image will change according to this formula.

     alpha(pixel_value) + beta.
    

    Lower value of alpha like 2 or 3 is good

提交回复
热议问题