Environment: CB A10 + lubuntu1.05 + opencv2.6.4.1
Preparation: More than 2G free space. Compile directly on CB, cross compile see also: Matson tips for porting Qt and OPENCV to do image processing arm-linux-gnueabihf- To use hard floating-point compiler (note: I did not do cross compilation, because direct compilation succeeded.) But on the CB directly compiled I have waited a full 2 hours before compiling, visible speed, of course, this and I on the SD card compiled also related. SD card only 1.8G, decisively put my pit well miserable, compile to 93% when the space is insufficient, fortunately cmake and make have memory function, I copy the corresponding file to 4G u disk, mount to the same directory, directly from 93% start to compile, is not very pit. )
Personal Download Address: opencv2.6.4.1 Official Download Address: lubuntu1.05 + OPENCV
The main process is as follows: 1. Installation of OPENCV-related packages and tools 2. Make && sudo make install 3. Gcc-ggdb ' pkg-config--cflags opencv '-o opencv0 opencv0.c ' pkg-config--libs ' OpenCV '
1. Installation of OPENCV-related packages and tools: Install.sh #!/bin/bash Apt-get Install Build-essential-y Apt-get Install Cmake-y Apt-get Install Pkg-config-y Apt-get Install libpng12-0 Libpng12-dev libpng++-dev libpng3-y Apt-get Install Libpnglite-dev Libpngwriter0-dev libpngwriter0c2-y Apt-get Install zlib1g-dbg zlib1g zlib1g-dev-y Apt-get Install Libjasper-dev libjasper-runtime libjasper1-y Apt-get Install Pngtools Libtiff4-dev libtiff4 libtiffxx0c2 Apt-get Install Libjpeg8 Libjpeg8-dev libjpeg8-dbg libjpeg-prog-y Apt-get Install ffmpeg libavcodec-dev libavcodec52 libavformat52 Apt-get Install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev-y Apt-get Install Libxine1-ffmpeg Libxine-dev libxine1-bin-y Apt-get Install LIBUNICAP2 libunicap2-dev-y Apt-get Install Libdc1394-22-dev libdc1394-22 libdc1394-utils-y Apt-get Install Swig-y Apt-get Install libv4l-0 libv4l-dev-y Apt-get Install Python-numpy-y Apt-get Install Libgtk2.0-deb-y Apt-get Install Libavformat-dev libswscale-dev-y ##### #you can not install follow Pakage if you donot need. Apt-get Install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake Python-dev Python-numpy python-tk <font color= "Red" >libtbb-dev</font> Libeigen2-dev yasm Libfaac-dev Libopencore-amrnb-dev libopencore-amrwb-dev Libtheora-dev Libvorbis-dev libxvidcore-dev Libx264-dev Libqt4-opengl-dev Sphinx-common Texlive-latex-extra Libv4l-dev libdc1394-22-dev Libavcodec-dev Libswscale-dev-y Apt-get Install libpython2.6 Python-dev python2.6-dev-y # only if your want to use Python copy code (note: Some software cannot be found, such as libtbb-de in options V, there are a few software is not installed, but does not affect the use of, does not matter. Careful people will find that the previous part is the official request, the latter part of the Internet disorderly search and installation. Because the installation of OpenCV did not install before libgtk2.0-deb, so a large outfit, again reload, decisive no longer fail) sudo chmod +x install.sh sudo./install.sh
2. Make && sudo make install: $ cmake CMakeLists.txt $ make && sudo make install $ sudo leafpad/etc/ld.so.conf /usr/local/lib #add in the last line. $ ldconfig Copy Code (note: in the appropriate directory to execute the corresponding command, decompression OpenCV. After xx, CD to OpenCV. XX, and then execute a series of commands above, pay attention to your disk format, to support the link Oh, otherwise only formatted into other forms, I use the EXT4 format, detection can use the command: Ln-s Filenamea filenameb; Modify/etc/ld.so.conf is to add OpenCV library to the system path, or you will not find the xxx.so error, OPENCV default installation to/usr/local/lib, which can be seen from the sudo make install output, remember to save the output , out of the wrong convenient google \ Baidu \ Forum)
3. Gcc-ggdb ' pkg-config--cflags opencv '-o opencv0 opencv0.c ' pkg-config--libs ' OpenCV ' (Note: The above is the C language compiler command, you can also use the C++,OPENCV source code package with some examples, the compiler command is found from the inside, the online compilation commands are mostly not available.) The point above is ', in the number key 12345 row, above the tab, under ESC. can also be copied directly when used. OPENCV0.C is a look at the picture of the program, how to deal with the picture. Run:./OPENCV0.C opencv1.bmp VIDEO0.C is a camera using the program, lubuntu1.05 with the driver, the official support of the USB camera should be able to use, I used the HuanYu flying V6. Run./video0)
opencv0.c #include "stdlib.h" #include "stdio.h" #include "math.h" #include "Cv.h" #include "highgui.h" int main (int argc, char *argv[]) { iplimage* img = 0; IPL (Intel image processing Library) image header int height, width, step, channels; uchar* data; int I, j, K; if (ARGC < 2) { printf ("usage:main<image-file-name>\n\7"); Exit (0); } Load picture img = cvloadimage (argv[1],0); if (!img) { printf ("Could not load image file:%s\n", argv[1]); Exit (0); } Get Image data Height = img->height; width = img->width; Step = img->widthstep; Channels = img->nchannels; data = (uchar*) img->imagedata; printf ("Processing a%d x%d image with%d channels\n", height, width, channels); Create a form Cvnamedwindow ("Mainwin", cv_window_autosize); Cvmovewindow ("Mainwin", 100, 100); Flip Image for (i = 0; i < height; i++) { for (j = 0; J < width; j + +) { for (k = 0; k < channels; k++) { Data[i * Step + j * Channels] = 255-data[i * Step + J * channels + K]; } } } displaying images Cvshowimage ("Mainwin", IMG); Wait for an arbitrary key Cvwaitkey (0); Releasing images Cvreleaseimage (&IMG); return 0; } Copy code VIDEO0.C//#include "stdafx.h" #include "Cv.h" #include "highgui.h" #include "stdio.h" Realize that the picture will be scaled one times iplimage* Dopyrdown (iplimage* image) { Set the size to be one times smaller Cvsize size = cvsize (IMAGE->WIDTH/2,IMAGE->HEIGHT/2); Initializing a picture iplimage* outimage = Cvcreateimage (size,image->depth,image->nchannels); Implementing scaling Cvpyrdown (image,outimage,cv_gaussian_5x5); Cvreleaseimage (&image); return outimage; }; int main (int argc, char** argv) { Cvnamedwindow ("Vedio", 0); cvcapture* capture; The first is to get a Cvcapture object from the camera device. if (1 = argc) { Capture = cvcreatecameracapture (0); } Else { Capture = Cvcreatecameracapture (Atoi (argv[1)); } ASSERT (NULL!= capture); iplimage* frame; Char keycode; Capture video Images every 30ms
|