Pre-installed and Pre-configured Raspbian with OpenCV 4.1.0. for Raspberry Pi 3 model B / B+.

sudo apt-get update && sudo apt-get upgrade && sudo rpi-update
sudo nano /etc/dphys-swapfile
#CONF_SWAPSIZE=100
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
sudo apt-get install python3-dev
sudo apt-get install python3-pip
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.1.0.zipwget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.1.0.zipunzip opencv.zipunzip 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_PYTHON_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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store