Skip to content

Instantly share code, notes, and snippets.

@pmatatias
Last active August 12, 2021 04:29
Show Gist options
  • Select an option

  • Save pmatatias/dd7afea9418e27840a69758df44d193a to your computer and use it in GitHub Desktop.

Select an option

Save pmatatias/dd7afea9418e27840a69758df44d193a to your computer and use it in GitHub Desktop.
step by step to install opencv on raspberry pi !!!
sudo apt-get update && sudo apt-get upgrade && sudo rpi-update
sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=2048
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 libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.1.0.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.1.0.zip
unzip opencv.zip
unzip opencv_contrib.zip
sudo pip3 install numpy
cd ~/opencv-4.1.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYHTON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-4.1.0/modules \
-D BUILD_EXAMPLES=ON ..
make -j4
sudo make install && sudo ldconfig
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment