Is there any webcam buffering?

asked 2014-04-29 11:18:44 -0500

lepass7 gravatar image

Hello huys, I am trying to read single frames from webcam. I can do that using this code:

 print "\n\nMain while LOOP\n\n"
 q = raw_input("Take picture? y/n\n")
 if (q == "n"):
 elif (q == "y"):
   start_t = time.clock()
   print "--Trying to capture image..."
   s = False
   frame = None
     s, frame =
     i = i + 1
     #cv2.imshow("cam-test", frame)
     print "Attempts: ", i
     if s: break
    if s:
     print "ok"
   except Exception as inst:
    print "Error occured: ", type(inst)


As you can see program waits user to press "y" or "n", if he/she press "n" program stops and this is the end, but if he/she press "y" it will try to capture a single frame (the frame it will be processed and then user can see the processed single frame). When the processed is finalized and user sees the result it will return again back to "y" or "n" question. The problem is that if he/she press "y" the captured frame it will not be a "fresh" frame (what camera sees that exactly moment) but it will be the same frame as the first frame. I have noticed that a "fresh" frame camera will take the sixth time user press "y". I am guessing that somewhere (hardware or software) there is a buffer can I change that with opencv?

edit retag flag offensive close merge delete