◆ (Compile in Ubuntu ):
Install the dependency Library: sudo apt-Get install build-essential manpages-dev PKG-config
Install libpng:
Sudo apt-Get install zlib1g-dev
Sudo wget http://downloads.sourceforge.net/libpng/libpng-1.2.18.tar.gz? Modtime = 1179259677 & big_mirror = 0
Sudo tar-xvzf libpng-1.2.18.tar.gz
CD libpng-1.2.18
Sudo./configure -- prefix =/usr/local/libpng
Sudo make
Sudo make install
Install libjpeg libz in the same way
Note: If the error "/usr/bin/install: the common file"/usr/local/libjpeg/bin/cjpeg "cannot be created: This file or directory does not exist" appears, this is because you cannot create related directories. You must manually create sudo mkdir-P/usr/local/libjpeg/bin/cjpeg here.
◆. /Configure -- Host = arm-None-Linux-gnueabi -- without-GTK -- without-carbon -- without-QuickTime -- without-1394libs -- without-FFMPEG -- without-Python -- without-swig -- enable -Static -- disable-shared -- disable-apps cxx = arm-None-Linux-gnueabi-G + + cppflags =-I/usr/arm-2008q3/ARM-None-Linux-gnueabi/ include -- prefix =/usr/opencv
Note:
-- Host = arm-Linux: indicates the cross-compiling ARM platform.
-- Without-GTK: Ignore GTK + 2.0 windows
-- Without-carbon: Do not use the X library on Mac OS
-- Without-QuickTime
Without-1394libs
-- Without-FFMPEG
-- Without-Python
-- Without-swig
-- Enable-static: generate static library
-- Disable-shared: do not generate dynamic library
Cxx = armv4l-unknown-linux-g ++: Specifies the compilation tool (2.95.2 or 2.95.3 is recommended)
Cppflags =-I/usr/include: opencv will use some Dev packages, such as PNG. h and unzip Lib. H. Most of the header files are under/usr/include.
Make
Make install
◆ Export pkg_config_path = $ pkg_config_path:/usr/opencv/lib/pkgconfig
Then, add the-lpthread and-LDL parameters to the libs item of/usr/opencv/lib/pkgconfig/opencv. PC as needed, such
Libs:-L $ {libdir}-LCV-lcxcore-lcvaux-lpthread-LRT-lm-lpng-ljpeg-LZ-lm-LDL
◆ Clear compiled intermediate files and compiled files:
# Make clean
# Make distclean
◆ Compilation routine drawing. c
Armv4l-unknown-linux-g ++ 'pkg-config -- cflags -- libs opencv 'drawing. C-o drawing
Or try (in some cases, order problems may cause an undefined reference error)
Arm-Linux-G ++ drawing. C-o drawing 'pkg-config -- cflags -- libs opencv'
Or execute
Arm-Linux-G ++ drawing. c-o drawing-I/usr/opencv/include/opencv-L/usr/opencv/lib-LCV-lcxcore-lpthread-LRT-lcvaux-lm-lpng-ljpeg-LZ -lml-lhighgui-LDL
Note: compiled hereProgramBecause GTK support is not added, it cannot be run on arm. However, it can be executed by removing the display function and re-compiling. On the opencv Chinese Forum, some people say that vcreateimage cannot be connected, but I can test the results. In highgui, some non-display functions can be called.
◆ Ldconfig is missing because/sbin is not included in the System Path. Add it on your own.
Export pkg_config_path = $ pkg_config_path:/usr/opencv/lib/pkgconfig
◆ If the libstdc ++ library is missing, you can find it in the lib directory under the arm compiler directory, copy it to the Development Board, and ensure that the program can be found.
◆ Camera driver
Taking the mesh v2000 I used as an example, the kernel option is added to the ov511 driver and the module is loaded. The default device in the opencv program is/dev/video0. You can call the cvcapturefromcam function in the program to directly obtain the camera and collect images.
Display: The display driver function is called directly in the area to be displayed.
Author
Tan discipline, graduate of Dalian University of Technology, email: xueketan@student.dlut.edu.cn Shiqi Yu
Reference: opencv Chinese Forum