Currently I am making a project on recognizing human actions using Kinect. Since I work in Ubuntu and I need the skeleton information, I choose openNI and NITE. I want to use Qt to create a GUI application, but I don't know how to integrate openNI in Qt. All the samples of openNI and NITE run well, but I failed to build any of them in Qt creator. I really hope anyone can help me on this(Say how to build NiUserTracker in Qt creator). I will also apriciate it if anyone can give some sample Qt projects.
I have tried to build NiUserTracker in Qt creator:
Content of .pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
INCLUDEPATH += /home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Include
SOURCES += main.cpp \
SceneDrawer.cpp \
opengles.cpp
HEADERS += \
SceneDrawer.h \
opengles.h
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/release/ -lnimCodecs
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/debug/ -lnimCodecs
else:symbian: LIBS += -lnimCodecs
else:unix: LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/ -lnimCodecs
INCLUDEPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
DEPENDPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/release/ -lnimMockNodes
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/debug/ -lnimMockNodes
else:symbian: LIBS += -lnimMockNodes
else:unix: LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/ -lnimMockNodes
INCLUDEPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
DEPENDPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/release/ -lnimRecorder
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/debug/ -lnimRecorder
else:symbian: LIBS += -lnimRecorder
else:unix: LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/ -lnimRecorder
INCLUDEPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
DEPENDPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/release/ -lOpenNI
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/debug/ -lOpenNI
else:symbian: LIBS += -lOpenNI
else:unix: LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/ -lOpenNI
INCLUDEPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
DEPENDPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/release/ -lOpenNI
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/debug/ -lOpenNI
else:symbian: LIBS += -lOpenNI
else:unix: LIBS += -L$$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib/ -lOpenNI
INCLUDEPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
DEPENDPATH += $$PWD/../../../../../../../../../../home/myname/Kinect/OpenNI-Bin-Dev-Linux-x86-v1.5.4.0/Lib
I have added the inlcude path of openNI and libs, however when I built the program, it shows:
SceneDrawer.o: In function `initTexture(void**, int&, int&)':
SceneDrawer.cpp:(.text+0x45): undefined reference to `glGenTextures'
SceneDrawer.cpp:(.text+0x9c): undefined reference to `glBindTexture'
SceneDrawer.cpp:(.text+0xb8): undefined reference to `glTexParameteri'
SceneDrawer.cpp:(.text+0xd4): undefined reference to `glTexParameteri'
SceneDrawer.o: In function `DrawRectangle(float, float, float, float)':
SceneDrawer.cpp:(.text+0x144): undefined reference to `glVertexPointer'
SceneDrawer.cpp:(.text+0x160): undefined reference to `glDrawArrays'
SceneDrawer.cpp:(.text+0x165): undefined reference to `glFlush'
SceneDrawer.o: In function `DrawTexture(float, float, float, float)':
SceneDrawer.cpp:(.text+0x19b): undefined reference to `glEnableClientState'
SceneDrawer.cpp:(.text+0x1bf): undefined reference to `glTexCoordPointer'
SceneDrawer.o: In function `glPrintString(void*, char*)':
SceneDrawer.cpp:(.text+0x22f): undefined reference to `glutBitmapCharacter'
SceneDrawer.o: In function `DrawLimb(unsigned int, XnSkeletonJoint, XnSkeletonJoint)':
SceneDrawer.cpp:(.text+0x24c): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x306): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x3da): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x488): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x5ab): undefined reference to `g_DepthGenerator'
SceneDrawer.cpp:(.text+0x5ef): undefined reference to `glVertex3i'
SceneDrawer.cpp:(.text+0x62b): undefined reference to `glVertex3i'
SceneDrawer.cpp:(.text+0x65a): undefined reference to `g_UserGenerator'
SceneDrawer.o: In function `drawCircle(float, float, float)':
SceneDrawer.cpp:(.text+0x7e0): undefined reference to `glBegin'
SceneDrawer.cpp:(.text+0x841): undefined reference to `glVertex2f'
SceneDrawer.o: In function `DrawJoint(unsigned int, XnSkeletonJoint)':
SceneDrawer.cpp:(.text+0x869): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x91d): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x9d2): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0xabf): undefined reference to `g_DepthGenerator'
SceneDrawer.o: In function `DrawDepthMap(xn::DepthMetaData const&, xn::SceneMetaData const&)':
SceneDrawer.cpp:(.text+0xdb7): undefined reference to `g_bDrawPixels'
SceneDrawer.cpp:(.text+0xf0c): undefined reference to `g_bDrawBackground'
SceneDrawer.cpp:(.text+0xf85): undefined reference to `glBindTexture'
SceneDrawer.cpp:(.text+0xfd4): undefined reference to `glTexImage2D'
SceneDrawer.cpp:(.text+0xff8): undefined reference to `glColor4f'
SceneDrawer.cpp:(.text+0x1004): undefined reference to `glEnable'
SceneDrawer.cpp:(.text+0x1052): undefined reference to `glDisable'
SceneDrawer.cpp:(.text+0x108f): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x10d1): undefined reference to `g_bDrawSkeleton'
SceneDrawer.cpp:(.text+0x10f4): undefined reference to `g_bPrintID'
SceneDrawer.cpp:(.text+0x1107): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x1114): undefined reference to `g_DepthGenerator'
SceneDrawer.cpp:(.text+0x115b): undefined reference to `g_bPrintState'
SceneDrawer.cpp:(.text+0x11d6): undefined reference to `glColor4f'
SceneDrawer.cpp:(.text+0x1210): undefined reference to `glRasterPos2i'
SceneDrawer.cpp:(.text+0x121b): undefined reference to `glutBitmapHelvetica18'
SceneDrawer.cpp:(.text+0x1225): undefined reference to `g_bDrawSkeleton'
SceneDrawer.cpp:(.text+0x1233): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x1348): undefined reference to `glColor4f'
SceneDrawer.cpp:(.text+0x134e): undefined reference to `g_bMarkJoints'
SceneDrawer.cpp:(.text+0x1362): undefined reference to `glBegin'
SceneDrawer.cpp:(.text+0x154b): undefined reference to `glEnd'
SceneDrawer.cpp:(.text+0x155a): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x187a): undefined reference to `g_UserGenerator'
SceneDrawer.cpp:(.text+0x1b02): undefined reference to `g_bPrintFrameID'
SceneDrawer.cpp:(.text+0x1b87): undefined reference to `glColor4f'
SceneDrawer.cpp:(.text+0x1b9b): undefined reference to `glRasterPos2i'
SceneDrawer.cpp:(.text+0x1baa): undefined reference to `glutBitmapHelvetica18'
SceneDrawer.o: In function `DrawTexture(float, float, float, float)':
SceneDrawer.cpp:(.text+0x1f3): undefined reference to `glDisableClientState'
SceneDrawer.o: In function `drawCircle(float, float, float)':
SceneDrawer.cpp:(.text+0x854): undefined reference to `glEnd'
collect2: ld returned 1 exit status
I guess it is because the glut libs are not included. However both libs are .lib files, which seems cannot be added in Qt creator....
Thank you very much!
did you tried to use openNI with openCV + qt support?
another soluction is this.
http://develnoter.blogspot.com.br/2012/05/integrating-opencv-in-qt-gui.html
Related
I've the following error during Qt compiling phase :
In file included from ../test_ble2/main.cpp:12:
/opt/fsl-imx-xwayland/5.10-hardknott/sysroots/cortexa53-crypto-poky-linux/usr/include/glib-2.0/glib.h:30:10: fatal error: glib/galloca.h: No such file or directory
30 | #include <glib/galloca.h>
compilation terminated.
make: *** [Makefile:723: main.o] Error 1
looking for *.h and I found it on the board so the problem seems in *.pro file :
QT += quick
LIBS += -lbluetooth
LIBS += -lpython3
LIBS += -llibglib-2.0
SOURCES += \
main.cpp
RESOURCES += qml.qrc
QML_IMPORT_PATH =
QML_DESIGNER_IMPORT_PATH =
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
packagesExist(glib-2.0) {
CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0
}
HEADERS += \
include/gattlib.h
unix:!macx: LIBS += -L$$PWD/lib/ -lgattlib
INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include
but I' dont fix it, any suggestion?
The platform is yocto form imx8.
Any suggestion? Thanks in advance
I made a muparser.pri which had the following content,
macx|win32|equals(build_muparser, "true")|!packagesExist(muparser){
message("Using bundled muparser")
MUPARSER_DIR = src/rel/muparser
DEPENDPATH += $$MUPARSER_DIR/include \
$$MUPARSER_DIR/src
INCLUDEPATH += $$MUPARSER_DIR/include
GEN_LIB_DIR = ../../generated/lib
LIBS += -L$$GEN_LIB_DIR -lmuparser
PRE_TARGETDEPS += $$GEN_LIB_DIR/libmuparser.a
}else{
message("Using external muparser")
CONFIG += link_pkgconfig
PKGCONFIG += muparser
}
I, then, added a
include(./muparser.pri)
in my application's make file.
This gave me an error
":-1: error: No rule to make target '../../generated/lib/libmuparser.a', needed by 'debug/Akaar1.exe'. Stop."
What did I do wrong? How else am I supposed to include this library in my project?
In your .pro file you can do:
LIBS += -L*path to the library* -l*library name: foo for libfoo.a*
Is there a way to use the HockeySDK within a Qt application? I made a basic test trying to import your framework into my project adding these lines to my profile:
# test.pro
LIBS += -F/Applications/HockeyApp.app/Contents/Frameworks -framework HockeySDK
OBJECTIVE_SOURCES += hockey.m
With the following code:
// hockey.m
#include <HockeySDK/HockeySDK.h>
void hockey() {
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:#"APP_IDENTIFIER"];
// Do some additional configuration if needed here
[[BITHockeyManager sharedHockeyManager] startManager];
}
But I have the following error:
error: 'HockeySDK/HockeySDK.h' file not found
Any help?
I fixed my problem using the following pro file:
# test.pro
QMAKE_CXXFLAGS += -F/path/to/the/folder/containing/frameworks
QMAKE_OBJECTIVE_CFLAGS += -F/path/to/the/folder/containing/frameworks
LIBS += -F/path/to/the/folder/containing/frameworks
LIBS += -framework HockeySDK
LIBS += -framework Foundation
OBJECTIVE_SOURCES += hockey.m
I'm trying to use the library gdcm in my project. However I'm with some problem.
gdcmGlobal.cxx:-1: error: undefined reference to gdcm::System::FileIsDirectory(char const*)'
gdcmGlobal.cxx:-1: error: undefined reference togdcm::System::FileIsDirectory(char const*)'
gdcmGlobal.cxx:-1: error: undefined reference to gdcm::System::FileExists(char const*)'
:-1: error: C:\Program_Library\gdcm-2.0.18-mingw32\bin/libgdcmDICT.a(gdcmGlobal.cxx.obj): bad reloc address 0xf in section.text$ZNK4gdcm7Modules7IsEmptyEv[_ZNK4gdcm7Modules7IsEmptyEv]'
I included the libs:
LIBS += -L"C:\Program_Library\gdcm-2.0.18-mingw32\bin" \
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmMSFF.a" \
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmCommon.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmDICT.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmDSED.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmexpat.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmIOD.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmjpeg8.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmjpeg12.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmjpeg16.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmopenjpeg.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmzlib.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmcharls.a"\
-L"C:\Program_Library\gdcm-2.0.18-mingw32\bin\libgdcmgetopt.a"
LIBS += -lgdcmMSFF -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmexpat
-lgdcmIOD -lgdcmjpeg8 -lgdcmjpeg12 -lgdcmjpeg16 -lgdcmopenjpeg -lgdcmzlib -lgdcmcharls -lgdcmgetopt
Anybody would know what is happening?
Thanks!
Qt 5.1 uses g++ 4.8 and I used g++ 4.6 to compile gdcm! That is the problem! However when I included:
include < gdcmGlobal.h>
appear this error:
gdcmGlobal.cxx:-1: error: undefined reference to
`gdcm::System::FileIsDirectory(char const*)'
but when I remove: include < gdcmGlobal.h>, compiles!
I am trying to get OpenCv2.4.6 to work with QT5.1.0
I've followed this Guide so far Qt creator 5.0.1 with OpenCv 2.3.4 on windows
Unfortunatly after finishing trying out the sample Application(Display an Image using OpenCv in the QtCreator I get these Errors:
[Project-Path]\main.o:-1: In function `main':
[Project-Path]\main.cpp:8: error: undefined reference to `cv::imread(std::string const&, int)'
[Project-Path]\main.cpp:9: error: undefined reference to `cv::namedWindow(std::string const&, int)'
[Project-Path]\main.cpp:10: error: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
[Project-Path]\main.cpp:10: error: undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
[Project-Path]\main.cpp:11: error: undefined reference to `cv::waitKey(int)'
[Project Build Path Desktop Debug]\debug\main.o:-1: In function `ZN2cv3MatD1Ev':
[OpenCV/Install/include]\opencv2\core\mat.hpp:278: error: undefined reference to `cv::fastFree(void*)'
[Project Build Path Desktop Debug]\debug\main.o:-1: In function `ZN2cv3Mat7releaseEv':
[OpenCV/Install/include]\opencv2\core\mat.hpp:367: error: undefined reference to `cv::Mat::deallocate()'
collect2.exe:-1: error: error: ld returned 1 exit status
the "[]" Paths are my formatting and supposed to help keep track .
main.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main() {
// read an image
Mat image = imread("img.jpg");
namedWindow("My Image");
imshow("My Image", image);
waitKey(5000);
return 1;
}
myFirstOpenCVProject.pro
QT += core
QT -= gui
TARGET = myFirstOpenCVProject
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:/qt/OpenCV246_bin/install/include
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_core246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_highgui246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_imgproc246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_features2d246.dll
LIBS += -LC:/qt/OpenCV246_bin/install/lib/lopencv_calib3d246.dll
Can you help me resolve this?
I can't find any solutions that apply to my case ...
-L is to add directories to the search path. The actual libs are added via -l. The correct line would be:
LIBS += -LC:/qt/OpenCV246_bin/install/lib -llopencv_core246 -llopencv_highgui246 ...
I think you are missing the static libs of opencv:
opencv_core246.lib
opencv_highgui246.lib
opencv_video246.lib
opencv_ml26d.lib
opencv_legacy246.lib
opencv_imgproc246.lib
opencv_whatever.lib
Don t know the pro commands very well. Maybe something like:
LIBS += -Lc:/blabla/opencv_imgproc246.lib