QT configuration openni, opencv, g2o and pcl library

Original: https://blog.csdn.net/Jasmine_shine/article/details/50973748

Configure the environment: ubuntu12.04 + QT4.8 
one: Make sure openni, opencv, g2o and pcl libraries have been installed. 
openni: openni is kinect library, my equipment is mainly Asus xtion pro live, so installation is openni1 library, although now out openni2. To drive this camera, install a driver plus two main ni nite and libraries. Specific Installation Reference: http: //blog.csdn.net/jasmine_shine/article/details/46235911.

opencv: opencv computer vision is the most common of a library, installation more than that, I installed the opencv2.4.9, said that this library is that we often use.

g2o: g2o map is optimized for a library, it slam mainly used to solve the problem. Download g2o compile, download URL in github: https: //github.com/RainerKuemmerle/g2o. First of all you want to install g2o dependent libraries, g2o dependent libraries have csparse, eigen library, csparse mainly for solving sparse matrix, eigen mainly for solving linear algebra. Specific explanation can refer to lay idle half of the article: http: //www.cnblogs.com/gaoxiang12/p/4739934.html. 
Installation dependencies:

sudo apt-get install libeigen3-dev libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-qt4-dev

installed g2o: 
enter g2o catalog:

Build mkdir
CD Build 
CMake ..
the make
the sudo the make the install

PCL: PCL library is a point cloud, for displaying three-dimensional information. Pcl seems simple installation in ubuntu, apt-get install as follows:

the Add-APT-Repository sudo ppa: Launchpad-v-Jochen-de-sprickerhof / PCL
sudo APT-GET Update
sudo install libpcl APT-GET-All

II: Create a new empty QT project will generate project files, including .pro file. Note that the configuration of the various libraries is performed in the .pro file. 
Make sure the QT build environment, I installed the QT4.8 version can be installed in the ubuntu software center. 
openni, configuration opencv, g2o and pcl library as follows:

SOURCES += \
    main.cpp

######c++11######
QMAKE_CXXFLAGS += -std=c++11

INCLUDEPATH +=      /usr/local/include \
                    /usr/local/include/opencv \
                    /usr/local/include/opencv2 \
######openni######
                    /usr/include/ni \
                    /usr/include/nite \
###### g2o ########
                   /usr/local/include/g2o \
######eigen3#####
                    /usr/include/eigen3 \
######sparse#####
                    /usr/include/suitesparse  \
###### pcl ########
                    /usr/include/pcl-1.7  \
                    /usr/include/pcl-1.7/pcl  \
                    /usr/include/pcl-1.7/pcl/common  \
                    /usr/include/pcl-1.7/pcl/io  \
###### boost ######
                    /usr/local/include/boost \
                  #  /usr/local/include/EXTERNAL/csparse \

LIBS +=     /usr/local/lib/libopencv_highgui.so \
            /usr/local/lib/libopencv_core.so    \
            /usr/local/lib/libopencv_imgproc.so  \
            /usr/lib/libXnVNite_1_5_2.so  \
            /usr/lib/libOpenNI.so   \
######g2o###########
            /usr/local/lib/libg2o_cli.so  \
            /usr/local/lib/libg2o_core.so  \
            /usr/local/lib/libg2o_stuff.so  \
            /usr/local/lib/libg2o_types_slam2d.so  \
            /usr/local/lib/libg2o_types_slam3d.so  \
            /usr/local/lib/libg2o_solver_cholmod.so  \
            /usr/local/lib/libg2o_solver_csparse.so  \
            /usr/local/lib/libg2o_csparse_extension.so  \
csparce ####### #######
            /usr/lib/libcxsparse.so \
####### the Boost ######
# /usr/local/lib/libboost_filesystem.so \
             /usr/local/lib/libboost_system.so \
####### PCL #####
            /usr/lib/libpcl_common.so.1.7 \
            /usr/lib/libpcl_io.so.1.7 \
            / usr / lib /libpcl_io_ply.so.1.7 \

Note that, in the process of writing, .pro file is not a blank line, otherwise there will be similar to the sparse error: usr / local / * this error. In addition, g2o dependent libraries have csparse and eigen library, so they will have to add these two libraries come in, otherwise g2o also can not find the library, causes the compiler is not passed. And pcl library dependencies boost the system library, be sure to add this library, otherwise the compilation process will prompt: This error is similar to generic_system not be found.

Highlights 
the day before yesterday added these all include and lib, the program can be compiled normally, the next day will not compile, there has been a series of mistakes, many, many, there are thousands. Then the relevant pcl the first comment out, step by step investigation and why. It was found that openni and pcl seem to conflict, can only compile openni, pcl then try to remove the comment, and then compilation step by step, he has returned to normal.

III. Testing 
testing program lay mainly with reference to semi-free program to do a series together, has been tested and available.
 

Released seven original articles · won praise 13 · views 20000 +

Guess you like

Origin blog.csdn.net/xingsongyu/article/details/104053582