2017年9月15日 星期五

OpenCV-Python on Windows with Anaconda 3

OpenCV is a open source computer vision library for real-time applications. It supports many programming languages such as C++, C, Python and Java. In this tutorial, OpenCV is installed with Anaconda 3 running on Windows 10. OK, let's get started.
OpenCV 是一套開發電腦視覺即時處理的函式庫,支援多種程式語言,例如C++、C、Python、Java,本文會在Windows 10上安裝OpenCV與Anaconda 3,我們開始吧!

1. Anaconda 3 安裝 (Anaconda 3 Installation)

Go to https://www.anaconda.com/download/ and download Anaconda 3. Then install it with default settings.
至 https://www.anaconda.com/download/ 下載 Anaconda 3,使用預設設定來安裝。



2. 使用 Anaconda Prompt (Using Anaconda Prompt)


Open the Anaconda Prompt in Anaconda 3 application folder. And test it with the command:
開啟應用程式Anaconda中的Prompt,輸入下面指令:

1
conda --version

The conda version will display on the prompt windows:
conda的版本資訊會顯示在 prompt 視窗中:


3. 建立Python環境 (Create an Python Environment)

Enter the following commands in the prompt windows:
在prompt視窗中輸入下面指令:

1
2
conda create --name userNameCV python=3.6
activate userNameCV

The "userNamceCV" could be any name you like.
"userNamceCV" 可以任意命名。



Checking the Python version:
檢查 Python 版本:
1
python--version




4. 安裝 OpenCV 3 與相依套件 (Install OpenCV 3 and Dependencies)

Enter the following commands in the prompt windows:
在prompt視窗中輸入下面指令:
1
2
3
conda install numpy
conda install anaconda-client
conda install -c conda-forge opencv






Now, checking OpenCV 3 is installed.
檢查Python版本:
python
>>> import cv2
>>> cv.__version__


Congratulation!!! Now, you can use Python and OpenCV3.
恭喜,現在你可以用Python來執行OpenCV3了。

References:
[1] https://github.com/conda-forge/opencv-feedstock/blob/master/README.md
[2] https://chrisconlan.com/installing-python-opencv-3-windows/