Hi3559A ARM64位 嵌入式平台的OpenCV2.4移植
2018-03-07 10:31
555 查看
最近有个优化任务,需要在Hisi3559A的平台上运行应用,所以需要将OpenCV移植到该平台。虽然已经有很多人写过相关的东西,但感觉都不够详细或是有错误,下面记录一下自己移植的过程。
如有需要可以参考该博客的方式。
FFmpeg源码下载地址
在其他博客中上看到Building_OpenCV_for_ARM_Cortex-A8的文章,感觉还是挺有用的,我是基于篇文章进行的移植。
移植前需要安装一下cmake,用于配置OpenCV的工程。
下面的配置过程在Windows下同样适用,不过需要你找到Windows上的交叉编译工具链。
CMake 3.5.1
aarch64-hisiv610-linux-gcc (Hisilicon_aarch64_v610_20170123) 6.2.1 20161016
在源码解压的文件夹内新建一个编译文件夹,然后在编译文件夹的地址中执行CMake,对OpenCV进行配置。在CMake配置是需要制定安装目录,也就是编译好的OpenCV库文件都放在哪里。这里我指定的是
由于我是要挂载到远端设备运行程序,所以我这里选择使用静态库。如果需要使用动态库的同学,需要将
我的配置如下,供大家参考,大家可以根据自己的需求进行配置:
需要解码图片所以JPEG和PNG在这里是打开的。
CMake配置完成后会有如下类似的显示:(中途会有一些警告,不用理会)
当你看到这样的显示,那就证明你的OpenCV2.4配置完成。
之后进入编译文件夹,执行
2.4.13.6版本在编译过程中并没有遇到什么问题,只是编译的时间有些长(与编译机器的性能有关)。
这里要注意一下第三方库的存放位置,在编译自己的应用的时候需要额外指定一下:
第三方库存放地址
参考博客:
[1] http://blog.csdn.net/hue2550/article/details/77352109
[2] http://blog.csdn.net/hue2550/article/details/77881249
[3] http://blog.csdn.net/yangxueble/article/details/9268719
FFmpeg
需要提一下这个,因为我的应用不需要进行视频播放,所以这个模块我没有编译。如有需要可以参考该博客的方式。
FFmpeg源码下载地址
OpenCV 2.4
因为3359A是基于ARM的平台,所以我先参考了官方的移植教程,但感觉对于我的帮助并不大。在其他博客中上看到Building_OpenCV_for_ARM_Cortex-A8的文章,感觉还是挺有用的,我是基于篇文章进行的移植。
移植前需要安装一下cmake,用于配置OpenCV的工程。
下面的配置过程在Windows下同样适用,不过需要你找到Windows上的交叉编译工具链。
OpenCV 编译环境
Ubuntu 16.04CMake 3.5.1
aarch64-hisiv610-linux-gcc (Hisilicon_aarch64_v610_20170123) 6.2.1 20161016
OpenCV 源码下载
我所使用的OpenCV版本为2.4.13.6,其他版本可以在该地址下载。下载完成后,解压在某个文件夹内。OpenCV CMake配置
这个比较重要可以,参考wiki中的配置,因为我只需要OpenCV帮我做一下解压图片的工作,所以我去掉了很多自己用不着的工具。在源码解压的文件夹内新建一个编译文件夹,然后在编译文件夹的地址中执行CMake,对OpenCV进行配置。在CMake配置是需要制定安装目录,也就是编译好的OpenCV库文件都放在哪里。这里我指定的是
/root/f/temp_work/opencv-2.4.13.6-source/opencv-2.4.13.6/install-3559。
由于我是要挂载到远端设备运行程序,所以我这里选择使用静态库。如果需要使用动态库的同学,需要将
-DBUILD_SHARED_LIBS=OFF改为为
-DBUILD_SHARED_LIBS=ON。
我的配置如下,供大家参考,大家可以根据自己的需求进行配置:
cmake .. \ -DCMAKE_C_COMPILER=aarch64-hisiv610-linux-gcc \ -DCMAKE_CXX_COMPILER=aarch64-hisiv610-linux-g++ \ -DCMAKE_INSTALL_PREFIX=<your path>/opencv-2.4.13.6/install-3559 \ -DWITH_CUDA=OFF \ -DWITH_PNP=OFF \ -DWITH_OPENCL=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DAARCH64=ON \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_SYSTEM_PROCESSOR=arm \ -DBUILD_NEW_PYTHON_SUPPORT=OFF \ -DBUILD_TESTS=OFF \ -DWITH_1394=OFF \ -DWITH_EIGEN2=OFF \ -DWITH_FFMPEG=OFF \ -DWITH_GSTREAMER=OFF \ -DWITH_GTK=OFF \ -DWITH_JASPER=OFF \ -DWITH_JPEG=ON \ -DWITH_OPENEXR=OFF \ -DWITH_PNG=ON \ -DWITH_PVAPI=OFF \ -DWITH_QT=OFF \ -DWITH_QT_OPENGL=OFF \ -DWITH_TBB=OFF \ -DWITH_TIFF=OFF \ -DWITH_UNICAP=OFF \ -DWITH_V4L=OFF \ -DWITH_XINE=OFF
需要解码图片所以JPEG和PNG在这里是打开的。
CMake配置完成后会有如下类似的显示:(中途会有一些警告,不用理会)
-- General configuration for OpenCV 2.4.13.6 ===================================== -- Version control: unknown -- -- Platform: -- Timestamp: 2018-03-06T08:36:06Z -- Host: Linux 4.9.75-linuxkit-aufs x86_64 -- CMake: 3.5.1 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make -- Configuration: Release -- -- C/C++: -- Built as dynamic libs?: NO -- C++ Compiler: /opt/hisi-linux/x86-arm/aarch64-hisiv610-linux/target/bin/aarch64-hisiv610-linux-g++ (ver 6.2.1) -- C++ flags (Release): -fPIC -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fPIC -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /opt/hisi-linux/x86-arm/aarch64-hisiv610-linux/target/bin/aarch64-hisiv610-linux-gcc -- C flags (Release): -fPIC -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fPIC -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- ccache: NO -- Precompiled headers: YES -- -- OpenCV modules: -- To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu nonfree contrib stitching superres ts videostab -- Disabled: world -- Disabled by dependency: - -- Unavailable: androidcamera dynamicuda java ocl python viz -- -- GUI: -- QT: NO -- GTK+ 2.x: NO -- GThread : NO -- GtkGlExt: NO -- OpenGL support: NO -- VTK support: NO -- -- Media I/O: -- ZLib: zlib (ver 1.2.7) -- JPEG: build (ver 62) -- PNG: build (ver 1.5.27) -- TIFF: NO -- JPEG 2000: NO -- OpenEXR: NO -- -- Video I/O: -- DC1394 1.x: NO -- DC1394 2.x: NO -- FFMPEG: NO -- avcodec: NO -- avformat: NO -- avutil: NO -- swscale: NO -- avresample: NO -- GStreamer: NO -- OpenNI: NO -- OpenNI PrimeSensor Modules: NO -- PvAPI: NO -- GigEVisionSDK: NO -- UniCap: NO -- UniCap ucil: NO -- V4L/V4L2: NO/NO -- XIMEA: NO -- Xine: NO -- -- Other third-party libraries: -- Use IPP: NO -- Use Eigen: NO -- Use TBB: NO -- Use OpenMP: NO -- Use GCD NO -- Use Concurrency NO -- Use C=: NO -- Use Cuda: NO -- Use OpenCL: NO -- -- Python: -- Interpreter: NO -- -- Java: -- ant: NO -- JNI: NO -- Java tests: NO -- -- Tests and samples: -- Tests: NO -- Performance tests: NO -- C/C++ Examples: NO -- -- Install path: /root/f/temp_work/opencv-2.4.13.6-source/opencv-2.4.13.6/install-3559 -- -- cvconfig.h is in: /root/f/temp_work/opencv-2.4.13.6-source/opencv-2.4.13.6/build-3559 -- ----------------------------------------------------------------- -- Configuring done -- Generating done -- Build files have been written to: /root/f/temp_work/opencv-2.4.13.6-source/opencv-2.4.13.6/build-3559
当你看到这样的显示,那就证明你的OpenCV2.4配置完成。
之后进入编译文件夹,执行
make -j开始编译OpenCV,完成后执行
make install将编译好的库安装到制定位置。
2.4.13.6版本在编译过程中并没有遇到什么问题,只是编译的时间有些长(与编译机器的性能有关)。
OpenCV库位置
主库和头文件估计都不用说,按照我上面的配置的话,就在install-3559/lib和
install-3559/include里面。
这里要注意一下第三方库的存放位置,在编译自己的应用的时候需要额外指定一下:
第三方库存放地址
install-3559/share/OpenCV/3rdparty/lib
参考博客:
[1] http://blog.csdn.net/hue2550/article/details/77352109
[2] http://blog.csdn.net/hue2550/article/details/77881249
[3] http://blog.csdn.net/yangxueble/article/details/9268719
相关文章推荐
- 基于Hi3559A ARM64位嵌入式平台的OpenCV 2.4/3.1 移植
- 基于Hi3559A ARM64位嵌入式平台的OpenCV2.4.9+ffmpeg2.0.7移植及应用
- 移植MySQL到嵌入式ARM平台
- 移植Python2.7到ARM-LINUX嵌入式平台
- 移植mysql到嵌入式ARM平台
- ARM平台下的嵌入式linux移植大纲(一)
- 移植MySQL到嵌入式ARM平台
- 将交叉编译好的OpenCV移植到ARM平台
- qt的嵌入式平台输入法:SYSZUXpinyin移植到arm
- 移植MySQL到嵌入式ARM平台
- Kinect移植到嵌入式ARM平台上面
- [置顶] 移植opencv到嵌入式arm详细过程
- OPENCV在ARM平台的移植
- 移植MySQL到嵌入式ARM平台
- 嵌入式ARM系统中OpenCV的移植
- 基于qt的嵌入式平台输入法:SYSZUXpinyin移植到arm后,UDP接收端中文乱码 本地中文乱码 解决
- 移植MySQL到嵌入式ARM平台
- 移植MySQL到嵌入式ARM平台
- 移植MySQL到嵌入式ARM平台
- [嵌入式资料] Linux下移植OpenCV + Qt 到ARM(Tiny6410)总结 转