3

OpenCV 2.1 with Python 2.6 bindings:

>>> cv.Load('~/Desktop/data/haarcascades/haarcascade_eye.xml')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: OpenCV returned NULL

Any explanations for this? This happens on OS X and Ubuntu. The same error is given for every file. It worked in (I think) 2.0.

Edit- I guess it only breaks sometimes.

>>> cv.Load('/Users/rob/Downloads/OpenCV-2.1.0/data/haarcascades/haarcascade_frontalface_alt.xml')
<HaarClassifierCascade 0x1003a3a40>
>>> cv.Load('/opt/local/var/macports/software/opencv/2.1.0_0/opt/local/share/opencv/haarcascade_frontalface_alt.xml')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: OpenCV returned NULL
1

Looks like the filepath is not resolving properly (e.g. ~/...) but its not really clear

suggest you use OS package to find basepath and join using os.path functions to get full pathnames

| improve this answer | |
0

Replace cv.Load() with cv.CascadeClassifier() and try

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.