Search code examples
python-3.xopencvraspberry-pi3

Error for the line "faces = face_cascade.detectMultiScale(gray, 1.1, 5)"


I am using OpenCV 3.1.0 on my Raspberry Pi 3 and am getting an error that says

empty() in function detectMultiScale

for the line faces = face_cascade.detectMultiScale(gray, 1.1, 5) does anyone know the solution to this error?


Solution

  • Possibly, the problem with the .xml file you use in:

    face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
    

    by https://docs.opencv.org/3.3.0/d7/d8b/tutorial_py_face_detection.html