问题:TypeError: Expected cv::UMat for argument ‘img’
代码:
cap = cv2.VideoCapture(0)
cap.set(3, 640)
cap.set(4, 480)
img = cap.read()
cv2.imshow('img', img)
报错:TypeError: Expected cv::UMat for argument ‘img’
解决:更改 img = cap.read() 为 ret, img = cap.read()
正确代码:
cap = cv2.VideoCapture(0)
cap.set(3, 640)
cap.set(4, 480)
ret, img = cap.read()
cv2.imshow('img', img)
对大家有帮助的话回来点个赞呗