'try to make some Arithmetic Operations to enhance images
I am trying to make some image enhancement using opencv here's my code:
def enhancement(img):
matrix=np.ones((224,224),dtype='uint8')*50
img1=cv2.add(img,matrix)
img2=cv2.subtract(img,matrix)
return img1,img2
so whenever i try to enhance my image like this
img=cv2.imread(imgpath)
img=cv2.resize(img,(224,224))
img1,img2=enhancement(img)
it gives me this error
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
So can anyone help me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
