Today, I try to download OpenCV library on my Raspberry pi 3 but have didn’t download simply using pip install command. In pyimagesearch.com explain clearly installation Opencv on Raspberry.
I shortly explain which methods I am using for the installation.
Firstly, you must expand the file expand filesystem using the raspi-config
1 |
sudo raspi-config |
in opened page select advanced options -> expand file system and then hit enter and close this panel.Now, update and upgrade raspberry pi
1 |
sudo apt-get update && sudo apt-get upgrade |
We need install the CMake
1 |
sudo apt-get install build-essential cmake pkg-config |
Next, we need to install library package for the use image file formats with openCV
1 |
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev |
Also for videos file format packages,
1 2 |
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get install libxvidcore-dev libx264-dev |
We need install sub-libraries of the OpenCV
1 2 |
sudo apt-get install libgtk2.0-dev libgtk-3-dev <span class="crayon-e">sudo </span><span class="crayon-v">apt</span><span class="crayon-o">-</span><span class="crayon-r">get</span> <span class="crayon-e">install </span><span class="crayon-v">libatlas</span><span class="crayon-o">-</span><span class="crayon-v">base</span><span class="crayon-o">-</span><span class="crayon-e">dev </span><span class="crayon-v">gfortran</span> |
Reinstall python 2.7 and 3
1 |
sudo apt-get install python2.7-dev python3-dev |
Download OpenCV
1 2 3 4 |
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.3.0.zip unzip opencv.zip wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.3.0.zip unzip opencv_contrib.zip |
1 2 3 |
wget https://bootstrap.pypa.io/get-pip.py sudo python get-pip.py sudo python3 get-pip.py |
You do not skip above parts. However, on the web-site, I mentioned the start of this tutorial. Making the virtual environment but I didn’t. If you want to create look at that tutorial
Making the setup file with Cmake
1 2 3 4 5 6 7 8 |
$ cd ~/opencv-3.3.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.3.0/modules \ -D BUILD_EXAMPLES=ON .. |
In this step I giving the error. When I find the solution, I posted the continue.