Check if new is new

asked 2019-10-09 03:42:27 -0500

I am using OpenCV C++ and grabbing a camera from USB port with cap.read(frame) in my for loop.

However i only want to get a new frame, when its a new frame from the camera. How can i check if the frame is new provided by the camera?

edit retag flag offensive close merge delete

Comments

what exactly would count as a "new" frame ?

berak gravatar imageberak ( 2019-10-09 03:45:37 -0500 )edit

My Camera has 30 FPS. So it produces 30 frames per second. So in my for Loop cap.read(frame) often read the identical frame multiple times because the for loop executes much faster than 30 times pro second. I need to know if the frame from cap.read(frame) is newly produced by the camera or not

MarcelWeigle gravatar imageMarcelWeigle ( 2019-10-09 03:51:19 -0500 )edit

If there's no frame in the buffer, cap.read should be returning None, not the old frame

nicolasabril gravatar imagenicolasabril ( 2019-10-10 08:31:04 -0500 )edit

please be explicit about opencv version, os, video backend used, results WILL differ unfortunately.

(e.g. grab() will block until there is a new frame on win/DSHOW, but maybe not with what you use)

berak gravatar imageberak ( 2019-10-10 09:19:35 -0500 )edit