I'm trying to import an Image and draw a square, like that:
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os
relpath='C:/Users/mydesktop/trainedModels/CKcollect/1/'
img=image.load_img(relpath+'S010_004_00000014.png')
plt.imshow(img)
img = cv2.rectangle(img,(384,0),(510,128),(0,255,0),3)
plt.imshow(img)
and I get this error message:
img = cv2.rectangle(img,(384,0),(510,128),(0,255,0),3)
TypeError: Expected Ptr<cv::UMat> for argument 'img'
Use cv2.imread(PATH)
instead of image.load_img(PATH)
if it still doesn't work make sure to use the full path to the image