Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running face_cascade.detectMultiScale #79

Open
syeds-git opened this issue Dec 5, 2020 · 1 comment
Open

Error running face_cascade.detectMultiScale #79

syeds-git opened this issue Dec 5, 2020 · 1 comment

Comments

@syeds-git
Copy link

Following code from this file in celebrity recognition project does not work:

face_cascade = cv2.CascadeClassifier('./opencv/haarcascades/haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('./opencv/haarcascades/haarcascade_eye.xml')

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

Error:

---------------------------------------------------------------------------

error                                     Traceback (most recent call last)

<ipython-input-9-17af89ccf870> in <module>()
      4 # eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_eye.xml')
      5 
----> 6 faces = face_cascade.detectMultiScale(gray, 1.3, 5)
      7 faces

error: OpenCV(4.1.2) /io/opencv/modules/objdetect/src/cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'
@Utkarsh1504
Copy link

firstly check-in your directory named as or similar to C:/Python/Lib/site-packages/cv2 XML files are present if they are, then instead of
./opencv/haarcascades/haarcascade_frontalface_default.xml use
the same XML file name from your directory.

and if they are not present then firstly download that files in that directory.
https://github.com/anaustinbeing/haar-cascade-files
you can download it from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants