【糾結】到底要要不要用 OpenCV4Tegra? ANS : NO…Not NOW

告訴你 OpenCV4Tegra 超強 !不只 有GPU 加速 還有 CPU 優化

But … 人生就是這個 BUT …

  • ROS 不太認識他 … Orz
    • Debian package manager 安裝相關 PACKAGE (ex: image_view)時會叫你刪掉換原版。

所以小弟 … 暫緩 OpenCV4Tegra 的 安裝,暫用 OpenCV 2.4.11 (from source)…

以上參考以下網站資料:

安裝過程 (出處: elinux / install OpenCV)

Natively compiling the OpenCV library from source onboard the device

# Some general development libraries

sudo apt-get install build-essential make cmake cmake-curses-gui g++

# libav video input/output development libraries

sudo apt-get install libavformat-dev libavutil-dev libswscale-dev

# Video4Linux camera development libraries

sudo apt-get install libv4l-dev

# Eigen3 math development libraries

sudo apt-get install libeigen3-dev

# OpenGL development libraries (to allow creating graphical windows)

sudo apt-get install libglew1.6-dev

# GTK development libraries (to allow creating graphical windows)

sudo apt-get install libgtk2.0-dev

# python 2.7

sudo apt-get install python-dev python-tk python-numpy

# QT

sudo apt-get install libvtk5-qt4-dev

# Parallelism

sudo apt-get install libtbb-dev

# Download the source code of OpenCV for Linux
wget https://github.com/Itseez/opencv/archive/2.4.11.zip
# Unzip the OpenCV source code:
unzip 2.4.11.zip
# Configure OpenCV using CMake:
cd ~/opencv-2.4.11
mkdir build
cd build
cmake -DWITH_CUDA=ON -DCUDA_ARCH_BIN="3.2″ -DCUDA_ARCH_PTX="" -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DWITH_TBB=ON -D WITH_V4L=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_VTK=ON -D WITH_OPENGL=OFF ..

※ Compile 失敗 關掉了。

不含 CUDA

cmake -DWITH_TBB=ON -D WITH_V4L=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF ..

#To build & install the OpenCV library using all 4 Tegra CPU cores (takes around 40 minutes), including copying the OpenCV library to “/usr/local/include" and “/usr/local/lib":
sudo make -j4 install
#Finally, make sure your system searches the “/usr/local/lib" folder for libraries:
echo “# Use OpenCV and other custom-built libraries." >> ~/.bashrc
echo “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/" >> ~/.bashrc
source ~/.bashrc

測試 Python import cv2 是否成功!

python

import cv2

cv2.__version__

Reference

Major : <elinux>

Comparison : <1> <2>

廣告
本篇發表於 未分類。將永久鏈結加入書籤。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

w

連結到 %s