1. Install Python 3.4 for Windows
Well, there seems to be nothing to say.
2. Download OpenCV 3 and NumPy (OpenCV dependent numpy library)
There is something wrong with everyone here. If using the PIP install directly with the PYOPENCV installation will be an error. Here we use the Python Live Lei Feng Package installation package, everyone according to their own system download:
- OpenCV 3:http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
- numpy:http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
3. Installation of OpenCV and NumPy
Put the downloaded WHL file into a convenient directory, open cmd, install (I installed the 32-bit PYTHON,WHL package on the C-drive):
pip install c:\opencv_python-3.0.0-cp34-none-win32.whlpip install c:\numpy-1.9.3+mkl-cp34-none-win32.whl
After minutes of installation, this feeling of leverage.
After the installation is done, of course, a code test:
from cv2 import *# 加载摄像头cam = VideoCapture(0) # 0 -> 摄像头序号,如果有两个三个四个摄像头,要调用哪一个数字往上加嘛# 抓拍十张小图片for x in range(0,9): s, img = cam.read() if s: imwrite("o-"+str(x)+".jpg",img)
Running, lying in the groove, so took 10 small photos, files stored in the script in the same directory. There is no very touched, hurriedly with OpenCV hey Hey hehe go.
(Original: http://www.ywlib.com/archives/39.html)
About the resolution of the error:
C:\python27\scripts>pip Install "NUMPY-1.9.2+MKL-CP26-NONE-WIN_AMD64.WHL" Numpy-1.9.2+mkl-cp26-none-win_ AMD64.WHL is a supported wheel on this platform.
Reason: Python version does not correspond to version of NumPy
Workaround:
Python3.4+opencv3