windows直接把cv2.pyd放在 anaconda2的 Anaconda2\Lib\site-packages\ 下 就可以了。
但是 anaconda3参考:
Windows+Python3.6.0(Anaconda3)+OpenCV3.2.0安装配置
http://blog.csdn.net/lwplwf/article/details/61616493
opencv下载
http://www.lfd.uci.edu/~gohlke/pythonlibs/
本次配置,因为python装的是3.6.0版本,所以对应着选择,就安装opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl这个了。下载好之后把文件复制到Anaconda3\Lib\site-packages文件夹下
- 按Win+R 输入cmd打开命令提示符窗口,进入到Anaconda3\Lib\site-packages文件夹下
- 执行命令pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl
- 测试一下,输python进入python,输入import cv2回车,不报错就说明安装配置成功了
cvimage = cv2.imread("image.png") #using OpenCV 2
type(cvimage)
Out: numpy.ndarray #dtype is uint8
pltimage = plt.imread("image.png") #using Matplotlib
type(pltimage)
Out: numpy.ndarray #dtype is float
plt.imshow(cvimage) # works great
cv2.imshow(cvimage)
TypeError: Required argument 'mat' (pos 2) not found
cvimage = cv2.imread('image.png') followed by cv2.imshow('Image', cvimage)