Work has settled down, and recently began to prepare for completion, I completed the topic is based on the UAV's identification and tracking of the human body, so it is bound to involve the use of OPENCV image processing, I was developed on Ubuntu, due to the final load on the embedded device, so the use of QT compilation environment , so it's easy to transplant. Words don't say much, step by step.
1. Installation configuration of OpenCV
First make sure you have the following software installed under Ubuntu, if not directly apt-get install,
Build-essential, Libgtk2.0-dev, Libavcodec-dev, Libavformat-dev, Libjpeg62-dev, Libtiff4-dev, CMake, Libswscale-dev, Libjasper-dev
First to download OpenCV source, download address: Http://sourceforge.net/projects/opencvlibrary/files/?source=navbar
I downloaded the opencv-3.0.0.zip version, should be the latest bar, and then directly unzip decompression, and then CMake, then make, and finally in/etc/ld.so.conf.d/opencv.conf (no words to create a) behind add
/usr/local/lib, then Ldconfig, finally added in/ETC/BASH.BASHRC file
Pkg_config_path= $PKG _config_path:/usr/local/lib/pkgconfig
export Pkg_config_path
At this point, OPENCV installation is complete.
2. QT Installation Configuration
Qt I was under the direct installation version, Qt-opensource-linux-x64-5.5.0.run, command line chmod +x Qt-opensource-linux-x64-5.5.0.run, and then. Qt-opensource-linux-x64-5.5.0.run can be installed directly. Because it is installed automatically, it will give you all the configuration. Note that after installation, in the tools-"options-" QT Versions See if you install QT in the directory of the Qmake, generally with the automatic detection of the
3. Use QT to create my first project
Note: To create a console project, it is best to create the project under/TMP or/~, or you will find that the project creation was unsuccessful.
The first small test code is as follows:
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/ highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace CV;
int main (int argc, char *argv[])
{
qcoreapplication A (argc, argv);
Namedwindow ("src", window_autosize);
Mat Src1 = Imread ("/tmp/untitled/lena.jpg");
Imshow ("src", src1);
return a.exec ();
}
Then note that you need to associate the OPENCV header and library files with Qt and add the following code after the **.pro of the project:
Includepath + =/usr/local/include \
/usr/local/include/opencv \
/usr/local/include/opencv2
LIBS + =/usr/ local/lib/libopencv_highgui.so \
/usr/local/lib/libopencv_core.so \
/usr/local/lib/libopencv_ imgproc.so \
/usr/local/lib/libopencv_imgcodecs.so
Note the point:
1. libopencv_imgcodecs.so also need to be linked, may be somewhat different from version 2.x
2. Lena.jpg path is best to write full, that is, written in absolute path format, otherwise it may be error, I first did not put in the same directory with the CPP file, and then placed under the same directory, but the final error:
OpenCV Error:assertion failed (size.width>0 && size.height>0) in imshow,file/home/worldhope/ Opencv-3.0.0/modules/highgui/src/window.cpp line:271
Finally, all errors are eliminated and the results are as follows:
So far, the development environment has been built