Hello, we are trying to write a face detection code in pycharm.
"import cv2
img = cv2.imread("angelina.jpg")
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
for(x,y,w,h)in faces: cv2.rectangle(img, (x,y), (x+w, y+h), (0,0,255),1)
cv2.imshow('img', img) cv2.waitKey(0)"
when we try to run this code we get that error: Traceback (most recent call last): File "C:/Users/Barış/Desktop/haarcascade.py", line 11, in <module> faces = face_cascade.detectMultiScale(gray, 1.1, 4) cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:1698: error: (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'
please help us to come through that problem