Things used in this project

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
This procedure works for Raspberry PI Zero W too.
×1
Power source 5V/2A
Any power source for Raspberry PI (minimal output current: 2A) will work fine here.
×1

Code

OpenCV_CompileAndInstallScript.shSH
Shell script:
- download OpenCV source-code
- compilation of OpenCV source-code
- installation of OpenCV compiled
#!/bin/bash

echo ""
echo "-----------------------------------------------"
echo "Installation of all necessary packages for OpenCV"
echo "-----------------------------------------------"
echo ""

sudo apt-get install -y build-essential cmake pkg-config
sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install -y libxvidcore-dev libx264-dev
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y libatlas-base-dev gfortran
sudo apt-get install -y python2.7-dev python3-dev

echo ""
echo "----------------------------------------"
echo "OpenCV 3.1.0 source-code download"
echo "----------------------------------------"
echo ""

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

echo ""
echo "------------------------------------------------------------------------"
echo "numpy installation"
echo "------------------------------------------------------------------------"
echo ""

pip install numpy

echo ""
echo "--------------------------"
echo "OpenCV 3.1.0 compilation"
echo "--------------------------"
echo ""

cd ~/opencv-3.1.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D ENABLE_PRECOMPILED_HEADERS=OFF \
    -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

echo ""
echo "--------------------------"
echo "OpenCV 3.1.0 installation"
echo "--------------------------"
echo ""

sudo make install

echo ""
echo "--------------------------------------------"
echo "Create OpenCV library cache and links"
echo "--------------------------------------------"
echo ""

sudo ldconfig

Credits

Pedrobertoleti
Pedro Henrique Fonseca Bertoleti
6 projects • 12 followers
Hi there! My name is Pedro Bertoleti. I am aboslutely crazy about: - Electronics - Embedded software design - Technology
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog