# HG changeset patch
# User samer
# Date 1330428990 0
# Node ID c843a959013f374383caf013c9dc84672c157b48
# Parent f3a1dc7d35966e80deb57ba2450bf6fee848d98d
Now using OSC bundles;
some reorganisation and const-ification of code.
diff -r f3a1dc7d3596 -r c843a959013f grouptrack2.xcodeproj/samer.mode1v3
--- a/grouptrack2.xcodeproj/samer.mode1v3 Fri Feb 24 19:02:07 2012 +0000
+++ b/grouptrack2.xcodeproj/samer.mode1v3 Tue Feb 28 11:36:30 2012 +0000
@@ -279,7 +279,7 @@
PBXSmartGroupTreeModuleOutlineStateVisibleRectKey
- {{0, 0}, {186, 815}}
+ {{0, 0}, {186, 680}}
PBXTopSmartGroupGIDs
@@ -291,14 +291,14 @@
GeometryConfiguration
Frame
- {{0, 0}, {203, 833}}
+ {{0, 0}, {203, 698}}
GroupTreeTableConfiguration
MainColumn
186
RubberWindowFrame
- 161 890 1046 874 0 800 1280 1024
+ 103 35 1046 739 0 0 1280 778
Module
PBXSmartGroupTreeModule
@@ -328,13 +328,14 @@
_historyCapacity
0
bookmark
- 31BC1D8514F716A800A2BDCD
+ 3173910A14FCF2D30035A86C
history
31605DB414F6EE8B0047CE1E
- 31605DB514F6EE8B0047CE1E
3160608D14F70DCC0047CE1E
- 31510F4914F712E7005E7F5F
+ 3173909514FCDECC0035A86C
+ 3173910614FCF2B90035A86C
+ 3173910714FCF2B90035A86C
SplitCount
@@ -346,14 +347,14 @@
GeometryConfiguration
Frame
- {{0, 0}, {838, 828}}
+ {{0, 0}, {838, 693}}
RubberWindowFrame
- 161 890 1046 874 0 800 1280 1024
+ 103 35 1046 739 0 0 1280 778
Module
PBXNavigatorGroup
Proportion
- 828pt
+ 693pt
ContentConfiguration
@@ -368,7 +369,7 @@
Frame
{{0, 833}, {838, 0}}
RubberWindowFrame
- 161 890 1046 874 0 800 1280 1024
+ 103 35 1046 739 0 0 1280 778
Module
XCDetailModule
@@ -392,9 +393,9 @@
TableOfContents
- 31BC1D8214F7168200A2BDCD
+ 3173907D14FCDBF00035A86C
1CE0B1FE06471DED0097A5F4
- 31BC1D8314F7168200A2BDCD
+ 3173907E14FCDBF00035A86C
1CE0B20306471E060097A5F4
1CE0B20506471E060097A5F4
@@ -532,15 +533,16 @@
5
WindowOrderList
- 31BC1D8D14F716A800A2BDCD
- 31BC1D8E14F716A800A2BDCD
+ 317390A114FCDECC0035A86C
+ 317390A214FCDECC0035A86C
+ 1CD10A99069EF8BA00B06720
+ 1C530D57069F1CE1000CFCEE
+ 3121663E14F6DE5800456939
1C78EAAD065D492600B07095
- 1CD10A99069EF8BA00B06720
- 3121663E14F6DE5800456939
/usr/local/src/OpenFrameworks/of_preRelease_v007_osx/apps/examples/mtri-kinectui/grouptrack2.xcodeproj
WindowString
- 161 890 1046 874 0 800 1280 1024
+ 103 35 1046 739 0 0 1280 778
WindowToolsV3
@@ -561,23 +563,25 @@
PBXProjectModuleGUID
1CD0528F0623707200166675
PBXProjectModuleLabel
-
+ testApp.cpp
StatusBarVisibility
GeometryConfiguration
Frame
- {{0, 0}, {733, 0}}
+ {{0, 0}, {733, 167}}
RubberWindowFrame
- 433 1158 733 603 0 800 1280 1024
+ 433 154 733 603 0 0 1280 778
Module
PBXNavigatorGroup
Proportion
- 0pt
+ 167pt
+ BecomeActive
+
ContentConfiguration
PBXProjectModuleGUID
@@ -592,14 +596,14 @@
GeometryConfiguration
Frame
- {{0, 5}, {733, 557}}
+ {{0, 172}, {733, 390}}
RubberWindowFrame
- 433 1158 733 603 0 800 1280 1024
+ 433 154 733 603 0 0 1280 778
Module
PBXBuildResultsModule
Proportion
- 557pt
+ 390pt
Proportion
@@ -617,7 +621,7 @@
TableOfContents
3121663E14F6DE5800456939
- 31BC1D8414F7168200A2BDCD
+ 3173907F14FCDBF00035A86C
1CD0528F0623707200166675
XCMainBuildResultsModuleGUID
@@ -626,7 +630,7 @@
WindowContentMinSize
486 300
WindowString
- 433 1158 733 603 0 800 1280 1024
+ 433 154 733 603 0 0 1280 778
WindowToolGUID
3121663E14F6DE5800456939
WindowToolIsVisible
@@ -661,8 +665,8 @@
yes
sizes
- {{0, 0}, {316, 201}}
- {{316, 0}, {378, 201}}
+ {{0, 0}, {316, 202}}
+ {{316, 0}, {378, 202}}
VerticalSplitView
@@ -677,8 +681,8 @@
yes
sizes
- {{0, 0}, {694, 201}}
- {{0, 201}, {694, 180}}
+ {{0, 0}, {694, 202}}
+ {{0, 202}, {694, 179}}
@@ -711,7 +715,7 @@
148
Frame
- {{316, 0}, {378, 201}}
+ {{316, 0}, {378, 202}}
RubberWindowFrame
262 333 694 422 0 0 1280 778
@@ -739,13 +743,13 @@
TableOfContents
1CD10A99069EF8BA00B06720
- 31BC1D8614F716A800A2BDCD
+ 3173909914FCDECC0035A86C
1C162984064C10D400B95A72
- 31BC1D8714F716A800A2BDCD
- 31BC1D8814F716A800A2BDCD
- 31BC1D8914F716A800A2BDCD
- 31BC1D8A14F716A800A2BDCD
- 31BC1D8B14F716A800A2BDCD
+ 3173909A14FCDECC0035A86C
+ 3173909B14FCDECC0035A86C
+ 3173909C14FCDECC0035A86C
+ 3173909D14FCDECC0035A86C
+ 3173909E14FCDECC0035A86C
ToolbarConfiguration
xcode.toolbar.config.debugV3
@@ -757,8 +761,12 @@
+ FirstTimeWindowDisplayed
+
Identifier
windowTool.find
+ IsVertical
+
Layout
@@ -773,26 +781,16 @@
PBXProjectModuleGUID
1CDD528C0622207200134675
PBXProjectModuleLabel
- <No Editor>
- PBXSplitModuleInNavigatorKey
-
- Split0
-
- PBXProjectModuleGUID
- 1CD0528D0623707200166675
-
- SplitCount
- 1
-
+ ofxOscBundle.h
StatusBarVisibility
- 1
+
GeometryConfiguration
Frame
- {{0, 0}, {781, 167}}
+ {{0, 0}, {781, 212}}
RubberWindowFrame
- 62 385 781 470 0 0 1440 878
+ 182 285 781 470 0 0 1280 778
Module
PBXNavigatorGroup
@@ -801,11 +799,11 @@
Proportion
- 50%
+ 212pt
BecomeActive
- 1
+
ContentConfiguration
PBXProjectModuleGUID
@@ -816,18 +814,18 @@
GeometryConfiguration
Frame
- {{8, 0}, {773, 254}}
+ {{0, 217}, {781, 212}}
RubberWindowFrame
- 62 385 781 470 0 0 1440 878
+ 182 285 781 470 0 0 1280 778
Module
PBXProjectFindModule
Proportion
- 50%
+ 212pt
Proportion
- 428pt
+ 429pt
Name
@@ -837,23 +835,21 @@
PBXProjectFindModule
StatusbarIsVisible
- 1
+
TableOfContents
1C530D57069F1CE1000CFCEE
- 1C530D58069F1CE1000CFCEE
- 1C530D59069F1CE1000CFCEE
+ 3173908314FCDC110035A86C
+ 3173908414FCDC110035A86C
1CDD528C0622207200134675
- 1C530D5A069F1CE1000CFCEE
- 1CE0B1FE06471DED0097A5F4
1CD0528E0623707200166675
WindowString
- 62 385 781 470 0 0 1440 878
+ 182 285 781 470 0 0 1280 778
WindowToolGUID
1C530D57069F1CE1000CFCEE
WindowToolIsVisible
- 0
+
Identifier
@@ -872,6 +868,8 @@
Dock
+ BecomeActive
+
ContentConfiguration
PBXProjectModuleGUID
@@ -884,7 +882,7 @@
Frame
{{0, 0}, {682, 311}}
RubberWindowFrame
- 649 426 682 352 0 0 1280 778
+ 597 425 682 352 0 0 1280 778
Module
PBXDebugCLIModule
@@ -907,17 +905,17 @@
TableOfContents
1C78EAAD065D492600B07095
- 31BC1D8C14F716A800A2BDCD
+ 3173909F14FCDECC0035A86C
1C78EAAC065D492600B07095
ToolbarConfiguration
xcode.toolbar.config.consoleV3
WindowString
- 649 426 682 352 0 0 1280 778
+ 597 425 682 352 0 0 1280 778
WindowToolGUID
1C78EAAD065D492600B07095
WindowToolIsVisible
-
+
Identifier
diff -r f3a1dc7d3596 -r c843a959013f grouptrack2.xcodeproj/samer.pbxuser
--- a/grouptrack2.xcodeproj/samer.pbxuser Fri Feb 24 19:02:07 2012 +0000
+++ b/grouptrack2.xcodeproj/samer.pbxuser Tue Feb 28 11:36:30 2012 +0000
@@ -7,7 +7,7 @@
argumentStrings = (
);
autoAttachOnCrash = 1;
- breakpointsEnabled = 0;
+ breakpointsEnabled = 1;
configStateDict = {
};
customDataFormattersEnabled = 1;
@@ -46,15 +46,12 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 31510F4914F712E7005E7F5F /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */;
- name = "testApp.cpp: 117";
- rLen = 0;
- rLoc = 2967;
- rType = 0;
- vrLen = 2033;
- vrLoc = 2547;
+ 3121668614F6E91A00456939 /* ofxOscBundle.h */ = {
+ uiCtxt = {
+ sepNavIntBoundsRect = "{{0, 0}, {720, 845}}";
+ sepNavSelRange = "{0, 0}";
+ sepNavVisRange = "{0, 667}";
+ };
};
31605DB414F6EE8B0047CE1E /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
@@ -66,16 +63,6 @@
vrLen = 325;
vrLoc = 0;
};
- 31605DB514F6EE8B0047CE1E /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = E4B69E1F0A3A1BDC003C02F2 /* testApp.h */;
- name = "testApp.h: 16";
- rLen = 0;
- rLoc = 218;
- rType = 0;
- vrLen = 1146;
- vrLoc = 0;
- };
31605F7D14F7043A0047CE1E /* ofxOpenNIContext.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {777, 3471}}";
@@ -93,15 +80,45 @@
vrLen = 1708;
vrLoc = 0;
};
- 31BC1D8514F716A800A2BDCD /* PBXTextBookmark */ = {
+ 3173909514FCDECC0035A86C /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 3121668614F6E91A00456939 /* ofxOscBundle.h */;
+ name = "ofxOscBundle.h: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 1675;
+ vrLoc = 803;
+ };
+ 3173910614FCF2B90035A86C /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = E4B69E1F0A3A1BDC003C02F2 /* testApp.h */;
+ name = "testApp.h: 45";
+ rLen = 0;
+ rLoc = 935;
+ rType = 0;
+ vrLen = 1113;
+ vrLoc = 242;
+ };
+ 3173910714FCF2B90035A86C /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */;
- name = "testApp.cpp: 117";
+ name = "testApp.cpp: 85";
rLen = 0;
- rLoc = 2967;
+ rLoc = 2144;
rType = 0;
- vrLen = 2033;
- vrLoc = 2547;
+ vrLen = 1365;
+ vrLoc = 1253;
+ };
+ 3173910A14FCF2D30035A86C /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */;
+ name = "testApp.cpp: 124";
+ rLen = 0;
+ rLoc = 3106;
+ rType = 0;
+ vrLen = 1406;
+ vrLoc = 2673;
};
E4B69B4C0A3A1720003C02F2 /* Project object */ = {
activeBuildConfigurationName = Release;
@@ -110,6 +127,8 @@
addToTargets = (
E4B69B5A0A3A1756003C02F2 /* TriangleTracker */,
);
+ breakpoints = (
+ );
codeSenseManager = 3121663814F6DE1700456939 /* Code sense */;
executables = (
3121663314F6DDF900456939 /* TriangleTracker */,
@@ -137,15 +156,16 @@
PBXFileDataSource_Target_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 351737468;
- PBXWorkspaceStateSaveDate = 351737468;
+ PBXPerProjectTemplateStateSaveDate = 352115674;
+ PBXWorkspaceStateSaveDate = 352115674;
};
perUserProjectItems = {
- 31510F4914F712E7005E7F5F /* PBXTextBookmark */ = 31510F4914F712E7005E7F5F /* PBXTextBookmark */;
31605DB414F6EE8B0047CE1E /* PBXTextBookmark */ = 31605DB414F6EE8B0047CE1E /* PBXTextBookmark */;
- 31605DB514F6EE8B0047CE1E /* PBXTextBookmark */ = 31605DB514F6EE8B0047CE1E /* PBXTextBookmark */;
3160608D14F70DCC0047CE1E /* PBXTextBookmark */ = 3160608D14F70DCC0047CE1E /* PBXTextBookmark */;
- 31BC1D8514F716A800A2BDCD /* PBXTextBookmark */ = 31BC1D8514F716A800A2BDCD /* PBXTextBookmark */;
+ 3173909514FCDECC0035A86C /* PBXTextBookmark */ = 3173909514FCDECC0035A86C /* PBXTextBookmark */;
+ 3173910614FCF2B90035A86C /* PBXTextBookmark */ = 3173910614FCF2B90035A86C /* PBXTextBookmark */;
+ 3173910714FCF2B90035A86C /* PBXTextBookmark */ = 3173910714FCF2B90035A86C /* PBXTextBookmark */;
+ 3173910A14FCF2D30035A86C /* PBXTextBookmark */ = 3173910A14FCF2D30035A86C /* PBXTextBookmark */;
};
sourceControlManager = 3121663714F6DE1700456939 /* Source Control */;
userBuildSettings = {
@@ -166,16 +186,16 @@
};
E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {777, 4433}}";
- sepNavSelRange = "{2967, 0}";
- sepNavVisRange = "{2547, 2033}";
+ sepNavIntBoundsRect = "{{0, 0}, {712, 4680}}";
+ sepNavSelRange = "{7406, 0}";
+ sepNavVisRange = "{7256, 392}";
};
};
E4B69E1F0A3A1BDC003C02F2 /* testApp.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {777, 806}}";
- sepNavSelRange = "{218, 0}";
- sepNavVisRange = "{0, 1146}";
+ sepNavIntBoundsRect = "{{0, 0}, {777, 845}}";
+ sepNavSelRange = "{935, 0}";
+ sepNavVisRange = "{242, 1113}";
};
};
}
diff -r f3a1dc7d3596 -r c843a959013f release/TriangleTracker-bin.tar.gz
Binary file release/TriangleTracker-bin.tar.gz has changed
diff -r f3a1dc7d3596 -r c843a959013f src/testApp.cpp
--- a/src/testApp.cpp Fri Feb 24 19:02:07 2012 +0000
+++ b/src/testApp.cpp Tue Feb 28 11:36:30 2012 +0000
@@ -17,21 +17,34 @@
// Callback: A user was found
void XN_CALLBACK_TYPE NewUserDetected(UserGenerator& rGenerator,XnUserID nID ,void* pCookie) {
printf("New User %d\n", nID);
- send_osc_i(((testApp*)pCookie)->sender),"/birth",nID);
}
// Callback: An existing user was lost
void XN_CALLBACK_TYPE UserLostDetected(UserGenerator& rGenerator ,XnUserID nID ,void* pCookie) {
printf("Lost user %d\n", nID);
- send_osc_i(((testApp*)pCookie)->sender),"/death",nID);
}
*/
-static void inline send_osc_i(ofxOscSender& sender, const char *path, int arg) {
- ofxOscMessage msg;
- msg.setAddress(path);
- msg.addIntArg(arg);
+static inline ofxOscMessage msg(const char *path, int arg) {
+ ofxOscMessage m;
+ m.setAddress(path);
+ m.addIntArg(arg);
+ return m;
+}
+
+static inline ofxOscBundle& operator<<(ofxOscBundle &bundle, ofxOscMessage msg) {
+ bundle.addMessage(msg);
+ return bundle;
+}
+
+static inline ofxOscSender& operator<<(ofxOscSender &sender, ofxOscMessage msg) {
sender.sendMessage(msg);
+ return sender;
+}
+
+static inline ofxOscSender& operator<<(ofxOscSender &sender, ofxOscBundle bundle) {
+ sender.sendBundle(bundle);
+ return sender;
}
static inline void check_rc(XnStatus rc, const char *tag){
@@ -55,11 +68,11 @@
int X, Y, Z;
inline void set(int x, int y, int z) { X=x; Y=y; Z=z; }
inline void add(int x, int y, int z) { X+=x; Y+=y; Z+=z; }
- inline void div(float d, XnVector3D *p) { p->X=X/d; p->Y=Y/d; p->Z=Z/d; }
- inline void cpy(XnVector3D *p) { p->X=X; p->Y=Y; p->Z=Z; }
+ inline void div(float d, XnVector3D *p) const { p->X=X/d; p->Y=Y/d; p->Z=Z/d; }
+ inline void cpy(XnVector3D *p) const { p->X=X; p->Y=Y; p->Z=Z; }
};
-static void project_into_plane(XnPlane3D& plane, XnVector3D& r, XnVector3D *q) {
+static void project_into_plane(const XnPlane3D& plane, const XnVector3D& r, XnVector3D *q) {
float l = (r.X-plane.ptPoint.X)*plane.vNormal.X
+ (r.Y-plane.ptPoint.Y)*plane.vNormal.Y
+ (r.Z-plane.ptPoint.Z)*plane.vNormal.Z;
@@ -69,6 +82,7 @@
q->Z = r.Z - l*plane.vNormal.Z;
}
+
class UserStats {
public:
struct int3d left, right, top, bottom, sum;
@@ -82,8 +96,8 @@
numPixels=0;
}
- inline int area() { return numPixels; }
- inline void centroid(XnVector3D *p) { sum.div(numPixels,p); }
+ inline int area() const { return numPixels; }
+ inline void centroid(XnVector3D *p) const { sum.div(numPixels,p); }
inline void accum(int x, int y, int z) {
if (xright.X) right.set(x,y,z);
@@ -107,7 +121,7 @@
printf("OSC target: %s:%d.\n",host,port);
printf("Will run at %d frames per second.\n",FPS);
sender.setup(host, port);
- draw_image=2;
+ draw_image=1;
}
static XnMapOutputMode fps_map_mode(int fps) {
@@ -174,6 +188,7 @@
// get pixels for all users, for each compute centroid and bounding rectangle
{
UserStats stats[MAX_USERS];
+ ofxOscBundle bundle;
userGenerator.GetUserPixels(0, sceneMetaData); // 0 for all users
unsigned short *userRawPixels = (unsigned short*)sceneMetaData.Data();
@@ -200,80 +215,87 @@
}
for (int id0=0; id00) {
+ int area=stats[id0].area();
+ if (area>0) { // user present
+ XnVector3D proj; // projective coors of centroid
+
+ update_user(stats[id0], &users[id0], &proj); // sets proj
if (!users[id0].present) {
- send_osc_i(sender,"/birth",id0+1);
- send_osc_i(sender,"/randinit",id0+1);
- send_osc_i(sender,"/start",id0+1);
users[id0].present=true;
+ bundle << msg("/birth",id0+1);
+ bundle << msg("/randinit",id0+1);
+ if (got_floor) {
+ bundle << track(id0+1,users[id0],proj,area);
+ }
+ bundle << msg("/start",id0+1);
+ } else {
+ if (got_floor) {
+ bundle << track(id0+1,users[id0],proj,area);
+ }
}
- update_user(id0+1,stats[id0],&users[id0]);
- } else {
+ } else { // user vanished, send death
if (users[id0].present) {
- send_osc_i(sender,"/death",id0+1);
users[id0].present=false;
+ printf("death\n");
+ bundle << msg("/death",id0+1);
}
}
}
-
+
+ if (bundle.getMessageCount()>0) sender << bundle;
}
if (draw_image) {
userImage.setFromPixels(imagePixels, IMGWIDTH, IMGHEIGHT, OF_IMAGE_GRAYSCALE);
}
}
-void testApp::update_user(int id, UserStats& stats, UserData *user) {
- XnVector3D proj[3], real[3];
- int *coors=user->plot_coors;
+void testApp::update_user(const UserStats& stats, UserData *user, XnVector3D *proj) {
+ int *coors=user->plot_coors;
- stats.centroid(&proj[0]); // centroid in device coordinate
- stats.left.cpy(&proj[1]); // left edge in device coordinates
- stats.right.cpy(&proj[2]); // right edge in device coordinates
+ stats.centroid(proj); // centroid in device coordinate
// save values required for drawing later
- coors[0]=floor(proj[0].X);
- coors[1]=floor(proj[0].Y);
- coors[2]=floor(proj[0].Z);
+ coors[0]=floor(proj->X);
+ coors[1]=floor(proj->Y);
+ coors[2]=floor(proj->Z);
coors[3]=stats.left.X;
coors[4]=stats.right.X;
coors[5]=stats.top.Y;
coors[6]=stats.bottom.Y;
+}
+
+ofxOscMessage testApp::track(int id, const UserData& user, const XnVector3D& proj, int area) const {
+ ofxOscMessage m;
+ XnVector3D real, on_floor;
+ const int *coors=user.plot_coors;
- if (got_floor) {
- ofxOscMessage m;
- XnVector3D on_floor;
-
- // convert to camera-centric world coordinates
- depthGenerator.ConvertProjectiveToRealWorld(3,proj,real);
-
- // projection of centroid onto floor...
- project_into_plane(floor_pie,real[0],&on_floor);
-
- // ...relative to projection of camera on floor
- on_floor.X -= floor_offset.X;
- on_floor.Y -= floor_offset.Y;
- on_floor.Z -= floor_offset.Z;
-
- m.setAddress("/track");
- m.addIntArg(id);
-
- m.addFloatArg(on_floor.X);
- // m.addFloatArg(on_floor.Y); // not interesting
- m.addFloatArg(on_floor.Z);
-
- { // distances to edges of bounding box
- // corrected for perspective
- float z=coors[2]; // depth
- m.addIntArg(z*(coors[0]-coors[3]));
- m.addIntArg(z*(coors[4]-coors[0]));
- m.addIntArg(z*(coors[1]-coors[5]));
- m.addIntArg(z*(coors[6]-coors[1]));
- // area, corrected for perspective
- m.addIntArg(z*sqrt(stats.area()));
- }
-
- sender.sendMessage(m);
+ // convert to camera-centric world coordinates
+ depthGenerator.ConvertProjectiveToRealWorld(1,&proj,&real);
+
+ // projection of centroid onto floor...
+ project_into_plane(floor_pie,real,&on_floor);
+
+ // ...relative to projection of camera on floor
+ on_floor.X -= floor_offset.X;
+ on_floor.Y -= floor_offset.Y;
+ on_floor.Z -= floor_offset.Z;
+
+ m.setAddress("/track");
+ m.addIntArg(id);
+ m.addFloatArg(on_floor.X);
+ m.addFloatArg(on_floor.Z);
+
+ { // distances to edges of bounding box
+ // corrected for perspective
+ float z=coors[2]; // depth
+ m.addIntArg(z*(coors[0]-coors[3]));
+ m.addIntArg(z*(coors[4]-coors[0]));
+ m.addIntArg(z*(coors[1]-coors[5]));
+ m.addIntArg(z*(coors[6]-coors[1]));
+ // area, corrected for perspective
+ m.addIntArg(z*sqrt(area));
}
+ return m;
}
//--------------------------------------------------------------
diff -r f3a1dc7d3596 -r c843a959013f src/testApp.h
--- a/src/testApp.h Fri Feb 24 19:02:07 2012 +0000
+++ b/src/testApp.h Tue Feb 28 11:36:30 2012 +0000
@@ -22,7 +22,7 @@
SceneAnalyzer sceneAnalyzer;
SceneMetaData sceneMetaData;
XnDepthPixel max_depth;
- XnUInt64 timestamp;
+ XnUInt64 timestamp;
XnPlane3D floor_pie;
ofImage userImage;
ofTrueTypeFont font;
@@ -41,7 +41,8 @@
UserData users[MAX_USERS];
- void update_user(int id, UserStats& stats, UserData *user);
+ static void update_user(const UserStats& stats, UserData *user, XnVector3D *proj);
+ ofxOscMessage track(int id, const UserData &user, const XnVector3D &proj, int area) const;
public:
testApp(const char *host, int port, int fps);