Cannot understand the error

Traceback (most recent call last):
File “FaceDetectionUsingHaarCascades.py”, line 19, in
key_pressed=cv2.waitkey(1) & 0xFF
AttributeError: module ‘cv2.cv2’ has no attribute ‘waitkey’
[ WARN:1] terminating async callback

Hey @sagartiwari1711, it should be cv2.waitKey(1)

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :blush:

webcam is opening and getting closed within miliseconds

i also wrote cv2.waitKey(1)

Hey @sagartiwari1711, share your code after saving it on cb.lk/ide

Hey @sagartiwari1711, try running this,

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :blush:

thanks a lot it worked ,where was i wrong anyway

Hey @sagartiwari1711, sometimes frame is not captured properly so you converted it into gray first and than check if it was captured properly or not by if ret==False, i just changed the order.

Happy Learning :blush:

1 Like