machine-learning
Search…
機器學習:使用Python
簡介Scikit-learn 機器學習
分類法 Classification
特徵選擇 Feature Selection
互分解 Cross Decomposition
通用範例 General Examples
群聚法 Clustering
支持向量機
機器學習資料集 Datasets
應用範例 Application
類神經網路 Neural_Networks
決策樹 Decision_trees
機器學習:使用 NVIDIA JetsonTX2
從零開始
讓 TX2 動起來
安裝OpenCV
安裝TensorFlow
廣義線性模型 Generalized Linear Models
模型選擇 Model Selection
半監督式分類法 Semi-Supervised Classification
Ensemble_methods
Miscellaneous_examples
Nearest_Neighbors
Powered By
GitBook
安裝OpenCV
既然 TX2 上面有相機模組,那我們就來裝個 OpenCV 來做相機的影像處理吧!
Python3 會是我們的主要語言。
1.
安裝依賴套件
1
$
sudo
apt-get
install
build-essential cmake
git
pkg-config libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libgtk2.0-dev libatlas-base-dev gfortran
Copied!
2.
取得 OpenCV 原始碼
1
$
git
clone git://github.com/Itseez/opencv
2
$
cd
opencv
3
$
git
checkout
<
你所要用的 OpenCV 版本,建議是用最新版
>
4
$
git
clone git://github.com/Itseez/opencv_contrib
5
$
cd
opencv_contrib
6
$
git
checkout
<
你所要用的 OpenCV 版本,建議是用最新版
>
Copied!
3.
編譯 OpenCV
1
$
mkdir
opencv/build
2
$
cd
opencv/build
3
$ cmake
\
4
-D
CMAKE_BUILD_TYPE
=
RELEASE
\
5
-D
CMAKE_INSTALL_PREFIX
=
/usr/local
\
6
-D
INSTALL_PYTHON_EXAMPLES
=
ON
\
7
-D
OPENCV_EXTRA_MODULES_PATH
=<
opencv_contrib 所在的完整路徑
>
\
8
-D
BUILD_EXAMPLES
=
ON
..
9
$
make
-j4
10
$
sudo
make
install
11
$
sudo
ldconfig
Copied!
4.
安裝 OpenCV
1.
建立虛擬開發環境
1
$ virtualenv OpenCV
Copied!
2.
進入虛擬開發環境
1
$
cd
OpenCV
2
$
source
bin/active
Copied!
3.
找到 OpenCV
1
$
ls
-al /usr/local/lib/python
<
Python3 的版本號,如:3.
5
>
/dist-packages/cv2*
Copied!
4.
連接 OpenCV 到虛擬環境
1
$
ln
-s
<
上一步驟印出的完整路徑
>
lib/python
<
Python3 的版本號,如:3.
5
>
/site-packages/cv2.so
Copied!
5.
測試 OpenCV
1
import
cv2
2
cv2
.
__version__
Copied!
輸出
1
'<OpenCV 的版本號>'
Copied!
Previous
讓 TX2 動起來
Next
安裝TensorFlow
Last modified
3yr ago
Copy link