I've just begun using the OpenCV library for Python and came across something I didn't understand.
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read() #returns ret and the frame
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
When I use cv2.waitKey(1)
, I get a continuous live video feed from my laptops webcam. However when I use cv2.waitKey(0)
, I get still images. Every time I close the window, another one pops up with another picture taken at the time.
Why does it not show as a continuous feed?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…