Skip to content

Instantly share code, notes, and snippets.

@minhoolee
Last active January 13, 2016 04:33
Show Gist options
  • Save minhoolee/a52e99c12ef0bda8257c to your computer and use it in GitHub Desktop.
Save minhoolee/a52e99c12ef0bda8257c to your computer and use it in GitHub Desktop.
#! /bin/sh
# Install script for OpenCV on the Jetson TK1
# Written by Min Hoo Lee
# December 19, 2015 (12/19/15)
echo "\nOpenCV Install Script for Ubuntu\n"
# Activate all the apt-get repositories
echo "\nAdding all apt-get repositories\n"
sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo add-apt-repository restricted
sudo apt-get update
# Install OpenCV dependencies
echo "\nInstalling dependencies\n"
sudo apt-get install git vim curl cmake g++ libopencv-dev build-essential libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5 libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip -y
# Install OpenCV 3.0.0
echo "\nPreparing for OpenCV installation\n"
mkdir -p ~/Vision/src
mkdir ~/Vision/bin
git clone https://github.com/Itseez/opencv.git ~/Vision/bin/opencv
cd ~/Vision/bin/opencv
git checkout 3.0.0
mkdir ~/Vision/bin/opencv/build
# Additional repository for SIFT and SURF patented operators
cd ~/Vision/bin/
git clone https://github.com/Itseez/opencv_contrib.git ~/Vision/bin/opencv_contrib
cd ~/Vision/bin/opencv_contrib
git checkout 3.0.0
cd ~/Vision/bin/opencv/build
echo "\nStarting OpenCV installation\n"
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D CMAKE_CXX_FLAGS_RELEASE="-Wa,-mimplicit-it=thumb" \
-D CUDA_ARCH_BIN="3.2" \
-D CUDA_ARCH_PTX="" \
-D OPENCV_EXTRA_MODULES_PATH=~/Vision/bin/opencv_contrib/modules \
-D WITH_TBB=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D CUDA_FAST_MATH=1 \
-D WITH_CUDA=ON ~/Vision/bin/opencv
make -j4
sudo make install
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "\nDone installing OpenCV (may or may not have been successful)\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment