简体   繁体   中英

Haar Cascade Problem with detectMultiScale

So I ran the face cascade classifier:

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

and when I used the code

faces = face_cascade.detectMultiScale(gray, 1.3, 5)

I got the error:

cv2.error: OpenCV(4.0.1) /Users/travis/build/skvark/opencv-python/opencv/modules/objdetect/src/cascadedetect.cpp:1658: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'

I'm not sure if it's because I installed OpenCV via pip? But since I installed via pip, there isn't really a folder I can go into to find the files.

It seems that the haarcascade_frontalface_default.xml is not found. Probably files does not exist in the current working directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM