Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is something missing while loop condition block.

import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    img = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
   cv2.imshow('image', img)
    if cv2.waitKey(0) and 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()