python怎么解决 TypeError: Expected Ptr for argument '%s' 问题

class vide(object):

def video(self,img):
    img1 = np.asarray(img, dtype='float64')
    print("数组的维度", 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.show()

** 出现运行错误

gray = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
TypeError: Expected Ptrcv::UMat for argument '%s' **

请问怎么解决上述问题**

**图片说明

https://blog.csdn.net/qq_36501182/article/details/89058305