import numpy
import cv2
#int Cam
cap=cv2.VideoCapture(0)
#facedetection
face_cascade=cv2.CascadeClassifier(“haarcascade_frontalface_alt.xml”)
skip=0
while True:
ret,frame=cap.read()
if ret==False:
continue
cv2.imshow("Frame",frame)
faces=face_cascade.detectMultiScale(frame,1.3,5)
print(faces)
#Store every 10th face
if(skip%10==0):
break
key_pressed=cv2.waitKey(1) & 0xFF
if key_pressed==ord("q"):
break
cap.release() # release the device
cap.destroyAllWindows()
In the above code I am gettting below error.
PS C:\Users\abhis\images> python face_data_collect.py
()
Traceback (most recent call last):
File “face_data_collect.py”, line 34, in
[ W cap.destroyAllWindows()
AttributeError: ‘cv2.VideoCapture’ object has no attribute ‘destroyAllWindows’
ARN:1] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (436) `anonymous-namespace’::SourceReaderCB::~SourceReaderCB terminating async callback
It will be great help if you can help me figure out where i have done the error as I am unable to detect it.
Thank you.