install opencv4.5.4-dev on raspberry

download 64bit raspberry iso:https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2021-11-08/

sudo sed -i 's#://raspbian.raspberrypi.org#s://mirrors.ustc.edu.cn/raspbian#g' /etc/apt/sources.list
sudo sed -i 's#://archive.raspberrypi.org/debian#s://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian#g' /etc/apt/sources.list.d/raspi.list

sudo apt update
sudo apt upgrade

sudo apt install build-essential cmake git pkg-config

sudo apt install libjpeg8-dev libtiff5-dev
sudo apt install libjpeg62-turbo-dev libtiff5-dev

sudo apt install libjasper-dev libpng12-dev *

sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

sudo apt install libgtk2.0-dev
sudo apt install libatlas-base-dev gfortran

sudo apt install sdcv dict gdb valgrind tilda extremetuxracer deepin-screenshot deepin-screen-recorder sl cmatrix htop cowsay libaa-bin bastet
fcitx fcitx-pinyin vim

 

git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make(not recommend make -j4)
err: LDFLAGS="-latomic" cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_opencv_python3=on -DBUILD_opencv_python2=off -DOPENCV_EXTRA_MODULES=../modules -DPYTHON3_LIBRARIES=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so
sudo make install
sudo ldconfig

posted @ 2021-12-01 19:07  叕叒双又  阅读(160)  评论(0编辑  收藏  举报