Reputation: 16099
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
Upvotes: 3
Views: 5308
Reputation: 630
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
Upvotes: 1