Skip to content

Commit 9fbc08d

Browse files
committed
Added files
1 parent 260b116 commit 9fbc08d

15 files changed

+2639
-0
lines changed

HandSkeleton.pro

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#-------------------------------------------------
2+
#
3+
# Project created by QtCreator 2014-06-05T20:48:57
4+
#
5+
#-------------------------------------------------
6+
7+
QT += core gui opengl
8+
9+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10+
11+
TARGET = HandSkeleton
12+
TEMPLATE = app
13+
14+
# ------------------------------------------------------------------------------
15+
# OpenNI2 & NiTE2 _
16+
INCLUDEPATH += "C:\\Program Files (x86)\\OpenNI2\\Include" \
17+
"C:\\Program Files (x86)\\PrimeSense\\NiTE2\\Include"
18+
LIBS += -L"C:/Program Files (x86)/OpenNI2/Lib" -lOpenNI2
19+
LIBS += -L"C:/Program Files (x86)/PrimeSense/NiTE2/Lib" -lNiTE2
20+
# _
21+
22+
# OpenCV _
23+
INCLUDEPATH += "C:/opencv/ocv249/opencv/build/include"
24+
LIBS += -L"C:/opencv/ocv249/opencv/build/x86/vc11/lib" -lopencv_core249 \
25+
-lopencv_highgui249 \
26+
-lopencv_imgproc249
27+
# _
28+
29+
# Ogre _
30+
INCLUDEPATH += "C:/ogrevc11/include"
31+
LIBS += -L"C:/ogrevc11/lib/Release" -lOgreMain
32+
# _
33+
34+
# Boost _
35+
INCLUDEPATH += "C:/boostvc11"
36+
LIBS += -L"C:/boostvc11/lib32-msvc-11.0"
37+
# ------------------------------------------------------------------------------
38+
39+
SOURCES += main.cpp\
40+
mainwindow.cpp \
41+
api/recognizer.cpp \
42+
api/hw/sensordevice.cpp \
43+
api/learn/handhypothesis.cpp \
44+
api/learn/handmodel.cpp \
45+
ogrewidget.cpp
46+
47+
HEADERS += mainwindow.h \
48+
api/recognizer.h \
49+
api/hw/sensordevice.h \
50+
api/learn/handhypothesis.h \
51+
api/learn/handmodel.h \
52+
ogrewidget.h
53+
54+
FORMS += mainwindow.ui

api/hw/sensordevice.cpp

+346
Large diffs are not rendered by default.

api/hw/sensordevice.h

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#ifndef SENSORDEVICE_H
2+
#define SENSORDEVICE_H
3+
4+
#include <QObject>
5+
#include <QThread>
6+
7+
#include <OpenNI.h>
8+
#include <NiTE.h>
9+
#include <opencv2/opencv.hpp>
10+
11+
#include <QQuaternion>
12+
#include <QVector3D>
13+
#include <QVector2D>
14+
15+
#include <QDebug>
16+
17+
#define SENSOR_WIDTH 640
18+
#define SENSOR_HEIGHT 480
19+
20+
namespace IMAGE { enum Mode { DEPTH = 0, COLOR = 1, IR = 2, }; }
21+
Q_DECLARE_METATYPE(IMAGE::Mode)
22+
23+
namespace POSE { enum Type { PSI = 0, ARMS_CROSSED = 1, }; }
24+
Q_DECLARE_METATYPE(POSE::Type)
25+
26+
typedef struct { QVector3D minimum; QVector3D maximum; } RealWorldBoundingBox;
27+
typedef struct { QVector2D minimum; QVector2D maximum; } ProjectiveBoundingBox;
28+
typedef struct
29+
{
30+
cv::Mat pixelmap;
31+
QVector2D projective_center_of_mass;
32+
QVector3D real_world_center_of_mass;
33+
ProjectiveBoundingBox projective_bounding_box;
34+
RealWorldBoundingBox real_world_bounding_box;
35+
} UserMap;
36+
Q_DECLARE_METATYPE(UserMap)
37+
38+
typedef struct { QVector2D position; } ProjectiveJoint;
39+
typedef struct
40+
{
41+
ProjectiveJoint head; ProjectiveJoint neck;
42+
ProjectiveJoint left_shoulder; ProjectiveJoint left_elbow; ProjectiveJoint left_hand;
43+
ProjectiveJoint right_shoulder; ProjectiveJoint right_elbow; ProjectiveJoint right_hand;
44+
ProjectiveJoint torso;
45+
ProjectiveJoint left_hip; ProjectiveJoint left_knee; ProjectiveJoint left_foot;
46+
ProjectiveJoint right_hip; ProjectiveJoint right_knee; ProjectiveJoint right_foot;
47+
} ProjectiveSkeleton;
48+
Q_DECLARE_METATYPE(ProjectiveSkeleton)
49+
50+
typedef struct { QQuaternion orientation; QVector3D position; } RealWorldJoint;
51+
typedef struct
52+
{
53+
RealWorldJoint head; RealWorldJoint neck;
54+
RealWorldJoint left_shoulder; RealWorldJoint left_elbow; RealWorldJoint left_hand;
55+
RealWorldJoint right_shoulder; RealWorldJoint right_elbow; RealWorldJoint right_hand;
56+
RealWorldJoint torso;
57+
RealWorldJoint left_hip; RealWorldJoint left_knee; RealWorldJoint left_foot;
58+
RealWorldJoint right_hip; RealWorldJoint right_knee; RealWorldJoint right_foot;
59+
} RealWorldSkeleton;
60+
Q_DECLARE_METATYPE(RealWorldSkeleton)
61+
62+
Q_DECLARE_METATYPE(cv::Mat)
63+
64+
class SensorDevice : public QThread
65+
{
66+
Q_OBJECT
67+
public:
68+
explicit SensorDevice(QObject *parent = 0, QString devicePath = QString());
69+
~SensorDevice(void);
70+
71+
bool initSensor(int depthXres = 640,
72+
int depthYres = 480,
73+
int depthFPS = 30,
74+
int rgbXres = 640,
75+
int rgbYres = 480,
76+
int rgbFPS = 30,
77+
int irXres = 640,
78+
int irYres = 480,
79+
int irFPS = 30);
80+
bool stopSensor(void);
81+
82+
private:
83+
QString m_devicePath;
84+
bool m_isActive,
85+
m_isDepth_running,
86+
m_isRGB_running,
87+
m_isIR_running;
88+
89+
openni::Device m_device;
90+
openni::VideoStream m_videoDepth, m_videoColor, m_videoIR;
91+
openni::VideoStream** m_videoStreamDepth, **m_videoStreamColor, **m_videoStreamIR;
92+
nite::HandTracker m_handTracker;
93+
nite::UserTracker m_userTracker;
94+
95+
RealWorldJoint convertSkeletonJointToRealWorld(const nite::SkeletonJoint);
96+
ProjectiveJoint convertSkeletonJointToProjective(const nite::SkeletonJoint);
97+
98+
public slots:
99+
void run(void);
100+
101+
signals:
102+
void hand_init(short);
103+
void hand_coordinate(short, QVector3D);
104+
void hand_stop(short);
105+
106+
void user_init(short);
107+
void user_map(short, UserMap);
108+
void user_projective_skeleton(short, ProjectiveSkeleton);
109+
void user_real_world_skeleton(short, RealWorldSkeleton);
110+
void user_pose(short, POSE::Type);
111+
void user_stop(short);
112+
113+
void image_data(IMAGE::Mode, cv::Mat);
114+
};
115+
116+
#endif // SENSORDEVICE_H

0 commit comments

Comments
 (0)