OpenCV in arm and x86 in the transplant

Source: Internet
Author: User
Tags gtk

One, development environment

Operating system:FEDORA14

OPENCV Version number:2.0

Qt Version number:4.7

Arm:mini6410

Cross-compilation tool:arm-linux-gcc-4.5.1

Second, installation and configuration

Installation of the Linux system, Cross - qt-creator Installation and cross-compiler tool installation, the basic online said that there is no problem, after testing can be used.

Install qt-creator mini6410 The installation method on the development manual is too complicated. With qtsdk-offline-linux-x86-v1.2.1.run installation is convenient and accurate.

This article will focus on how to install OPENCV to Linux , and configure OPENCV to QT . x86 and arm platforms can now execute QT+OPENCV GUI smoothly . Program. For the future to do embedded pattern recognition to build a high-speed and convenient platform.

Here's the installation I am the OPENCV Chinese network (this site found very reliable)

http://wiki.opencv.org.cn/index.php/%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91

Opencv2.0:

1. Unzip the file:

#tar ZXVF opencv-2.0.0.tar.gz

#cd opencv-2.0.0

2. Check the software configuration

#./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=g++ CPPFLAGS=-I/opt/FriendlyARM/ Toolschain/4.5.1/arm-none-linux-gnueabi/include LDFLAGS=-L/OPT/FRIENDLYARM/TOOLSCHAIN/4.5.1/ Arm-none-linux-gnueabi/lib--with-v4l2--PREFIX=/OPT/X86/OPENCV--libdir=/opt/x86/opencv/lib-includedir=/opt/x86/ Opencv/include

If you are prompted to have the required software not installed, please install and then execute the ./configure command. Until you are prompted with "now run make ..." .

Note: Configure files have been omitted from the opencv2.2 . Can be installed through the CMake, the test http://www.samontab.com/web/2010/04/ installing-opencv-2-1-in-ubuntu/

3. Compiling Opencv

#make

4, installation OPENCV

#make Install

5. Update the dynamic link library

run the following operation with the root user

Add path /usr/local/lib to file /etc/ld.so.conf. Then execute the command .

#ldconfig

6. Test installation package (under sample/c )

g++ ' pkg-config opencv--libs--cflags OpenCV ' Drawing.c-o drawing

There is an issue where the path cannot be found, with detailed errors such as the following:

Package OpenCV is not found in the Pkg-config search path.

Perhaps you should add the directory containing ' opencv.pc '

To the PKG_CONFIG_PATH environment variable

No package ' OpenCV ' found

Package OpenCV is not found in the Pkg-config search path.

Perhaps you should add the directory containing ' opencv.pc '

To the PKG_CONFIG_PATH environment variable

No package ' OpenCV ' found

There are many ways to solve this problem, which is the path setting.

Here I add the following path to the/ROOT/.BASHRC file, for example, to compile the

Export pkg_config_path=/opt/ x86 /opencv/lib/pkgconfig: $PKG _config_path

In this compile test example, run the command after success:

#./drawing

can also test other uses such as:

CD samples/c
chmod +x build_all.sh
./build_all.sh
./facedetect--cascade= "/usr/local/share/opencv/haarcascades/haarcascade_frontalface_alt.xml"--scale=1.5 Lena.jpg

The above is the configuration installation of x86 version OpenCV

The following is a configuration installation of the arm version of OpenCV

Export Pkg_config_path=/opt/arm/opencv/lib/pkgconfig: $PKG _config_path

The first step, the configuration of the configure

./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/ Friendlyarm/toolschain/4.5.1/arm-none-linux-gnueabi/include LDFLAGS=-L/OPT/FRIENDLYARM/TOOLSCHAIN/4.5.1/ Arm-none-linux-gnueabi/lib--with-v4l2--PREFIX=/OPT/ARM/OPENCV--libdir=/opt/arm/opencv/lib-includedir=/opt/arm/ Opencv/include

Step two, compile

Make

An example of the following error has occurred:

.. /3RDPARTY/.LIBS/LIB_CLAPACK.A (DLASYF.O): Could not read symbols:file in wrong format

Workaround: Delete 3rdparty/.libs/lib_clapack.a this file, Make clean and then restart make compilation.

Step three, install

Make install

After a successful installation. Very many files are generated under the /opt/arm/opencv/lib and /opt/arm/opencv/include folders.

Fourth step, test

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

Porting opencv2.0 to arm execution ./show-arm lena.jpg Error:

OpenCV error:unspecified Error (the function is not implemented. Rebuild the library with Windows, GTK + 2.x or Carbon support. If you is on Ubuntu or Debian,

Install Libgtk2.0-dev and Pkg-config, then re-run cmake or configure script) in

Cvnamedwindow, file highgui/window.cpp, line 100

This shows that the OpenCV Library can be called for algorithmic operation. There is simply no GUI platform to use. Below I try to use QT as the platform to get the video.

Blogger of this article: http://blog.csdn.net/noodies/article/details/5798434

In the answer for the Netizen said that use is v412 do the video capture, and then use OpenCV for image processing. The last action framebuffer shows the processing results (I have not tried here.) Feeling qt should be more convenient)

This article says that GTK should be installed before OpenCV :http://lovelittlebean.blog.163.com/blog/static/ 11658218620125911268437/

I used the fedora14, did not install gtk, but executed

#pkg-config--modversion gtk+-2.0

Be able to find my GTK version number.

#pkg-config--cflags--libs gtk+-2.0

Ability to view GTK compile and link information

Here is the "source code installation GTK" blog:http://os.it168.com/a2008/0828/984/000000984646.shtml

There's so much to find out. What's the use of GTK, which is mentioned in the following blog post

http://blog.csdn.net/yanzi1225627/article/details/7524698

There's the word GTK and so on. But do not know what the meaning, how to solve and then write to the QT configuration. So I'm going to configure QT first, and here's the QT configuration. My blog post is:

Http://blog.chinaunix.net/uid-24641004-id-3459705.html

Then I knew that GTK was actually a GUI.

Do OPENCV open the camera, do not know whether the blogger's QT version number is not the same or write leaks. when executing the prompt Qdebug to use the error , find the code F1 into the function document, found missing its header file include <qtdebug>, plus OK.

also tip. Pro can not find lib**.so library , go in to view the discovery configuration when there is a blank line, meaning that libs+= Lib library to add a number of lines must be added "\". I have one more blank line.

When executed, the "error!" appears

See the code in this is Qdebug error alert, I directly changed to "Error:can not open camero!".

This will be at a glance.

The solution, of course, is to insert the camera.

In the compilation execution, the avatar appears


Here's how to migrate to arm .

Change . Pro for arm version of the header files and library files to compile their own small programs, which were generated before the build, I used x86 and arm differentiated.

Compile again, and then copy to the board to execute.

The headache happened. a segmentation fault segment error occurred . Trouble, Solution Blog

Http://www.cnblogs.com/s_agapo/archive/2011/11/24/2262346.html

There are a few mentions, but not for my program. He was just a picture of a qt - brought load function replaced with OpenCV 's loadimage.

Last in the blog:

http://blog.csdn.net/yanzi1225627/article/details/8215695

In the comments mentioned, a baby girl told him to set capture = cvcreatecameracapture ( -1) in 1 to 202 OK , try the next really can, altogether success. It is not yet known what the meaning of 202 stands for.

The results of the execution are as follows:

Until now. Found that the basic has been transferred to the entire platform of the environment to build.

Here's an attempt to use his algorithm to do a personal face check.

Also encountered some problems such as:

Compile the QT program for the x86 version number . No problems with execution. However , when compiling the QT program for the arm version number . error error:main.o:relocations in generic ELF (em:3)

Workaround: Go to the project folder and run makeclean, and the compilation will be OK .

There's also a cvwaitkey (0) error , which I guess might be a bit of a problem with this function on the arm platform, and I stare because it's just a wait function. The final execution was successful, but the video became a bit of a card. Not as smooth as under the x86 , is the reason I stare at Cvwaitkey , and continue to optimize.

Paste the result Picture:

Here to raise their own questions, hope that the fate of the assumption of the conquest can tell me. At the beginning I was installing the Opencv2.4.2 version number, after installation, write a simple OPENCV program to cross-compile, but always compile not through (here the installation of the library: Http://wenku.baidu.com/link?url= Wj9y2srglzlvskgn2m6yyg89vu9ym16akmcx18lxo8ii8ya6kloaxfeq1zsay4qnilqjzogvb6yta6ij0nidp6yynge9icqpqs_thxncnlm )

porting opencv2.4.2 when compiling arm programs

arm-linux-g++-o opencv_test opencv_test.cpp-i/usr/local/arm/opencv/include/opencv-l/usr/local/arm/opencv/lib- Lopencv_core-lopencv_highgui

An error such as the following occurs:

/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/. /.. /.. /.. /arm-none-linux-gnueabi/bin/ld:warning:.. /.. /lib/libcxcore.so, needed by/usr/local/arm/opencv-2.1/lib/libcv.so, not found (try Using-rpath or-rpath-link)
/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/. /.. /.. /.. /arm-none-linux-gnueabi/bin/ld:warning:.. /.. /lib/libcv.so, needed by/usr/local/arm/opencv-2.1/lib/libcvaux.so, not found (try Using-rpath or-rpath-link)
/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/. /.. /.. /.. /arm-none-linux-gnueabi/bin/ld:warning:.. /.. /lib/libhighgui.so, needed by/usr/local/arm/opencv-2.1/lib/libcvaux.so, not found (try Using-rpath or-rpath-link)
/usr/local/arm/4.3.2/bin/. /lib/gcc/arm-none-linux-gnueabi/4.3.2/. /.. /.. /.. /arm-none-linux-gnueabi/bin/ld:warning:.. /.. /lib/libml.so, needed by/usr/local/arm/opencv-2.1/lib/libcvaux.so, not found (try Using-rpath or-rpath-link)

Read the author's blog here:http://blog.csdn.net/yanzi1225627/article/details/7524698. Found that he met with my similar problems, and tried a variety of ways also failed to solve, and finally I also like him to give up the road of Opencv2.4.2. Turn to Opencv2.0. It also tried the solution he offered, and Kauboven:http://blog.sina.com.cn/s/blog_602f87700100nyda.html

In cross-compilation, Lflags-L was replaced with-WL,-RPATH-LINK-WL, and the problem was found to be missing. But altogether showed up. So the library file, I also have no words, this has been solved before the problem came back, copy the library also set the path, the old problem appeared again, was beaten back ten years ago feeling very painful.

Arm-none-linux-gnueabi missing This library, copy the past can be. Found no, and this article Kunima is copied before several bloggers of the article, the original text does not move. I don't know if I've ever tried.

There's no way to just give up Opencv2.4.2.

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

OpenCV in arm and x86 in the transplant

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.