Reputation: 35
I have been working on a very simple python code for taking video input.
import cv2
import numpy as np
#Capturing video
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read() #Ret returns whether it's true or false
cv2.imshow('Image',frame)
if cv2.waitkey(1) & 0xff == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
but, while executing, it's showing an error like this...
line 11, in <module>
if cv2.waitkey(0) & 0xff == ord('q'):
AttributeError: 'module' object has no attribute 'waitkey'
What is the way out? I am using Python 2.7.13 and openCV 2.4.10.
Upvotes: 1
Views: 5784
Reputation: 382
The K is capital in cv2.waitKey() , write
if (cv2.waitKey(1) & 0xff) == ord('q'):
break
Upvotes: 1