I used following references.
- Installation of opencv-3.1.0 on Jetson TX1 [here]
- Installing OpenCV 3.1.0 [here]
- minhoolee/install-opencv-3.1.0.sh [here]
- dselivanov/scripts-ubuntu-debian [here]
Uninstall the current OpenCV
- $ sudo rm -rf /usr/local/include/opencv
- $ sudo rm -rf /usr/local/include/opencv2
- $ suro rm -rf /usr/local/lib/python2.7/dist-packages/cv2.*
- $ suro rm -rf /usr/local/lib/python3.5/dist-packages/cv2.*
- $ sudo rm /usr/local/lib/libopencv_*
You need to change the Python version numbers if you are using different ones.
Keep Ubuntu up to date
- $ sudo apt-get -y update
- $ sudo apt-get -y upgrade
- $ sudo apt-get -y dist-upgrade
- $ sudo apt-get -y autoremove
Install development libraries
- # Add universal repository to Ubuntu
- $ sudo apt-add-repository universe
- $ sudo apt-get update
- # Some general development libraries
- $ sudo apt-get install -y build-essential make cmake cmake-curses-gui g++
- # libav video input/output development libraries
- $ sudo apt-get install -y libavformat-dev libavutil-dev libswscale-dev
- # Video4Linux camera development libraries
- $ sudo apt-get install -y libv4l-dev
- # Eigen3 math development libraries
- $ sudo apt-get install -y libeigen3-dev
- # OpenGL development libraries (to allow creating graphical windows)
- $ sudo apt-get install -y libglew1.6-dev
- # GTK development libraries (to allow creating graphical windows)
- $ sudo apt-get install -y libgtk2.0-dev
- # Install unzip and wget
- $ sudo apt-get install -y unzip wget
Download and install OpenCV
- # Download
- $ cd ~/Downloads
- $ wget https://github.com/opencv/opencv/archive/3.1.0.zip
- # Unzip
- $ unzip 3.1.0.zip
- $ rm 3.1.0.zip
- # Prepare for building
- $ cd opencv-3.1.0
- $ mkdir build $ cd build
- # Building
- $ cmake -DWITH_CUDA=ON -DCUDA_ARCH_BIN=”5.3″ -DCUDA_ARCH_PTX=”” -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DCUDA_FAST_MATH=ON ..
- $ make -j4
- $ sudo make install
- # Setup
- $ sudo /bin/bash -c ‘echo “/usr/local/lib” > /etc/ld.so.conf.d/opencv.conf’
- $ sudo ldconfig