I have a sequence of images. I need to average brightness of these images.
First example (very slow):
img = cv2.imread(\'test.jpg\')
Hope this is useful for someone
@Divakar answer Python, OpenCV: Increasing image brightness without overflowing UINT8 array
mImage = cv2.imread('image1.jpg')
hsvImg = cv2.cvtColor(mImage,cv2.COLOR_BGR2HSV)
value = 0
vValue = hsvImg[...,2]
hsvImg[...,2] = np.where((255-vValue)
To decrease the brightness
mImage = cv2.imread('image1.jpg')
hsvImg = cv2.cvtColor(mImage,cv2.COLOR_BGR2HSV)
# decreasing the V channel by a factor from the original
hsvImg[...,2] = hsvImg[...,2]*0.6
plt.subplot(111), plt.imshow(cv2.cvtColor(hsvImg,cv2.COLOR_HSV2RGB))
plt.title('brightened image'), plt.xticks([]), plt.yticks([])
plt.show()