cv2.VideoCapture not blocking duplicate frames

asked 2015-04-25 16:51:27 -0600

PeteD gravatar image

updated 2019-07-13 05:16:42 -0600

supra56 gravatar image

Hi' I'm using a Raspbery Pi and Pi Camera module with OpenCV though the V4L2 driver and have noticed I'm getting sequences of identical frames returned from cv2.VideoCapture in groups of 4. It seems like the function is not waiting until a new image is captured and the duplicate frames are not being blocked. Anyone had this problem? Even with simple code from opencv tutorial, same result. I also tried updating Pi, new SD card still no joy:

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()


    print frame[160,100]

    # Display the resulting frame
    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
edit retag flag offensive close merge delete