Ask Your Question

Revision history [back]

It takes 30 seconds to "imshow" a "VideoCapture" from USB cam. Why?

I just installed Python 3.7.4 and OpenCV-Python (using pip) on a reasonably fast desktop PC (I5, 16GB RAM). Using a UbiSoft WebCam that was meant for a Wii but appears in Device Manager as "USB camera" and works in Skype. Trying tutorial (tabs-spacing is messed up in this window; assume correct as it eventually works): import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow('video', gray) if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()* It eventually works but takes about 30 seconds to get the output video displayed.

click to hide/show revision 2
None

updated 2019-10-07 11:26:29 -0600

berak gravatar image

It takes 30 seconds to "imshow" a "VideoCapture" from USB cam. Why?

I just installed Python 3.7.4 and OpenCV-Python (using pip) on a reasonably fast desktop PC (I5, 16GB RAM). Using a UbiSoft WebCam that was meant for a Wii but appears in Device Manager as "USB camera" and works in Skype. Trying tutorial (tabs-spacing is messed up in this window; assume correct as it eventually works): works):

import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
    ret, frame = cap.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    cv2.imshow('video', gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
 cap.release()cap.release()
 cv2.destroyAllWindows()
cv2.destroyAllWindows()*

It eventually works but takes about 30 seconds to get the output video displayed.