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

OpenCV error #5

Open
ksdfg opened this issue Aug 25, 2020 · 2 comments
Open

OpenCV error #5

ksdfg opened this issue Aug 25, 2020 · 2 comments

Comments

@ksdfg
Copy link

ksdfg commented Aug 25, 2020

  • Python version 3.8.5
  • deeppyer version 1.0.1
  • opencv-python version 4.4.0.42

using the function

image = await deepfry(img=image, flares=True)

or the CLI

deeppyer -f ~/Pictures/cats.jpg

gives the error

Traceback (most recent call last):
  File "/home/ksdfg/stuff/code/neko-chan-telebot/venv/bin/deeppyer", line 8, in <module>
    sys.exit(main())
  File "/home/ksdfg/stuff/code/neko-chan-telebot/venv/lib/python3.8/site-packages/deeppyer/cli.py", line 22, in main
    img = loop.run_until_complete(deepfry(img, flares=args.flares))
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/ksdfg/stuff/code/neko-chan-telebot/venv/lib/python3.8/site-packages/deeppyer/__init__.py", line 54, in deepfry
    faces = face_cascade.detectMultiScale(
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-6179nsls/opencv/modules/objdetect/src/cascadedetect.cpp:1689: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'

It works if I set flares=False or do not give -f in CLI, but I do want the flares in the result.....

@ADeeds
Copy link

ADeeds commented Oct 18, 2020

You can fix this by manually downloading
haarcascade_eye.xml and haarcascade_frontalface_default.xml from here. Then put the XML files in the same directory as your code

@ksdfg
Copy link
Author

ksdfg commented Oct 18, 2020

You can fix this by manually downloading
haarcascade_eye.xml and haarcascade_frontalface_default.xml from here. Then put the XML files in the same directory as your code

I tried that already, tried giving full path to the XML files as well.

Edit 1

I also tried adding them to the cwd of the code which was calling the function, the error went away but still no flares........

Edit 2

I tried with some more images, it gave this as the output for one of them
image

while I was expecting something like this
image

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