import cv2
cap = cv2.VideoCapture(0)
while (1):
ret,frame = cap.read()
cv2.imshow('opencvCut',frame)
if cv2.waitKey(100)== ord('q'):
break
cap.release()
cv2.destroyAllWindows()
debug启动
import cv2
cap = cv2.VideoCapture(0)
while (1):
ret,frame = cap.read()
cv2.imshow('opencvCut',frame)
if cv2.waitKey(100)== ord('q'):
break
cap.release()
cv2.destroyAllWindows()
debug启动
cv2.imshow("img", frame)在此行代码后添加下面的代码即可
k = cv2.waitKey(1)