回答

收藏

【创龙TL335x-EVM高性能开发板】 在TL335x-EVM移植openCv

创龙科技 创龙科技 2909 人阅读 | 0 人回复 | 2020-12-08

  TL335x-EVM是由广州创龙基于TI ARM Cortex-A8 Sitara AM335x设计的工业级开发板。TI Sitara AM335x是一款高性能嵌入式32位工业级Cortex-A8处理器,主频可高达1GHz,运算能力可高达2000DMIPS,搭配DDR3,兼容eMMC和NAND FLASH,拥有多种工业接口资源,AM335x CPU资源框图如下:
     

   OpenCV介绍:
  OpenCV是Intel®开源计算机视觉库。它由一系列 C 函数和少量 C++ 类构成,实现了图像处理和计算机视觉方面的很多通用算法。OpenCV 拥有包括 300 多个C函数的跨平台的中、高层 API。它不依赖于其它的外部库——尽管也可以使用某些外部库。
OpenCV 对非商业应用和商业应用都是免费(FREE)的。(细节参考 license)。代码下载地址:http://www.sourceforge.net/projects/opencvlibrary
OpenCV 为Intel® Integrated Performance Primitives (IPP) 提供了透明接口。 这意味着如果有为特定处理器优化的的 IPP 库, OpenCV 将在运行时自动加载这些库。
它有以下特点:
1) 开放的C/C++源码
2) 基于Intel处理器指令集开发的优化代码
3) 统一的结构和功能定义
4) 强大的图像和矩阵运算能力
5) 方便灵活的用户接口
6)同时支持MS-WINDOWS、LINUX平台
作为一个基本的计算机视觉、图像处理和模式识别的开源项目,OPENCV可以直接应用于很多领域,作为第二次开发的理想工具。
  
  openCV移植TL335x-EVM过程如下:交叉编译opencv库

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( CM***E_SYSTEM_NAME Linux )  set( CM***E_SYSTEM_PROCESSOR arm )  set( CM***E_C_COMPILER arm-none-linux-gnueabi-gcc )  set( CM***E_CXX_COMPILER arm-none-linux-gnueabi-g++ )  set( CM***E_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 -DCM***E_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






OK


技术改变世界
分享到:
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /2 下一条