Skip to content

Instantly share code, notes, and snippets.

@stsdc
Forked from primetoxinz/opencvinstall.sh
Last active September 11, 2017 12:56
Show Gist options
  • Save stsdc/66e29697e7958f9d211b318fd6dad886 to your computer and use it in GitHub Desktop.
Save stsdc/66e29697e7958f9d211b318fd6dad886 to your computer and use it in GitHub Desktop.
Installs OpenCV for Raspberry Pi
sudo apt-get install build-essential cmake pkg-config -y
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev -y
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev -y
sudo apt-get install libxvidcore-dev libx264-dev -y
sudo apt-get install libgtk2.0-dev libgtk-3-dev -y
sudo apt-get install libatlas-base-dev gfortran -y
sudo apt-get install python2.7-dev python3-dev -y
echo "Downloading OpenCV"
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.3.0.zip
echo "Unzipping OpenCV"
unzip opencv.zip
echo "Downloading OpenCV_Contrib"
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.3.0.zip
echo "Unzipping OpenCV_Contrib"
unzip opencv_contrib.zip
echo "Building OpenCV"
cd opencv-3.3.0
mkdir build
cd build/
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.3.0/modules \ -D BUILD_EXAMPLES=ON ..
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