Skip to content
Browse files

Added licence, fixed of007 set root issue, fixed ofxHardwareDriver de…

…fines
  • Loading branch information...
1 parent 851c8c3 commit eef6e4e7663835ad859fd5cb7fc257eac52b478c Matthew Gingold committed Jan 9, 2012
View
BIN .DS_Store
Binary file not shown.
View
40 src/ofxDepthGenerator.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxDepthGenerator.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxDepthGenerator.h"
#include "ofxOpenNIMacros.h"
@@ -55,14 +84,7 @@ bool ofxDepthGenerator::setup(ofxOpenNIContext* pContext) {
// found the depth generator so set map_mode from it
depth_generator.GetMapOutputMode(map_mode);
} else {
- NodeInfoList depthsList;
- result = pContext->getXnContext().EnumerateProductionTrees(XN_NODE_TYPE_DEPTH, NULL, depthsList);
-
- // take first
- NodeInfo chosen = *depthsList.Begin();
-
- result = pContext->getXnContext().CreateProductionTree(chosen, depth_generator);
- //result = depth_generator.Create(pContext->getXnContext());
+ result = depth_generator.Create(pContext->getXnContext());
CHECK_RC(result, "Creating depth generator");
if (result != XN_STATUS_OK) return false;
@@ -118,7 +140,7 @@ void ofxDepthGenerator::setDepthColoring(enumDepthColoring c) {
}
-// returns mask pixels in a range (use updateMaskPixels and getDepthPixels(int forDepthThresholdNumber) for multiple masks as it's more efficient)
+// returns mask pixels in a range TODO: make do multiple ranges
unsigned char* ofxDepthGenerator::getDepthPixels(int nearThreshold, int farThreshold) {
if (max_number_depths == 1) {
View
31 src/ofxDepthGenerator.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxDepthGenerator.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXDEPTHGENERATOR
#define _H_OFXDEPTHGENERATOR
@@ -22,8 +51,6 @@ typedef struct {
// this must be at least 1!
#define MAX_NUMBER_DEPTHS 4
-using namespace xn;
-
class ofxDepthGenerator {
public:
View
29 src/ofxGestureGenerator.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxGestureGenerator.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxGestureGenerator.h"
#include "ofxOpenNIMacros.h"
View
29 src/ofxGestureGenerator.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxGestureGenerator.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXGESTUREGENERATOR
#define _H_OFXGESTUREGENERATOR
View
29 src/ofxHandGenerator.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxHandGenerator.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxHandGenerator.h"
#include "ofxOpenNIMacros.h"
#include "ofxTrackedHand.h"
View
29 src/ofxHandGenerator.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxHandGenerator.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXHANDGENERATOR
#define _H_OFXHANDGENERATOR
View
40 src/ofxHardwareDriver.cpp 100644 → 100755
@@ -1,5 +1,37 @@
+/*
+ * ofxHardwareDriver.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+
#include "ofxHardwareDriver.h"
+#if defined (TARGET_OSX)
+
ofxHardwareDriver::ofxHardwareDriver() {
printf("Init lib_usb control of Kinect Motor, LEDs and accelerometers");
}
@@ -10,7 +42,7 @@ ofxHardwareDriver::~ofxHardwareDriver() {
void ofxHardwareDriver::setup(int index)
{
- libusb_context *ctx;
+ //libusb_context *ctx;
libusb_init(&ctx);
libusb_device **devs; //pointer to pointer of device, used to retrieve a list of devices
ssize_t cnt = libusb_get_device_list (ctx, &devs); //get the list of devices
@@ -135,5 +167,7 @@ void ofxHardwareDriver::shutDown() {
// strange behaviour if the kinect is tilted in between
// application starts eg., the angle continues to be set
// even when app not running...which is odd...
- libusb_exit(0);
-}
+ libusb_exit(ctx);
+}
+
+#endif
View
38 src/ofxHardwareDriver.h 100644 → 100755
@@ -1,8 +1,41 @@
+/*
+ * ofxHardwareDriver.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+
#ifndef _H_OFXHARDWAREDRIVER
#define _H_OFXHARDWAREDRIVER
-// based on ROS kinect_aux.cpp driver and freenect tilt.c for controlling motor and accelerometers
#include "ofMain.h"
+
+#if defined (TARGET_OSX)
+// based on ROS kinect_aux.cpp driver and freenect tilt.c for controlling motor and accelerometers
+
#include <libusb.h>
// VID and PID for Kinect and motor/acc/leds
@@ -67,6 +100,8 @@ class ofxHardwareDriver {
int tilt_angle;
void shutDown();
+
+ libusb_context *ctx;
private:
@@ -76,4 +111,5 @@ class ofxHardwareDriver {
};
+#endif
#endif
View
40 src/ofxIRGenerator.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxIRGenerator.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxIRGenerator.h"
#include "ofxOpenNIMacros.h"
@@ -12,15 +41,12 @@ void ofxIRGenerator::generateTexture() {
xn::IRMetaData ird;
ir_generator.GetMetaData(ird);
- const XnUInt8* pImage = (XnUInt8*)ird.Data();
+ const XnIRPixel* pImage = ird.Data();
- int j = 0;
-
- for (int i = 0; i < ird.XRes() * ird.YRes()*2; i+=2, j++) { // Don't ask me why ;-)
- ir_pixels[j] = pImage[i];
+ for (int i = 0; i < ird.XRes() * ird.YRes(); i++) {
+ ir_pixels[i] = pImage[i]/4;
}
-
- //memcpy(ir_pixels, pImage, sizeof(unsigned char) * ird.XRes() * ird.YRes());
+
ir_texture.loadData(ir_pixels, ird.XRes(), ird.YRes(), GL_LUMINANCE);
}
View
29 src/ofxIRGenerator.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxIRGenerator.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXIRGENERATOR
#define _H_OFXIRGENERATOR
View
29 src/ofxImageGenerator.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxImageGenerator.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxImageGenerator.h"
#include "ofxOpenNIMacros.h"
View
29 src/ofxImageGenerator.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxImageGenerator.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXIMAGEENERATOR
#define _H_OFXIMAGEENERATOR
View
29 src/ofxOpenNI.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxOpenNI.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXOPENNI
#define _H_OFXOPENNI
View
101 src/ofxOpenNIContext.cpp 100644 → 100755
@@ -1,84 +1,50 @@
+/*
+ * ofxOpenNIContext.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxOpenNIContext.h"
#include "ofxDepthGenerator.h"
#include "ofxOpenNIMacros.h"
// Startup
//----------------------------------------
ofxOpenNIContext::ofxOpenNIContext() {
+ string path = ofToDataPath(""); // hack needed to set root path in 007 otherwise openNI isn't working!?!
is_using_recording = false;
- enableLogging();
}
// Just initialize; use this when you"re creating nodes yourself.
//----------------------------------------
bool ofxOpenNIContext::initContext(){
xn::EnumerationErrors errors;
- XnStatus nRetVal = context.Init();
- cout << xnGetStatusString(nRetVal) << endl;
- if(nRetVal != XN_STATUS_OK) logErrors(errors);
- CHECK_RC(nRetVal, "ofxOpenNIContext.setup()");
-
- // find devices
- NodeInfoList list;
- nRetVal = context.EnumerateProductionTrees(XN_NODE_TYPE_DEVICE, NULL, list, &errors);
- cout << xnGetStatusString(nRetVal) << endl;
- if(nRetVal != XN_STATUS_OK) logErrors(errors);
- XN_IS_STATUS_OK(nRetVal);
-
- printf("The following devices were found:\n");
- int i = 1;
- for (NodeInfoList::Iterator it = list.Begin(); it != list.End(); ++it, ++i)
- {
- NodeInfo deviceNodeInfo = *it;
-
- Device deviceNode;
- deviceNodeInfo.GetInstance(deviceNode);
- XnBool bExists = deviceNode.IsValid();
- if (!bExists)
- {
- context.CreateProductionTree(deviceNodeInfo, deviceNode);
- // this might fail.
- }
-
- if (deviceNode.IsValid() && deviceNode.IsCapabilitySupported(XN_CAPABILITY_DEVICE_IDENTIFICATION))
- {
- const XnUInt32 nStringBufferSize = 200;
- XnChar strDeviceName[nStringBufferSize];
- XnChar strSerialNumber[nStringBufferSize];
-
- XnUInt32 nLength = nStringBufferSize;
- deviceNode.GetIdentificationCap().GetDeviceName(strDeviceName, nLength);
- nLength = nStringBufferSize;
- deviceNode.GetIdentificationCap().GetSerialNumber(strSerialNumber, nLength);
- printf("[%d] %s (%s)\n", i, strDeviceName, strSerialNumber);
- }
- else
- {
- printf("[%d] %s\n", i, deviceNodeInfo.GetCreationInfo());
- }
-
- // release the device if we created it
- if (!bExists && deviceNode.IsValid())
- {
- deviceNode.Release();
- }
- }
- printf("\n");
- printf("Choose device to open (1): ");
-
- int chosen = 1;
- scanf("%d", &chosen);
-
- // create it
- NodeInfoList::Iterator it = list.Begin();
- for (i = 1; i < chosen; ++i)
- {
- it++;
- }
-
- NodeInfo deviceNode = *it;
- nRetVal = context.CreateProductionTree(deviceNode, g_Device);
- XN_IS_STATUS_OK(nRetVal);
+ XnStatus result = context.Init();
+ if(result != XN_STATUS_OK) logErrors(errors);
+ BOOL_RC(result, "ofxOpenNIContext.setup()");
}
// Initialize using an .ONI recording.
@@ -116,6 +82,7 @@ bool ofxOpenNIContext::setup() {
if (initContext()) {
addLicense("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4=");
+ enableLogging();
return true;
} else return false;
View
33 src/ofxOpenNIContext.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxOpenNIContext.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXOPENNICONTEXT
#define _H_OFXOPENNICONTEXT
@@ -7,8 +36,6 @@
#include <XnLog.h>
#include "ofMain.h"
-using namespace xn;
-
class ofxOpenNIContext {
public:
@@ -51,8 +78,6 @@ class ofxOpenNIContext {
bool is_using_recording;
xn::Context context;
-
- Device g_Device;
};
View
29 src/ofxOpenNIMacros.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxOpenNIMacros.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#define CHECK_RC(rc, what) \
if (rc != XN_STATUS_OK) \
{ \
View
29 src/ofxOpenNIRecorder.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxOpenNIRecorder.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxOpenNIRecorder.h"
// Frame sync is currently not possible with Kinect cameras!!
View
29 src/ofxOpenNIRecorder.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxOpenNIRecorder.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXOPENNIRECORDER
#define _H_OFXOPENNIRECORDER
View
29 src/ofxTrackedHand.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxTrackedHand.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxTrackedHand.h"
//--------------------------------------------------------------
View
29 src/ofxTrackedHand.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxTrackedHand.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXTRACKEDHAND
#define _H_OFXTRACKEDHAND
View
43 src/ofxTrackedUser.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxTrackedUser.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxTrackedUser.h"
ofxTrackedUser::ofxTrackedUser(ofxOpenNIContext* pContext)
@@ -88,10 +117,14 @@ void ofxTrackedUser::updateLimb(ofxLimb& rLimb) {
}
-void ofxTrackedUser::debugDraw() {
-
- neck.debugDraw();
+void ofxTrackedUser::debugDraw(const float wScale, const float hScale) {
+ glPushMatrix();
+
+ glScalef(wScale, hScale, 1);
+
+ neck.debugDraw();
+
// left arm + shoulder
left_shoulder.debugDraw();
left_upper_arm.debugDraw();
@@ -117,6 +150,8 @@ void ofxTrackedUser::debugDraw() {
right_lower_leg.debugDraw();
hip.debugDraw();
+
+ ofDrawBitmapString(ofToString((int)id), neck.position[0].X + 10, neck.position[0].Y);
- ofDrawBitmapString(ofToString((int)id), neck.position[0].X + 10, neck.position[0].Y);
+ glPopMatrix();
}
View
35 src/ofxTrackedUser.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxTrackedUser.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXTRACKEDUSER
#define _H_OFXTRACKEDUSER
@@ -44,7 +73,7 @@ class ofxOpenNIContext;
class ofxTrackedUser {
public:
- void debugDraw();
+ void debugDraw(const float wScale=1.0f, const float hScale=1.0f);
ofxLimb neck;
@@ -75,7 +104,9 @@ class ofxTrackedUser {
ofxLimb hip;
XnUserID id;
-
+ bool skeletonTracking, skeletonCalibrating, skeletonCalibrated;
+ XnPoint3D center;
+
private:
ofxTrackedUser(ofxOpenNIContext* pContext);
View
45 src/ofxUserGenerator.cpp 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxUserGenerator.cpp
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "ofxUserGenerator.h"
#include "ofxOpenNIMacros.h"
#include "ofxTrackedUser.h"
@@ -134,15 +163,17 @@ bool ofxUserGenerator::setup( ofxOpenNIContext* pContext) {
useMaskPixels = false;
// setup mask pixels array TODO: clean this up on closing or dtor
- for (int user = 0; user < MAX_NUMBER_USERS; user++) {
+ //including 0 as all users
+ for (int user = 0; user <= MAX_NUMBER_USERS; user++) {
maskPixels[user] = new unsigned char[width * height];
}
// set update cloud points default to false
useCloudPoints = false;
// setup cloud points array TODO: clean this up on closing or dtor
- for (int user = 0; user < MAX_NUMBER_USERS; user++) {
+ //including 0 as all users
+ for (int user = 0; user <= MAX_NUMBER_USERS; user++) {
cloudPoints[user] = new ofPoint[width * height];
cloudColors[user] = new ofColor[width * height];
}
@@ -282,7 +313,11 @@ void ofxUserGenerator::update() {
for(int i = 0; i < found_users; ++i) {
if(user_generator.GetSkeletonCap().IsTracking(users[i])) {
tracked_users[i]->id = users[i];
- tracked_users[i]->updateBonePositions();
+ user_generator.GetCoM(users[i], tracked_users[i]->center);
+ tracked_users[i]->skeletonTracking = user_generator.GetSkeletonCap().IsTracking(users[i]);
+ tracked_users[i]->skeletonCalibrating = user_generator.GetSkeletonCap().IsCalibrating(users[i]);
+ tracked_users[i]->skeletonCalibrated = user_generator.GetSkeletonCap().IsCalibrated(users[i]);
+ if(tracked_users[i]->skeletonTracking) tracked_users[i]->updateBonePositions();
}
}
@@ -409,13 +444,13 @@ void ofxUserGenerator::updateCloudPoints() {
ofPoint ofxUserGenerator::getWorldCoordinateAt(int x, int y, int userID) {
- return cloudPoints[userID][y * height + x];
+ return cloudPoints[userID][y * width + x];
}
ofColor ofxUserGenerator::getWorldColorAt(int x, int y, int userID) {
- return cloudColors[userID][y * height + x];
+ return cloudColors[userID][y * width + x];
}
View
35 src/ofxUserGenerator.h 100644 → 100755
@@ -1,3 +1,32 @@
+/*
+ * ofxUserGenerator.h
+ *
+ * Copyright 2011 (c) Matthew Gingold http://gingold.com.au
+ * Originally forked from a project by roxlu http://www.roxlu.com/
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#ifndef _H_OFXUSERGENERATOR
#define _H_OFXUSERGENERATOR
@@ -65,9 +94,9 @@ class ofxUserGenerator {
// vars for cloud point and masking
XnUInt16 width, height;
- unsigned char * maskPixels[MAX_NUMBER_USERS];
- ofPoint * cloudPoints[MAX_NUMBER_USERS];
- ofColor * cloudColors[MAX_NUMBER_USERS];
+ unsigned char * maskPixels[MAX_NUMBER_USERS+1];//including 0 as all users
+ ofPoint * cloudPoints[MAX_NUMBER_USERS+1];//including 0 as all users
+ ofColor * cloudColors[MAX_NUMBER_USERS+1];//including 0 as all users
bool useMaskPixels, useCloudPoints;
float smoothing_factor;

0 comments on commit eef6e4e

Please sign in to comment.
Something went wrong with that request. Please try again.