Dengan guide dan tutorial yang terlalu banyak di -Google, dan juga disebabkan terlalu banyak version software, firmware, version python, beginners seperti kami memang akan kecundang dalam percubaan untuk meng-Install OpenCV pada Rasp Pi.
Reference URL untuk Langkah #1 ~ Langkah #7:
https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
Reference URL untuk Langkah #8 ~ Langkah #17:
https://www.pyimagesearch.com/2018/09/19/pip-install-opencv/
LANGKAH #1: Install CMAKE
Mulakan dengan memastika Rasp Pi anda Up-To-Date:
$ sudo apt-get update && sudo apt-get upgrade
Kemudian Install CMAKE:
$ sudo apt-get install build-essential cmake pkg-config
LANGKAH #2: Install Library-library Penting
$ sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-100
$ sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libjasper-dev
LANGKAH #3: Install Pip
$ wget https://bootstrap.pypa.io/get-pip.py$ sudo python get-pip.py
$ sudo python get-pip.py
LANGKAH #4: Download OpenCV 3.1.0 dan OpenCV-Contrib
$ 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
LANGKAH #5: Install VirtualEnv dan VirtualEnvWrapper
$ sudo easy_install virtualenv
$ sudo easy_install virtualenvwrapper
LANGKAH #6: Edit file ~/.profile
$sudo nano ~/.profile
Tambahkan line-line berikut dalam file~/.profile :
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
source /usr/local/bin/virtualenvwrapper.sh
Kemudian save kan file tersebut dengan menggunakan Ctrl + x ,
kemudian Shift+y untuk save. Last, tekan enter untuk confirm save.
LANGKAH #7: Source kan ~/.profile
$ source ~/.profile
Cipta Virtual Environment bernama ‘cv’
$ mkvirtualenv cv -p python3
Pastikan sedang bekerja dalam Environment ‘cv’
$ workon cv
LANGKAH #8: Install numpy
$ pip install numpy
LANGKAH #9: Install OpenCV
Ubuntu 16.04: How to install OpenCV
$ 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 INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \ -D BUILD_EXAMPLES=ON ..
Compile OpenCV
$ make -j4
Install OpenCV
$ sudo make install
$ sudo ldconfig
LANGKAH #1: Install CMAKE