此外OpenCV为了增强其通用性和易用性,还提供了Java、Python、CUDA等的使用接口、机器学习的基础算法调用,在图像处理与分析方面极大地简化了开发流程,使开发者能更专注于核心算法的设计和应用层面的工作。
接下来,以ELF 1开发板为例,本文将详细介绍如何成功移植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
阅读全文