Ovyerus / deeppyer

Image deepfryer written in Python.
MIT License
42 stars 5 forks source link

OpenCV error #5

Open ksdfg opened 4 years ago

ksdfg commented 4 years ago

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 commented 3 years ago

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 commented 3 years ago

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