Raspberry pi 树莓派安装 OpenCV 4.1.1

1.https://www.raspberrypi.org/downloads/raspbian/

Raspbian Buster with desktop and recommended software 2020-02-13

install software(系统,系统自动升级,ssh,远程登录,FTP)

2.https://github.com/opencv

 https://github.com/opencv/opencv   

https://github.com/opencv/opencv_contrib

3.安装其它软件

1.windows filezilla

2.sudo apt-get install vsftpd  重启pi

3.udo apt-get install make-gui

4.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
sudo apt install python3-dev python3-numpy libtbb2 libtbb-dev libdc1394-22-dev
5.udo nano /etc/dphys-swapfile

//将 CONF_SWAPSIZE 值从默认值更改 100 为 2048: CONF_SWAPSIZE=2048

sudo /etc/init.d/dphys-swapfile restart

6.

mkdir -p ~/Desktop/work/opencv-4.1.1/build/

cd ~/Desktop/work/opencv-4.1.1/build/

sudo cmake-gui 

CMAKE_INSTALL_PREFIX=/usr/local/ 
OPENCV_EXTRA_MODULES_PATH=/home/pi/opencv/opencv_contrib-4.1.1/modules/ 
OPENCV_EXTRA_EXE_LINKER_FLAGS=-latomic \
 ENABLE_PRECOMPILED_HEADERS=OFF
BUILD_EXAMPLES = ON
INSTALL_PYTHON_EXAMPLES = ON
INSTALL_C_EXAMPLES = OM

7. sudo make -j4 2>&1 | tee cmake.log

8.sudo make install

9.测试软件 :

 1.python3.7

   import cv2

  cv2.__version__

2. cd /usr/local/share/OpenCV/samples/python 

python3.7 edge.py

10

sudo nano /etc/dphys-swapfile CONF_SWAPSIZE=100 sudo /etc/init.d/dphys-swapfile restart

共花费两天两晚

你可能感兴趣的:(PI)