Installez OpenCV 4.2.0.
■ Environnement - Raspberry Pi 3 - g++ 4.9.2 - Python3.4.2
■ Prérequis Ce qui suit est installé - Git - cmake - GNU Make
■ Procédure
$ sudo nano /etc/dphys-swapfile
Remplacez CONF_SWAPSIZE '' de
100 '' par `` 1024 ''.
/etc/dphys-swapfile
CONF_SWAPSIZE=1024
Reflétez les changements.
$ sudo /etc/init.d/dphys-swapfile restart
$ sudo apt update
$ sudo apt install build-essential cmake git pkg-config libgtk-3-dev "libcanberra-gtk*"
$ sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev
$ sudo apt install libjpeg-dev libpng-dev libtiff-dev gfortran openexr libatlas-base-dev opencl-headers
$ git clone --branch 4.2.0 https://github.com/opencv/opencv.git
$ git clone --branch 4.2.0 https://github.com/opencv/opencv_contrib.git
$ mkdir <path-to-opencv>/opencv/build
$ cd <path-to-opencv>/opencv/build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D ENABLE_NEON=ON \
-D OPENCV_EXTRA_EXE_LINKER_FLAGS=-latomic \
-D ENABLE_VFPV3=ON \
-D BUILD_TESTS=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=/<path-to-opencv>/opencv_contrib/modules \
-D BUILD_EXAMPLES=OFF ..
Configuration terminée '' et `` Génération terminée '' s'affichent et confirment que le processus s'est terminé normalement.
$ make -j4
$ sudo make install
$ pkg-config --modversion opencv4
Output
4.2.0
$ python3 -c "import cv2; print(cv2.__version__)"
Output
4.2.0
■ Lien de référence How to Install OpenCV on Raspberry Pi 3 https://linuxize.com/post/how-to-install-opencv-on-raspberry-pi/
Recommended Posts