2017-10-23 Facedetect

Ok, so facedetect is failing me. When I ran fgallery I got this error:

  File "/Users/alex/bin/facedetect", line 140, in face_detect
    flags = cv2.cv.CV_HAAR_DO_CANNY_PRUNING
AttributeError: 'module' object has no attribute 'cv'

Based on an answer on StackExchange, I installed the latest facedetect from GitHub.

Now I get a different error:

facedetect: error: cannot load HAAR_FRONTALFACE_ALT2 from /usr/share/opencv/haarcascades/haarcascade_frontalface_alt2.xml

This directory is wrong: my opencv stuff got installed in /usr/local/opt/opencv@3 by Homebrew. I should be using the --data-dir option but I opted to change line 37 in facedetect instead. DATA_DIR should point to the directory containing haarcascades:

DATA_DIR = '/usr/local/opt/opencv@3/share/OpenCV/'

Tags:

Comments


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.