Skip to content

Instantly share code, notes, and snippets.

@soobrosa
Last active September 26, 2017 13:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save soobrosa/7061661cd7bbea988ce470f9191bc1c1 to your computer and use it in GitHub Desktop.
Save soobrosa/7061661cd7bbea988ce470f9191bc1c1 to your computer and use it in GitHub Desktop.
Install OpenCV on a Raspbian Jessie
# thanks to
# https://medium.com/r/?url=https%3A%2F%2Fncsforum.movidius.com%2Fdiscussion%2Fcomment%2F299%2F%23Comment%5C_299
# https://ahmedibrahimvt.wordpress.com/2017/02/19/fatal-error-hdf5-h-no-such-file-or-directory/
# http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install tesseract-ocr
sudo apt-get install python2.7-dev python3-dev
sudo apt-get install avahi-daemon
sudo pip3 install picamera
sudo pip3 install matplotlib
sudo pip3 install numpy
sudo pip3 install pytesseract
export CPATH="/usr/include/hdf5/serial/"
cd ~
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
unzip opencv.zip
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
unzip opencv_contrib.zip
cd ~/opencv-3.1.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules -D BUILD_EXAMPLES=ON ..
make -j4
sudo make install
sudo ldconfig
ln -s /usr/local/lib/python3.4/site-packages/cv2.cpython-34m.so cv2.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment