I am trying to apply threshold to an image, but I get the following error :
TypeError: 'unknown' is not a numpy array
I get this error on the cv2.imshow() line.
Here is my code :
import cv2
import numpy as np
img = cv2.imread('...',0)
img2 = cv2.imread('...',0)
fImg = cv2.addWeighted(img.astype(np.float32), 0.9, img2.astype(np.float32), 0.1, -20.0)
th = cv2.threshold(fImg, 127, 255, cv2.TRESH_BINARY)
cv2.imshow('th', th)
cv2.waitKey(0)
cv2.destroyAllWindows
Thanks in advance for your help !