Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

probably your cam needs a "warmup", and the 1st frame(s) are empty/black. you should reorder your statements, to read continuously from the webcam:

namedWindow("cam-test",CV_WINDOW_AUTOSIZE)
while True:
    s, img = cam.read()
    print "Cam read"
    if s:    # frame captured without any errors
        imshow("cam-test",img)
        # ... process img
    key = waitKey(30)
    if key == ord('q') :
        break