hey there,
i would like to install opencv 3.1.0 in my px2. i followed your step with your advice. https://devtalk.nvidia.com/default/topic/1019937/faq/opencv/
but unfortunately i did not succeed.
’
it could be one reason that after i input “git cherry-pick 10896” in px2 console, the feedback is " fatal: bad revision". would you mind give me some advice how can i install opencv 3.1.0 in my px2.
thank you
Chaofan
Dear yinchaofan,
Can I get you’re using SDK version?
And did you set up CUDA development environment?
I successfully installed opencv 3.1.0 on my DPX2(SDK : 5.0.5.0bL). Thanks.
Dear yinchaofan,
Could you please below and re-run cherry-pick? Thanks.
git reset –hard HEAD
git config –global “your e-mail”
git config –global “your name’
Dear Steve,
thank you for your reply so fast. my SDK version is 5.0.5.0aL with CUDA version 9.0.
“git reset --hard HEAD” did not work with my px2. naja. the Feedback from console is
fatal: ambiguous argument ‘HEAD’: unknown revision or path not in the working tree.
Use ‘–’ to separate paths from revisions, like this:
‘git […] – […]’
i tried to install opencv 3.1.0 in my PX2 one more again. and i would like to write all step i did this time.
#Pre-Conditons
sudo apt-get install git
git config --global user.email “my email”
git config --global user.name “my name”
#clone opencv package
cd /home/nvidia/Documents
git clone GitHub - opencv/opencv: Open Source Computer Vision Library
cd opencv
git checkout -b v3.1.0 3.1.0
#Feedback in Console: “Switched to a new branch ‘v3.1.0’”
git cherry-pick 10896
git cherry-pick cdb9c
git cherry-pick 24dbb
#ready for building
sudo apt-add-repository universe
sudo apt-get update
sudo apt-get install
libglew-dev
libtiff5-dev
zlib1g-dev
libjpeg-dev
libpng12-dev
libjasper-dev
libavcodec-dev
libavformat-dev
libavutil-dev
libpostproc-dev
libswscale-dev
libeigen3-dev
libtbb-dev
libgtk2.0-dev
pkg-config
mkdir build
cd build
#ready to configure and build opencv
until now all feedback is great. i would like to do last step to install it.
cmake
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/usr
-DBUILD_PNG=OFF
-DBUILD_TIFF=OFF
-DBUILD_TBB=OFF
-DBUILD_JPEG=OFF
-DBUILD_JASPER=OFF
-DBUILD_ZLIB=OFF
-DBUILD_EXAMPLES=ON
-DBUILD_opencv_java=OFF
-DBUILD_opencv_python2=ON
-DBUILD_opencv_python3=OFF
-DENABLE_NEON=ON
-DWITH_OPENCL=OFF
-DWITH_OPENMP=OFF
-DWITH_FFMPEG=ON
-DWITH_GSTREAMER=OFF
-DWITH_GSTREAMER_0_10=OFF
-DWITH_CUDA=ON
-DWITH_GTK=ON
-DWITH_VTK=OFF
-DWITH_TBB=ON
-DWITH_1394=OFF
-DWITH_OPENEXR=OFF
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.0
-DCUDA_ARCH_BIN=6.2
-DCUDA_ARCH_PTX=“”
-DINSTALL_C_EXAMPLES=ON
-DINSTALL_TESTS=OFF
…
but it is still not work-- Configuring incomplete, errors occurred!
should i download a cuda 8.0 and try it again? can you maybe give me some advice?
thank you
Chaofan Yin
Dear yinchaofan,
Can I get you’re using SDK version?
If 5.0.5.0bl, please ㅁpply the following information. Thanks.
https://devtalk.nvidia.com/default/topic/1032172/faq/drivepx2-opencv3-cuda9-patch/
Dear Steve,
thank you for your answer and your information.
my SDK version is 5.0.5.0aL with CUDA 9.0
the reason why i can not install opencv 3.1.0 is because of CUDA 9.0. there are not automatic work together. i also find some information from this website.
https://devtalk.nvidia.com/default/topic/1027552/general/opencv-with-cuda-9-on-drive-px2/
after i change the nppi library and so on follow the advice from him, i already fix this issue.
Opencv 3.1.0 is now installed in my px2.
thank you
chaofan
b.t.w
would you mind giving me some advice to install caffe in px2. i also need to install it in my px2. looking forward to your answer.
Dear Steve,
thank you for your answer and your information.
my SDK version is 5.0.5.0aL with CUDA 9.0
the reason why i can not install opencv 3.1.0 is because of CUDA 9.0. there are not automatic work together. i also find some information from this website.
opencv with cuda 9 on Drive PX2 - General - NVIDIA Developer Forums
after i change the nppi library and so on follow the advice from him, i already fix this issue.
Opencv 3.1.0 is now installed in my px2.
thank you
chaofan
b.t.w
would you mind giving me some advice to install caffe in px2. i also need to install it in my px2. looking forward to your answer.
Dear chaofan,
Here are some links to the instruction I used to deploy opencv and caffe on PX2 AutoChauffeur. You may find something useful here and hope it helps.
OpenCV:
https://docs.opencv.org/3.2.0/d6/d15/tutorial_building_tegra_cuda.html
Caffe:
If you want to run SSD on caffe, do get the git repository from WeiLiu89 distribution under ssd branch because they included addition layers in the model. Do the first a few steps from README
git clone GitHub - weiliu89/caffe: Caffe: a fast open framework for deep learning.
cd caffe
git checkout ssd
Here are a summarize for the environment variables needed in ~/.bashrc, modify the paths accordingly.
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}$
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PYTHONPATH=/opt/caffe/python:$PYTHONPATH
export LD_LIBRARY_PATH=/opt/caffe/build/lib:$LD_LIBRARY_PATH
Best Regards,
Zhe Huang
CM Paras for installing OpenCV, as a reference. Pay attention to the paths and modify them accordingly.
cmake
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX=/usr/local
-D CMAKE_EXE_LINKER_FLAGS=“-std=c++11”
-D BUILD_PNG=OFF
-D BUILD_TIFF=OFF
-D BUILD_TBB=OFF
-D BUILD_JPEG=OFF
-D BUILD_JASPER=OFF
-D BUILD_ZLIB=OFF
-D BUILD_EXAMPLES=OFF
-D BUILD_opencv_java=OFF
-D BUILD_opencv_python2=ON
-D BUILD_opencv_python3=ON
-D ENABLE_NEON=ON
-D WITH_OPENCL=OFF
-D WITH_OPENMP=OFF
-D WITH_FFMPEG=ON
-D WITH_GSTREAMER=OFF
-D WITH_GSTREAMER_0_10=OFF
-D WITH_CUDA=ON
-D WITH_GTK=ON
-D WITH_VTK=OFF
-D WITH_TBB=ON
-D WITH_1394=OFF
-D WITH_OPENEXR=OFF
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0
-D CUDA_ARCH_BIN=‘6.1 6.2’
-D CUDA_ARCH_PTX=“”
-D CUDA_GENERATION=Auto
-D INSTALL_C_EXAMPLES=OFF
-D INSTALL_TESTS=OFF
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules
/opt/opencv
Turn all the EXAMPLES off, they are troublesome running on PX2.
ARCH_BIN should include ‘6.1 6.2’ at least.
Makefile.config content for installing Caffe (between the dotted line):
Contributions simplifying and improving our build system are welcome!
cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1
uncomment to disable IO dependencies and corresponding data layers
USE_OPENCV := 0
USE_LEVELDB := 0
USE_LMDB := 0
uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
You should not set this flag if you will be reading LMDBs with any
possibility of simultaneous read and write
ALLOW_LMDB_NOLOCK := 1
Uncomment if you’re using OpenCV 3
OPENCV_VERSION := 3
To customize your choice of compiler, uncomment and set the following.
N.B. the default for Linux is g++ and the default for OSX is clang++
CUSTOM_CXX := g++
CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
On Ubuntu 14.04, if cuda tools are installed via
“sudo apt-get install nvidia-cuda-toolkit” then use this instead:
CUDA_DIR := /usr
CUDA architecture setting: going with all of them.
For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_30,code=sm_30
-gencode arch=compute_35,code=sm_35
-gencode arch=compute_50,code=sm_50
-gencode arch=compute_52,code=sm_52
-gencode arch=compute_60,code=sm_60
-gencode arch=compute_61,code=sm_61
-gencode arch=compute_61,code=compute_61
-gencode arch=compute_62,code=sm_62
-gencode arch=compute_62,code=compute_62
BLAS choice:
atlas for ATLAS (default)
mkl for MKL
open for OpenBlas
BLAS := atlas
Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
Leave commented to accept the defaults for your choice of BLAS
(which should work)!
BLAS_INCLUDE := /path/to/your/blas
BLAS_LIB := /path/to/your/blas
Homebrew puts openblas in a directory that is not on the standard search path
BLAS_INCLUDE := $(shell brew --prefix openblas)/include
BLAS_LIB := $(shell brew --prefix openblas)/lib
This is required only if you will compile the matlab interface.
MATLAB directory should contain the mex binary in /bin.
MATLAB_DIR := /usr/local
MATLAB_DIR := /Applications/MATLAB_R2012b.app
NOTE: this is required only if you will compile the python interface.
We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7
/usr/lib/python2.7/dist-packages/numpy/core/include
Anaconda Python distribution is quite popular. Include path:
Verify anaconda location, sometimes it’s in root.
ANACONDA_HOME := $(HOME)/anaconda
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
# $(ANACONDA_HOME)/include/python2.7 \
# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
Uncomment to use Python 3 (default is Python 2)
PYTHON_LIBRARIES := boost_python-py35 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m \
/usr/local/lib/python3.5/dist-packages/numpy/core/include
We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
PYTHON_LIB := $(ANACONDA_HOME)/lib
Homebrew installs numpy in a non standard path (keg only)
PYTHON_INCLUDE += $(dir $(shell python -c ‘import numpy.core; print(numpy.core.file )’))/include
PYTHON_LIB += $(shell brew --prefix numpy)/lib
Uncomment to support layers written in Python (will link against Python libs)
WITH_PYTHON_LAYER := 1
Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/hdf5/serial
If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
INCLUDE_DIRS += $(shell brew --prefix)/include
LIBRARY_DIRS += $(shell brew --prefix)/lib
NCCL acceleration switch (uncomment to build with NCCL)
USE_NCCL := 1
Uncomment to use pkg-config
to specify OpenCV library paths.
(Usually not necessary – OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
USE_PKG_CONFIG := 1
N.B. both build and distribute dirs are cleared on make clean
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
DEBUG := 1
The ID of the GPU that ‘make runtest’ will use to run unit tests.
TEST_GPUID := 0
enable pretty build (comment to see full commands)
Q ?= @
All the configs are based on cuda-8.0 which should be pre-installed in PX2 or you can get the JetPack SDK for a proper environment.