face_morpher
face_morpher copied to clipboard
"Invalid HAAR feature" and no face in image error
Attempting to run facemorpher in a docker container as described in the readme,
root@6411e86f84bd:/# facemorpher --src=/images/alyssa.jpg --dest=/images/ian.jpg --plot
Failed finding face points: cascadedetect.cpp(569) : Unspecified error : > Invalid HAAR feature (expected: 'rw.r.x + rw.r.width <= W'), where
> 'rw.r.x + rw.r.width' is 15
> must be less than or equal to
> 'W' is 12
No face in /images/alyssa.jpg
Failed finding face points: cascadedetect.cpp(569) : Unspecified error : > Invalid HAAR feature (expected: 'rw.r.x + rw.r.width <= W'), where
> 'rw.r.x + rw.r.width' is 15
> must be less than or equal to
> 'W' is 12
No face in /images/ian.jpg
Traceback (most recent call last):
File "/usr/local/bin/facemorpher", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/facemorpher/morpher.py", line 149, in main
args['--plot'], args['--background'])
File "/usr/local/lib/python3.7/site-packages/facemorpher/morpher.py", line 134, in morpher
src_img, src_points = next(images_points_gen)
StopIteration
The inputs are jpg files that open fine, and I've even grabbed alyssa.jpg
from the README to ensure that my particular face images are not the problem.
I got the same error and found the solution:
change
from facemorpher import locator
to
import locator
at line34 of morphed.py
I had this as well and tried what @akamatsu said - but his suggestion is not working for me. From the example and this stackoverflow I would conclude that there should not be any hair - only plain faces to make it work. I'm not into opencv to have any clue if this could be improved...
I tried this once more and what @akamatsu is working if you checkout the git repo, i.e. if you don't use facemorpher
installed from pip
. No idea why this is the case, though...