2021年5月7日星期五

Importing an image and drawing a square on it

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'  
https://stackoverflow.com/questions/67434155/importing-an-image-and-drawing-a-square-on-it May 07, 2021 at 07:28PM

没有评论:

发表评论