[Raspberry Pi] Install opencv on aarch64 system and use hardware acceleration

member
中文
Due to network reasons, it is very difficult to compile Opencv in China
openfans provides opencv-4.5.1-org.pifan_20210116-1_arm64.deb , you can directly from , and the Baidu disk path is: 160bbad9a81971/Raspberry Pi Fan Base 64-bit System 2.0 Official Version/

Ready to work

mkdir /root/opencv/
cd /root/opencv/

Download and unzip

Download source code

wget https://github.com/opencv/opencv/archive/refs/tags/4.5.2.zip -O opencv-4.5.2.zip
wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.5.2.zip -O opencv_contrib-4.5.2.zip

unzip opencv-4.5.2.zip
unzip opencv_contrib-4.5.2.zip

Download the necessary files

Because this address is inaccessible, it will be stuck in the download link

face_landmark_model.dat

wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat -O face_landmark_model.dat

vim opencv_contrib-4.5.2/modules/face/CMakeLists.txt

https://raw.githubusercontent.com/opencv/opencv_3rdparty/${__commit_hash}/ to file:///root/opencv/

ippicv_2020_lnx_intel64_20191018_general.tgz

No download/installation required for this Raspberry Pi
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/a56b6ac6f030c312b2dce17430eef13aed9af274/ippicv/ippicv_2020_lnx_intel64_20191018_general.tgz -O ippicv_2020_lnx_intel64_20191018_general.tgz

vim opencv-4.5.2/3rdparty/ippicv/ippicv.cmake

"https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/" to file:///root/opencv/

Installation dependencies

apt -y remove x264 libx264-dev

## Install dependencies
apt -y install build-essential checkinstall cmake pkg-config yasm
apt -y install libjpeg8-dev libjasper-dev libpng12-dev

apt -y install libtiff5-dev

apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
ln -s -f ../libv4l1-videodev.h videodev.h
cd $cwd

apt -y install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
apt -y install libgtk+-3.0-dev libgtk2.0-dev libtbb-dev
apt -y install libatlas-base-dev
apt -y install libmp3lame-dev libtheora-dev
apt -y install libvorbis-dev libxvidcore-dev libx264-dev
apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
apt -y install libavresample-dev
apt -y install x264 v4l-utils

# Optional dependencies
apt -y install libprotobuf-dev protobuf-compiler
apt -y install libgoogle-glog-dev libgflags-dev
apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen

Create compilation directory

mkdir -p /root/opencv/opencv-4.5.2/build/
cd /root/opencv/opencv-4.5.2/build/

Configuration

cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/ \
-D BUILD_SHARED_LIBS=ON \
-D OPENCV_EXTRA_MODULES_PATH=/root/opencv/opencv_contrib-4.5.2/modules \
-D BUILD_DOCS=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_opencv_java=NO \
-D BUILD_opencv_python=NO \
-D BUILD_opencv_python2=NO \
-D BUILD_opencv_python3=NO \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=OFF \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D WITH_JASPER=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D CMAKE_SHARED_LINKER_FLAGS='-latomic' \
-D OPENCV_GENERATE_PKGCONFIG=ON ..

Compile & install

make -j$(nproc)
make install
阅读 3.4k

擅长计算机开关机、Windows系统的安装。

6.1k 声望
153 粉丝
0 条评论

擅长计算机开关机、Windows系统的安装。

6.1k 声望
153 粉丝
文章目录
宣传栏