import cv2
import numpy as np
cap=cv2.VideoCapture(0)
face_cascade=cv2.CascadeClassifier(“Harcascade_face.xml”)
while True:
ret,frame=cap.read()
if(ret==False):
continue
faces=face_cascade.detectMultiScale(frame,1.3,5)
print(faces)
for (x,y,w,h) in faces:
cv2.rectangle(frame,(x,y),(x+w,y+h),(205,0,0),2)
cv2.imshow("Video Frame by Annu",frame)
key_pressed=cv2.waitKey(1) & 0xFF
if key_pressed==ord('q') :
break
cap.release()
cv2.destroyAllWindows()
when i am writing above code, its throwing an error which is here :-
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-wvn_it83\opencv\modules\objdetect\src\cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function ‘cv::CascadeClassifier::detectMultiScale’