I am trying to run the code in this answer to make an image brighter.
The code in question is:
import cv2
import numpy as np
# as people point out in comments, cv2.read() from the original
# code no longer works
image = cv2.imread('image.png')
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
value = 42 #whatever value you want to add
cv2.add(hsv[:,:,2], value, hsv[:,:,2])
image = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)
cv2.imwrite('out.png', image)
On the line cv2.add(hsv[:,:,2], value, hsv[:,:,2])
I get the following error
TypeError: Expected Ptr<cv::UMat> for argument 'dst'
This happens with any input image I've tried and someone else posted the same issue as a comment to that answer. How can this be fixed?
EDIT: as people have pointed out you won't be able to run cv2.read
above. You'll ne