Home > other >  How to solve the python TypeError: Expected Ptr<CV: : UMat> For argument & # x27; % s & # x27;
How to solve the python TypeError: Expected Ptr<CV: : UMat> For argument & # x27; % s & # x27;

Time:11-28

The class vide (object) :
Def video (self, img) :
Img1=np. Asarray (img, dtype='float64')
Print (" the dimension of the array, "img1. Shape)
Print (img1)
Img3=img1. Astype (np) uint8)
Print (img3. Dtype. Name)
Img2=Image. Fromarray (np) uint8 (img3))

Gray=cv2. CvtColor (img2, cv2 COLOR_BGR2GRAY)
Ret, thresh=cv2. Threshold (gray, 130, 255, 0)
Thresh. The show ()
# assignment operation: custom name=class name (properties 1, 2)
# self. Name=class name (the name, type) # note does not need the self
# the self. The name. The name of the class defined ()
Img1=cv2. Imread (" img \ \ 3. JPG ")
WWW=vide ()
www.video (img1)


File "C:/Users/ZTL/Desktop/pycharm/jia py", line 111, in video
Gray=cv2. CvtColor (img2, cv2 COLOR_BGR2GRAY)
TypeError: Expected Ptr For argument '% s'

Excuse me, how to solve the above error
  • Related