FACE DETECTION ERROR

I AM GETTING THIS ERROR WHILE EXECUTING MY FACE DETECTION CODE

Traceback (most recent call last):
File “E:/Practice/facedetection.py”, line 10, in
faces = face_cascade.detectMultiScale(gray_frame,1.3,5)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function ‘cv::CascadeClassifier::detectMultiScale’

import cv2 cap = cv2.VideoCapture(0)# 0 is the default id of web camera face_cascade = cv2.CascadeClassifier(‘haarcascade_frontalface_default.xml’) while True: ret,frame = cap.read() #cap.read() gives two vale one is boolean thai is in ret and video stored in frame gray_frame = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) if ret == False: continue faces = face_cascade.detectMultiScale(gray_frame,1.3,5) #wait for user input-q,then stop the loop #for square frame arraound the image #x,y arethe statting point of frame #w,h are the width and height of thw frame for (x,y,w,h)in faces: cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,0),2)#(x,y)starting point of frame,(x+w,y+h) end point of frame(255,0,0),2 color of boundary cv2.imshow(“video frame”,frame)#give title to video frame and show video key_pressed = cv2.waitKey(1)&0xFF #gives a 32 bit op if key_pressed == ord(‘q’):#read image till q is pressed break cap.release() cv2.destroyAllWindows()

THIS IS MY CODE THAT I AM EXECUTING

Can you please share your code by saving it at the given below link .

thank uh…but my doubt has been resolved

can u please tell me that CHALLENGE snap chat filtre…will i have to do it myself…coz it has one video that is not opening?

If you have any technical issue with the course , such as videos not playing . Then you can send a mail at [email protected] and they will look into it .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.