Hello everyone. I have a question regarding the OpenCV VideoCapture class. Any answer will be helpful.
Suppose that we have the following code
import cv2
import time
cap = cv2.VideoCapture('/dev/video0', cv2.V4L2)
cap.set(cv2.CAP_PROP_FPS, 30.0)
while True:
ret, frame = cap.read()
time.sleep(0.1)
My question is that, what is actually happening inside the camera when the cap.read() loop is way slower than the actual FPS? Does the camera still keep capturing and storing images to its buffer?
this already will sleep for 100 ms, so you cant get more than 10 fps.
(while 30fps would be more a 30ms interval)
(and none of this actually accounts for decoding / processing time)
please check return value (itâs not alwas supported)
Great, thank you! Anyway, Iâd like to make sure my understanding regarding this issue.
Letâs say that i want to call the cap.read() for every 10 seconds (0.1 FPS). If I set the cap.set(cv2.CAP_PROP_FPS, 10.0), this will be inefficient, right? Because the camera will keep capturing images with a time interval of 100 ms, even though we donât retrieve the image at such speed. Is this correct?