Skip to content

Instantly share code, notes, and snippets.

@primetoxinz
Last active September 10, 2017 19:12
Show Gist options
  • Save primetoxinz/25aabbadc5ca6689e7f04e61a77395d3 to your computer and use it in GitHub Desktop.
Save primetoxinz/25aabbadc5ca6689e7f04e61a77395d3 to your computer and use it in GitHub Desktop.
Installs OpenCV for Raspberry Pi
sudo apt-get install build-essential git cmake pkg-config ant libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran python2.7-dev python3-dev
DIR=$HOME/vision
mkdir -p $DIR && echo "\n Created Working Directory"
cd $DIR
echo "Downloading OpenCV"
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
echo "Unzipping OpenCV"
unzip opencv.zip
echo "Downloading OpenCV_Contrib"
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
echo "Unzipping OpenCV_Contrib"
unzip opencv_contrib.zip
echo "Building OpenCV"
cd $DIR/opencv-3.1.0
mkdir build
cd build/
export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=OFF \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \ -D BUILD_EXAMPLES=ON ..
cd opencv-3.1.0/build
make -j4 && echo "Built OpenCV, Installing"
sudo make install
sudo ldconfig
echo "Successfully installed OpenCV!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment