Just testing some sample code that comes with OpenCV 3.1, an reading the documentation from https://fossies.org/dox/opencv-3.1.0/facedetect_8py_source.html
File "facedetect.py", line 23, in <module>
from common import clock, draw_str
ImportError: No module named 'common'
Looks like "common" is missing... Did anybody meet the same issue as mine?
I actually manually installed OpenCV 3.1 and python opencv is defaulty installed into /usr/local/python/3.5
jiapei@jiapei-GT72-6QE:/usr/local/python/3.5$ ls -ls
total 1584
1584 -rw-r--r-- 1 root root 1618712 Apr 15 16:40 cv2.cpython-35m-x86_64-linux-gnu.so
The only thing I did is to ln -s, so I have
jiapei@jiapei-GT72-6QE:/usr/local/lib/python3.5/site-packages$ ls -ls
total 72
0 lrwxrwxrwx 1 root staff 57 Apr 15 16:46 cv2.so -> /usr/local/python/3.5/cv2.cpython-35m-x86_64-linux-gnu.so
72 drwxrwxr-x 12 root staff 69632 Apr 15 21:17 vtk
And I just simply modified facedetect.py a little bit, in order to make sure the cascade file can be correctly located, and added
Python 2/3 compatibility
from future import print_function
import sys
sys.path.append('/usr/local/lib/python3.5/site-packages')
However, the program fails to build with the above error message:
jiapei@jiapei-GT72-6QE:~/Programs/Python$ python facedetect.py &
[2] 4136
jiapei@jiapei-GT72-6QE:~/Programs/Python$ Traceback (most recent call last):
File "facedetect.py", line 23, in
from common import draw_str
ImportError: No module named 'common'
Can anybody give me a hand ??
Thanks in advance...
Cheers
Pei
this is not a bug, the missing file is in the samples folder (you're supposed to either run facedetect.py from there, or copy the dependancies to your own folder)
Most helpful comment
this is not a bug, the missing file is in the samples folder (you're supposed to either run facedetect.py from there, or copy the dependancies to your own folder)