cortex-A8 ARM核 opencv程序移植

整体思路:利用TI提供的交叉编译器(arm-none-liunux-gnueabi-gcc)交叉编译opencv库;利用eclipse 编译算法工程,在工程中调用交叉编译后的opencv库;编译好的算法放到文件系统下,在板子上运行,此过程可以利用GDB server实现代码的远程调试。

1.交叉编译opencv库。

这里参考的文章是http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8http://blog.csdn.net/yr119111/article/details/7732336。唯恐以后资源找不到,还是贴到这里吧。

 

Introduction:

This wiki provides instructions that specify how to building OpenCV for ARM Cortex-A8 platform using Cmake in a linux environment. The instructions below have been tested for OpenCV 2.2 by cross compiling it on a Ubuntu 10.04 machine. The toolchain is Codesourcery 2010.12.

Build Instructions

OpenCV 2.2 uses cmake to build. Cmake is a meta-makefile system that generates makefiles. We need to install this first.

  • Update Ubuntu to install and setup cmake
  $ sudo apt-get install cmake cmake-curses-gui
  $ export PATH=$PATH:/opt/arm-2010.12/bin
  $ tar -jxf OpenCV-2.2.0.tar.bz2
  • Cmake supports building outside the source tree. We will use this method to build OpenCV. So, create a directory in $HOME as build
  $ mkdir ~/build && cd ~/build
  • We need to now create a toolchain.cmake file that we will pass to cmake so that it knows how to cross-compile.
  $ vi toolchain.cmake
  • Add the following to toolchain.cmake and save it. This assumes that your NFS targetfs is at ~/targetfs
  set( CMAKE_SYSTEM_NAME Linux )
  set( CMAKE_SYSTEM_PROCESSOR arm )
  set( CMAKE_C_COMPILER arm-none-linux-gnueabi-gcc )
  set( CMAKE_CXX_COMPILER arm-none-linux-gnueabi-g++ )
  set( CMAKE_FIND_ROOT_PATH ~/targetfs )

Important: The CMake build setup in OpenCV 2.2 and earlier does not have NEON ENABLE flag to to take advantage of neon accelearation. Hence please make the following modifications to the file CMakeLists.txt in OpenCV 2.2 to enable neon acceleration.

         # Other optimizations 
         if(USE_O2)    
                set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} -O2 -mfpu=neon")
         endif()

This may not be required in later versions of OpenCV since OpenCV 2.3 has the option to enable neon in the CMake build process.

  • Now we run cmake to process and generate makefile
  $ cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../OpenCV-2.2.0/
  • When cross compiling for ARM, I found that some items do not build. So, we need to use the cmake curses gui to customize cmake output and re-generate the makefile before we can build. Now launch the cmake curses gui to customize the make file generation
  $ ccmake .
  • This will bring up a screen full of options that can be edited. Make sure that the following items are OFF. If it is ON, you can toggle it by scrolling to the option and hitting Enter
    • BUILD_NEW_PYTHON_SUPPORT
    • BUILD_TESTS
    • WITH_1394
    • WITH_CUDA
    • WITH_EIGEN2                     
    • WITH_FFMPEG                      
    • WITH_GSTREAMER                   
    • WITH_GTK
    • WITH_JASPER                     
    • WITH_JPEG                       
    • WITH_OPENEXR                    
    • WITH_PNG                        
    • WITH_PVAPI                      
    • WITH_QT                         
    • WITH_QT_OPENGL                  
    • WITH_TBB                        
    • WITH_TIFF                       
    • WITH_UNICAP                     
    • WITH_V4L                        
    • WITH_XINE    

Note: Do not forget to keep the USE_O2  option ON in the configuration to take adavntage of neon acceleration that you added to this option

  • Now, press 'c' to configure and 'g' to generate the makefiles again.
  • Now you are ready to build OpenCV. Run make from the command line and it should generate the OpenCV libraries. You can try to customize the build by turning on the various options that we disabled earlier and see if it builds for you.

 

opencv2.3.1在arm端的移植( 更新测试结果)

更新:测试结果就是,本文中使用的main.cpp这个例子,在SBC3730这块板子上运行成功!

           所以我估计在omapl138上也会成功。

更新:更新了 编译命令    `pkg-config --cflags --libs opencv`   的更改以及使用方法

首先,opencv是个好东西,对于我这样的菜鸟,来说,既是好用的工具,也是最好的学习资料。

此次移植是在ubuntu12.04 32位,针对omapl138的arm端来进行的。(其实只要是arm应该都一样)

本来呢,是想移植到c6748的。但是我感觉这个对我来说难度有点大。。而网上对于移植arm的资料也很多。

所以先移植到arm再说把。

 

不过还是希望有高手能给我指导一下,将opencv移植至c6748该怎么做。在CCS里或者linux里都行。因为我想使用gpp+dsp模式。将算法做成包,然后跑在dsp端。


此文有一部分综合了网上多人的方法,也有自己在进行移植时的经验。

当然,移植的效果还没有给出,因为板子不在身边,无法进行测试。等有板子了,再进行测试,确定是否移植成功。

结果会在本文更新。

好。先下载opencv。

下载OpenCV 2.3.1 , http://sourceforge.net/projects/opencvlibrary/files/

然后解压

tar xvf OpenCV-2.3.1.tar.bz2

在此要说明的是,此次移植是在前面omapl138的DVSDK都安装并且配置好的情况下进行的。

我的DVSDK安装路径是/home/yr/ti-dvsdk_omapl138-evm_04_03_00_06

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值