此外OpenCV為了增強(qiáng)其通用性和易用性,還提供了Java、Python、CUDA等的使用接口、機(jī)器學(xué)習(xí)的基礎(chǔ)算法調(diào)用,在圖像處理與分析方面極大地簡(jiǎn)化了開(kāi)發(fā)流程,使開(kāi)發(fā)者能更專注于核心算法的設(shè)計(jì)和應(yīng)用層面的工作。
接下來(lái),以ELF 1開(kāi)發(fā)板為例,本文將詳細(xì)介紹如何成功移植OpenCV。
elf@ubuntu:~/work/a/wenz$ tar xvf opencv-3.4.1.tar.gz
elf@ubuntu:~/work/a/wenz$ ls
opencv-3.4.1 opencv-3.4.1.tar.gz
elf@ubuntu:~/work/a/wenz$ cd opencv-3.4.1/
elf@ubuntu:~/work/a/wenz/opencv-3.4.1$ mkdir build
elf@ubuntu:~/work/a/wenz/opencv-3.4.1$ mkdir install
elf@ubuntu:~/work/a/wenz/opencv-3.4.1$ sudo apt-get install cmake cmake-qt-gui cmake-curses-gui
elf@ubuntu:~/work/a/wenz/opencv-3.4.1$ cmake-gui
C :/opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
C++?:/opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
Target?Root:/opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi/usr/lib
CMAKE_CXX_FLAGS: -march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.1.15-2.0.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi
CMAKE_INSTALL_PREFIX:???/home/elf/work/a/wenz/opencv-3.4.1/install
CMAKE_EXE_LINKER_FLAGS:???-lpthread?-lrt?-ldl
elf@ubuntu:~/work/a/wenz/opencv-3.4.1$ . /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
elf@ubuntu:~/work/a/wenz/opencv-3.4.1$ cd build
elf@ubuntu:~/work/a/wenz/opencv-3.4.1/build$ make
elf@ubuntu:~/work/a/wenz/opencv-3.4.1/build$ vi ../3rdparty/protobuf/src/google/protobuf/stubs/common.cc
保存、退出
elf@ubuntu:~/work/a/wenz/opencv-3.4.1/build$ vi ../3rdparty/libpng/pngpriv.h
將:if (defined(__ARM_NEON__) || defined(__ARM_NEON)) &&
改為:if defined(PNG_ARM_NEON) && (defined(ARM_NEON) || defined(__ARM_NEON)) &&
elf@ubuntu:~/work/a/wenz/opencv-3.4.1/build$ make install
elf@ubuntu:~/work/a/wenz/opencv-3.4.1/build$ ls ../install/
bin include lib LICENSE share
閱讀全文