移植opencv到tq2440一、下载opencv及cmake
1,download opencv_2.3.1
OpenCV-2.3.1a.tar.bz2
下载链接:http://opencv.org/downloads.html
2,download cmake
//cmake-3.1.0.tar.gz //without gui
cmake-3.1.0-Linux-i386.sh
下载链接:http://www.cmake.org/cmake/resources/software.html二、将下载文件放入linux下
1,cmake
文件路径
/opt/EmbedSky/cmake/cmake-3.1.0
解压
[root@EmbedSky cmake-3.1.0]# tar -xzvf cmake-3.1.0.tar.gz -C ./
2,opencv
文件路径
where is the source code:
/opt/EmbedSky/opencv_2_3_1/OpenCV-2.3.1where to build the binaries:
/opt/EmbedSky/opencv_2_3_1/opencv_forArm#./cmake-3.1.0-Linux-i386.sh#cd cmake-3.1.0-Linux-i386#cd bin#./cmake-guiwhere is the source code:/opt/EmbedSky/opencv_2_3_1/OpenCV-2.3.1where to build the binaries:/opt/EmbedSky/opencv_2_3_1/opencv_forArm然后,点击Configure,保持generator为Unix Makefiles,选择Specify options for cross-compiling,点击Next
Operating System填写arm-linux 或者 Linux 注意L是大写(我用的是这个,ok的)
C Compilers填写/opt/EmbedSky/4.3.3/bin/arm-linux-gcc
C++ Compilers填写/opt/EmbedSky/4.3.3/bin/arm-linux-g++
Target Root填写/opt/EmbedSky/4.3.3
点击finish
///
err1:
System is unknown to cmake, create:
Platform/arm-linux to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to cmake@www.cmake.org.
Extracting svn version, please wait...
SVNVERSION: exported
Detected version of GNU GCC: 20091 (200901)
Could NOT find PythonLibs (missing:  PYTHON_INCLUDE_DIRS)
Unknown option: -B
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.Unknown option: -B
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.CUDA_TOOLKIT_ROOT_DIR not found or specified
CMake Error at /opt/EmbedSky/cmake/cmake-3.1.0-Linux-i386/share/cmake-3.1/Modules/FindCUDA.cmake:616 (if):if given arguments:"CUDA_VERSION" "VERSION_GREATER" "5.0" "AND" "CMAKE_CROSSCOMPILING" "AND" "MATCHES" "arm" "AND" "EXISTS" "CUDA_TOOLKIT_ROOT_DIR-NOTFOUND/targets/armv7-linux-gnueabihf"Unknown arguments specified
Call Stack (most recent call first):CMakeLists.txt:958 (find_package)Configuring incomplete, errors occurred!
See also "/opt/EmbedSky/opencv_2_3_1/opencv_forArm/CMakeFiles/CMakeOutput.log".
anwser:将 WITH_CUDA的钩去掉//
err2:
CMake Warning (dev) at CMakeLists.txt:1508 (add_custom_target):Policy CMP0037 is not set: Target names should not be reserved and shouldmatch a validity pattern.  Run "cmake --help-policy CMP0037" for policydetails.  Use the cmake_policy command to set the policy and suppress thiswarning.The target name "package_source" is reserved or not valid for certain CMakefeatures, such as generator expressions, and may result in undefinedbehavior.
This warning is for project developers.  Use -Wno-dev to suppress it.
anwser2:WITH_TIFF去掉System is unknown to cmake, create:
Platform/arm-linux to use this system, please send your config file to cmake@www.cmake.org so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to cmake@www.cmake.org.
Extracting svn version, please wait...
SVNVERSION: exported
Detected version of GNU GCC: 20091 (200901)
Could NOT find PythonLibs (missing:  PYTHON_INCLUDE_DIRS)
Unknown option: -B
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.Unknown option: -B
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.Parsing 'cvconfig.h.cmake'
CMake Warning (dev) at CMakeLists.txt:1508 (add_custom_target):Policy CMP0037 is not set: Target names should not be reserved and shouldmatch a validity pattern.  Run "cmake --help-policy CMP0037" for policydetails.  Use the cmake_policy command to set the policy and suppress thiswarning.The target name "package_source" is reserved or not valid for certain CMakefeatures, such as generator expressions, and may result in undefinedbehavior.
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_calib3d".Use the target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.Call Stack (most recent call first):modules/calib3d/CMakeLists.txt:1 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_core".Use the target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.Call Stack (most recent call first):modules/core/CMakeLists.txt:8 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target"opencv_test_features2d".  Use the target name directly withadd_custom_command, or use the generator expression $<TARGET_FILE>, asappropriate.Call Stack (most recent call first):modules/features2d/CMakeLists.txt:1 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at modules/highgui/CMakeLists.txt:418 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_highgui".Use the target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at modules/highgui/CMakeLists.txt:418 (get_target_property):Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the linkinterface.  Run "cmake --help-policy CMP0022" for policy details.  Use thecmake_policy command to set the policy and suppress this warning.Target "opencv_highgui" has an INTERFACE_LINK_LIBRARIES property whichdiffers from its LINK_INTERFACE_LIBRARIES properties.INTERFACE_LINK_LIBRARIES:opencv_core;opencv_imgproc;zlib;libjpeg;libpng;libjasperLINK_INTERFACE_LIBRARIES:This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_imgproc".Use the target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.Call Stack (most recent call first):modules/imgproc/CMakeLists.txt:1 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_ml".  Usethe target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.Call Stack (most recent call first):modules/ml/CMakeLists.txt:1 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target"opencv_test_objdetect".  Use the target name directly withadd_custom_command, or use the generator expression $<TARGET_FILE>, asappropriate.Call Stack (most recent call first):modules/objdetect/CMakeLists.txt:1 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at OpenCVModule.cmake:158 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_video".Use the target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.Call Stack (most recent call first):modules/video/CMakeLists.txt:1 (define_opencv_module)
This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at modules/gpu/CMakeLists.txt:213 (get_target_property):Policy CMP0026 is not set: Disallow use of the LOCATION target property.Run "cmake --help-policy CMP0026" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.The LOCATION property should not be read from target "opencv_test_gpu".Use the target name directly with add_custom_command, or use the generatorexpression $<TARGET_FILE>, as appropriate.This warning is for project developers.  Use -Wno-dev to suppress it.CMake Warning (dev) at modules/gpu/CMakeLists.txt:88 (add_library):Policy CMP0038 is not set: Targets may not link directly to themselves.Run "cmake --help-policy CMP0038" for policy details.  Use the cmake_policycommand to set the policy and suppress this warning.Target "opencv_gpu" links to itself.
This warning is for project developers.  Use -Wno-dev to suppress it.General configuration for opencv 2.3.1 =====================================Built as dynamic libs?:     YESCompiler:                   /opt/EmbedSky/4.3.3/bin/arm-linux-g++C++ flags (Release):          -Wall -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -DNDEBUG C++ flags (Debug):            -Wall -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG -ggdb3 Linker flags (Release):Linker flags (Debug):GUI: GTK+ 2.x:                   NOGThread:                    NOMedia I/O: ZLib:                       buildJPEG:                       buildPNG:                        buildTIFF:                       JPEG 2000:                  buildOpenEXR:                    NOOpenNI:                     NOOpenNI PrimeSensor Modules: NOXIMEA:                      NOOther third-party libraries:Use IPP:                    NOUse TBB:                    NOUse Cuda:                   NOUse Eigen:                  NOInterfaces:Python:                     YESPython interpreter:         /usr/bin/python -B (ver 2.5)Python numpy:               NO (Python wrappers will not be generated)Java:                       NODocumentation:Sphinx:                     NOPdfLaTeX compiler:          /usr/bin/pdflatexBuild Documentation:        NOTests and samples:Tests:                      YESExamples:                   NOInstall path:                 /usr/localcvconfig.h is in:             /opt/EmbedSky/opencv_2_3_1/opencv_forArm
-----------------------------------------------------------------Configuring done
有些警告忽略了#make
/usr/lib/libImath.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so] 错误 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2
make: *** [all] 错误 2answer:
remove BUILD_OPENEXR options#make
....
[100%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/main.o
Linking CXX executable ../../bin/opencv_stitching
[100%] Built target opencv_stitching参考:
http://blog.sina.com.cn/s/blog_92942dba0101d1wj.html
http://blog.csdn.net/embeddedman/article/details/7416934
http://blog.csdn.net/chenaini119/article/details/39079965
http://blog.csdn.net/eagelangel/article/details/7232364
http://lbn321.blog.163.com/blog/static/227841017201422491245680/
http://blog.csdn.net/b5w2p0/article/details/39211013
<span style="color:#FF0000;">
小的总结
以上是用CMAKE编译OPENCV2.3.1,需要主要几个问题:
1,下载cmake和opencv,解压到linux下,这步很简单不会有什么问题
2,怎么去config cmake,最关键的
参考:http://blog.csdn.net/luotuo44/article/details/8958990
3,修改CMakeCache.txt  添加-lpthread -ldl -lrt
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -lrt -ldl
4,make && make install
5,测试应用程序
6,移植到arm
我认为如果没有必要用更高opencv的话,比如opencv2.3.1
就用opencv2.0.0
为什么推荐opencv2.0呢,很简单,
1,没有cmake,直接config...就可以了;
2,节约时间;
3,最头痛的是 遇到一大推BUG,比如出现找不到链接库,最老火的是,那库就在那儿,它还说找不到,
哈哈,如果懂修改工具链会得到解决,我遇到这个问题,网上也有人遇到这个问题
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld:
warning: ../../lib/libopencv_imgproc.so, needed by
/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/lib/libopencv_highgui.so,
not found (try using -rpath or -rpath-link)
/opt/EmbedSky/4.3.3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld:
warning: ../../lib/libopencv_core.so, needed by
/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/lib/libopencv_highgui.so,
not found (try using -rpath or -rpath-link)
下面介绍一下移植opencv2.0.0
1,下载及解压
2,生成opencv编译后的目录,方便管理
</span><h3><pre name="code" class="cpp"><span style="color:#FF0000;">#mkdir -p /opt/arm/opencv
#mkdir -p /opt/arm/opencv/lib
#mkdir -p /opt/arm/opencv/include</span>

3,执行config

#./configure --host=arm-linux --without-gtk --without-carbon --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --enable-static --enable-shared --disable-apps CXX=arm-linux-g++ CPPFLAGS=-I/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/include LDFLAGS=-L/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/libc/lib --with-v4l2 --prefix=/opt/arm/opencv --libdir=/opt/arm/opencv/lib -includedir=/opt/arm/opencv/include

分析一下命令:还是比较简单的,在执行上述命令前需要生成3个目录,见2
./configure
--host=arm-linux
--without-gtk
--without-carbon
--without-quicktime
--without-1394libs
--without-ffmpeg
--without-python
--without-swig
--enable-static
--enable-shared
--disable-apps
CXX=arm-linux-g++
CPPFLAGS=-I/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/include
LDFLAGS=-L/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/libc/lib
--with-v4l2
--prefix=/opt/arm/opencv
--libdir=/opt/arm/opencv/lib
-includedir=/opt/arm/opencv/include

<span style="color:#FF0000;">4,找到opencv/include/opencv目录下的cxtypes.h 第240的
“return (int)lrint(value);
”改为“return (int)(value + 0.5)即可。</span>

5,写测试应用程序,下面这个很通用,我也是在网上找的
//test.c
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
 
int main( int argc, char** argv )
{
  //声明IplImage指针
  IplImage* pFrame = NULL;

//获取摄像头
  CvCapture* pCapture = cvCreateCameraCapture(-1);
 
  //创建窗口
  cvNamedWindow("video", 1);
 
  //显示视屏
  while(1)
  {
      pFrame=cvQueryFrame( pCapture );
      if(!pFrame)break;
      cvShowImage("video",pFrame);
      char c=cvWaitKey(33);
      if(c==27)break;
  }
  cvReleaseCapture(&pCapture);
  cvDestroyWindow("video");
}

6,//编译
#arm-linux-gcc test.c -o test-arm  -I/opt/arm/opencv/include/opencv -L/opt/arm/opencv/lib -lml -lcvaux -lhighgui -lcv -lcxcore  -lpthread -lrt

分析:
arm-linux-gcc test.c -o test-arm 
-I/opt/arm/opencv/include/opencv
-L/opt/arm/opencv/lib
-lml -lcvaux -lhighgui -lcv -lcxcore  -lpthread -lrt

7,移植到arm,将lib下的*.so.x,重命名后,拷贝到arm下的lib中

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

移植Opencv到arm tq2440相关推荐

  1. 移植OpenCV的AdaBoost人脸检测算法到DM6467

    1        人脸检测算法在DM6467上移植的步骤 要将人脸检测算法移植到DM6467,我们使用OpenCV现有的源码作为基础.首先,需要在PC上用C语言实现人脸检测的程序编写,然后移植Open ...

  2. OpenCV在ARM上的移植

    OpenCV在ARM上的移植 与X86 Linux类似,请参考: Linux 下编译安装OpenCV 本文在此基础上进行进一步操作. 网络上很多移植编译的方法比较老,多数针对OpenCV 1.0,而且 ...

  3. 移植opencv到嵌入式arm详细过程

    你好!这里是风筝的博客, 欢迎和我一起交流. 看了好几篇一直opencv的文章,都是几年前的,而且版本比较旧,对着弄会发现有的地方是和现在是有改动的.所以,2017年末,记录了此次移植过程,移植版本比 ...

  4. opencv 全志_移植opencv人脸识别到全志A10开发板上 +linux3.0内核

    移植opencv人脸识别 libz:    zlib-1.2.3 libjpeg:   jpegsrc.v6b libpng:   libpng-1.2.18 libyasm:   yasm-0.7. ...

  5. Zedboard学习(八):zedboard移植opencv

    准备工作 opencv源码包下载:http://pan.baidu.com/s/1qXTKIdQ(opencv-2.4.9),后面我们要在虚拟机中编译: 搭建好zedboard在Linux下的交叉编译 ...

  6. OpenCV基于ARM的Linux系统的交叉编译

    OpenCV基于ARM的Linux系统的交叉编译 基于ARM的Linux系统的交叉编译 先决条件 获取OpenCV源代码 获取最新的稳定OpenCV版本 从Git存储库中获取最新的OpenCV 构建O ...

  7. am335x mysql_移植mysql到ARM(AM335x)

    一,编译ncurses 编译mysql需要依赖ncurses,先编译ncurses 1.下载ncurses 下载路径是ftp://ftp.gnu.org/gnu/ncurses,选择下载的是ncurs ...

  8. 移植u-boot-2016.11到TQ2440开发板全过程记录

    移植前的准备 获取并解压源码 SAMSUNG公司于2017年初停止了对S3C2410系列CPU的官方u-boot支持(可在最新版u-boot源码中打开doc/README.scrapyard,搜索关键 ...

  9. opencv for arm

    这个是头文件和库: https://github.com/praveenofpersia/OpenCV-2.4.9-for-arm opencv-arm代码: https://github.com/g ...

最新文章

  1. Facebook 开源高质量实例分割数据集 LVIS
  2. m_Orchestrate learning system---九、在无法保证是否有图片的情况下,如何保证页面格式...
  3. echarts地图罗平县的json_Echarts全国省市区县地图数据文件(含js及json)
  4. iOS内存管理编程指南
  5. Princess Principal(思维题)
  6. 设计模式——开发常用的设计模式梳理
  7. 【Java】日期/事件字符串包含TZ
  8. BZOJ 2957 楼房重建 (分块)
  9. 马斯克脑机接口、BrainOS 相继发布,未来已来?
  10. android studio sqlite操作代码片段
  11. Java中try与catch的使用
  12. 60、在Visual Studio 2019 环境下,使用C#调用C++生成的dll实现yolov5的图片检测
  13. springboot webService调用
  14. Linux文件与管理(还是多记)
  15. android水下气泡,科学网—水下爆炸气泡的基本现象及规律 - 黄超的博文
  16. oracle 计算母亲节日期,致母亲节:云和数据 一个满满是爱的地方
  17. Visual C++网络编程经典案例详解 第9章 实用播放器 编程基础 播放mp3文件 读取文件
  18. java 公历 农历_java中怎么把公历日期转成农历日期
  19. 直播延时是如何产生的?4G摄像头无插件播放视频流媒体服务器EasyDSS超低延时直播的实现方案
  20. 十进制100转换成八进制是多少?

热门文章

  1. 嵌入式AI-K210篇-硬件-模型训练、部署
  2. XGBoost详解(原理篇)
  3. 基于Python的统计建模
  4. latex/texlive行超出正文(间)公式或文字超出。
  5. tar解压tgz文件出现gzip: stdin: not in gzip format报错问题
  6. java 文件夹下的文件_java读取某个文件夹下的所有文件
  7. carplay_如何更改您的CarPlay壁纸
  8. 基于51单片机的多功能电子万年历设计(LCD12864+DS1302+DS18B20)
  9. 程序员最该买的十本书
  10. thinkphp5常用函数汇总_(thinkPHP)PHP常用函数大全