【无标题】python之cv2.VideoCapture()用电脑自带摄像头捕获画面失败ret一直返回False解决方案。
importcv2importnumpyasnpcap=cv2.VideoCapture(0)while(1):ret,frame=cap.read()gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)cv2.imshow('frame',gray)press_key=cv2.waitKey(1)ifpress_key==27:breakcap.release(