Get most recent frame from webcam

后端 未结 2 1676
时光说笑
时光说笑 2021-02-20 11:12

I am using OpenCV2 to take some timelapse photos with a webcam. I want to extract the most recent view seen by the webcam. I try to accomplish this like so.

impo         


        
2条回答
  •  孤街浪徒
    2021-02-20 11:38

    I have read that in the VideoCapture object there is a 5 frame buffer, and there is the .grab method that takes the frame but does not decode it.

    So you can

    cap = cv2.VideoCapture(0)
    for i in xrange(4):
        cap.grab()
    ret, frame = cap.read()
    ...
    

提交回复
热议问题