Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moving to OpenNI/Nite based backend

  • Loading branch information...
commit 848646f1a2c0ba002441ebb0df8d023cc18e0ec5 1 parent 315299f
Roy Shilkrot authored
2  safari-extension-mac/DepthJS.safariextension/Info.plist
View
@@ -4,6 +4,8 @@
<dict>
<key>Author</key>
<string>MIT Media Lab</string>
+ <key>Builder Version</key>
+ <string>6534.50</string>
<key>CFBundleDisplayName</key>
<string>DepthJS</string>
<key>CFBundleIdentifier</key>
11 webkit-plugin-mac/HandMessageListener.cpp
View
@@ -0,0 +1,11 @@
+/*
+ * HandMessageListener.cpp
+ * OpenniTry
+ *
+ * Created by Roy Shilkrot on 9/30/11.
+ * Copyright 2011 MIT. All rights reserved.
+ *
+ */
+
+#include "HandMessageListener.h"
+
133 webkit-plugin-mac/HandMessageListener.h
View
@@ -0,0 +1,133 @@
+/*
+ * HandMessageListener.h
+ * OpenniTry
+ *
+ * Created by Roy Shilkrot on 9/30/11.
+ * Copyright 2011 MIT. All rights reserved.
+ *
+ */
+
+#ifndef _HANDMESSAGELISTENER_H
+#define _HANDMESSAGELISTENER_H
+
+#include <XnCppWrapper.h>
+#include <XnVPointControl.h>
+#include <XnVFlowRouter.h>
+#include <XnVSwipeDetector.h>
+#include <XnVSelectableSlider1D.h>
+#include <XnVSteadyDetector.h>
+#include <XnVBroadcaster.h>
+#include <XnVPushDetector.h>
+#include <XnVWaveDetector.h>
+#include <XnVSessionManager.h>
+#include <XnVCircleDetector.h>
+
+#include <sstream>
+using namespace std;
+
+extern void send_event(const string& etype, const string& edata);
+
+class HandPointControl : public XnVPointControl {
+public:
+ HandPointControl(xn::DepthGenerator depthGenerator, XnVSessionManager* sessionManager):m_DepthGenerator(depthGenerator),m_SessionManager(sessionManager) {
+// m_pInnerFlowRouter = new XnVFlowRouter;
+ m_pPushDetector = new XnVPushDetector;
+// m_pSwipeDetector = new XnVSwipeDetector;
+// m_pSteadyDetector = new XnVSteadyDetector;
+// m_pWaveDetector = new XnVWaveDetector;
+ m_pCircleDetector = new XnVCircleDetector;
+
+// m_pInnerFlowRouter->SetActive(m_pPushDetector);
+
+ // Add the push detector and flow manager to the broadcaster
+// m_Broadcaster.AddListener(m_pInnerFlowRouter);
+// m_Broadcaster.AddListener(m_pPushDetector);
+
+ // Push
+ m_pPushDetector->RegisterPush(this, &Push_Pushed);
+ m_pCircleDetector->RegisterCircle(this, &ACircle);
+ //m_pWaveDetector->RegisterWave(this, &Wave_Waved);
+
+ }
+
+ void Update(XnVMessage* pMessage)
+ {
+ XnVPointControl::Update(pMessage);
+ //m_Broadcaster.Update(pMessage);
+ m_pPushDetector->Update(pMessage);
+// m_pWaveDetector->Update(pMessage);
+ m_pCircleDetector->Update(pMessage);
+ }
+
+ // Push detector
+ static void XN_CALLBACK_TYPE Push_Pushed(XnFloat fVelocity, XnFloat fAngle, void* cxt)
+ {
+ printf("Push!\n");
+ send_event("Push", "");
+ }
+
+ static void XN_CALLBACK_TYPE ACircle(XnFloat fTimes, XnBool bConfident, const XnVCircle* pCircle, void* cxt) {
+ if(bConfident) {
+ printf("Bye Bye!\n");
+ ((HandPointControl*)cxt)->KillSession();
+ }
+ }
+
+ // Wave detector
+ static void XN_CALLBACK_TYPE Wave_Waved(void* cxt)
+ {
+ printf("Bye Bye!\n");
+ ((HandPointControl*)cxt)->KillSession();
+ }
+
+ void KillSession() { m_SessionManager->EndSession(); }
+
+ /**
+ * Handle creation of a new point
+ */
+ void OnPointCreate(const XnVHandPointContext* cxt) {
+ printf("** %d\n", cxt->nID);
+ send_event("Register", "");
+ }
+
+ /**
+ * Handle new position of an existing point
+ */
+ void OnPointUpdate(const XnVHandPointContext* cxt) {
+ // positions are kept in projective coordinates, since they are only used for drawing
+ XnPoint3D ptProjective(cxt->ptPosition);
+
+// printf("Point (%f,%f,%f)", ptProjective.X, ptProjective.Y, ptProjective.Z);
+ m_DepthGenerator.ConvertRealWorldToProjective(1, &ptProjective, &ptProjective);
+// printf(" -> (%f,%f,%f)\n", ptProjective.X, ptProjective.Y, ptProjective.Z);
+
+ stringstream ss;
+ ss << "\"x\":" << (int)ptProjective.X
+ << ",\"y\":" << (int)ptProjective.Y
+ << ",\"z\":" << (int)ptProjective.Z;
+ //cout << "move: " << ss.str() << endl;
+ send_event("Move", ss.str());
+ }
+
+ /**
+ * Handle destruction of an existing point
+ */
+ void OnPointDestroy(XnUInt32 nID) {
+ printf("OnPointDestroy\n");
+ send_event("Unregister", "");
+ }
+private:
+ xn::DepthGenerator m_DepthGenerator;
+ XnVSessionManager* m_SessionManager;
+
+// XnVBroadcaster m_Broadcaster;
+ XnVPushDetector* m_pPushDetector;
+// XnVSwipeDetector* m_pSwipeDetector;
+// XnVSteadyDetector* m_pSteadyDetector;
+// XnVFlowRouter* m_pInnerFlowRouter;
+//
+// XnVWaveDetector* m_pWaveDetector;
+ XnVCircleDetector* m_pCircleDetector;
+};
+
+#endif
194 webkit-plugin-mac/openni_backend.cpp
View
@@ -0,0 +1,194 @@
+/*
+ * openni_backend.cpp
+ * webkit-plugin-mac
+ *
+ * Created by Roy Shilkrot on 9/30/11.
+ * Copyright 2011 MIT. All rights reserved.
+ *
+ */
+
+#include "openni_backend.hpp"
+
+// Headers for OpenNI
+#include <XnOpenNI.h>
+#include <XnCppWrapper.h>
+#include <XnHash.h>
+#include <XnLog.h>
+
+// Header for NITE
+#include "XnVNite.h"
+
+#include "HandMessageListener.h"
+
+#include <iostream>
+
+#define CHECK_RC(rc, what) \
+ if (rc != XN_STATUS_OK) \
+ { \
+ printf("%s failed: %s\n", what, xnGetStatusString(rc)); \
+ return rc; \
+ }
+
+#define CHECK_ERRORS(rc, errors, what) \
+ if (rc == XN_STATUS_NO_NODE_PRESENT) \
+ { \
+ XnChar strError[1024]; \
+ errors.ToString(strError, 1024); \
+ printf("%s\n", strError); \
+ return (rc); \
+ }
+
+#define GESTURE_TO_USE "Wave"
+
+using namespace xn;
+using namespace std;
+
+typedef enum
+{
+ IN_SESSION,
+ NOT_IN_SESSION,
+ QUICK_REFOCUS
+} SessionState;
+
+// Callback for when the focus is in progress
+void XN_CALLBACK_TYPE FocusProgress(const XnChar* strFocus, const XnPoint3D& ptPosition, XnFloat fProgress, void* UserCxt)
+{
+ printf("Focus progress: %s @(%f,%f,%f): %f\n", strFocus, ptPosition.X, ptPosition.Y, ptPosition.Z, fProgress);
+}
+
+void XN_CALLBACK_TYPE GestureIntermediateStageCompletedHandler(xn::GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie)
+{
+ printf("Gesture %s: Intermediate stage complete (%f,%f,%f)\n", strGesture, pPosition->X, pPosition->Y, pPosition->Z);
+}
+void XN_CALLBACK_TYPE GestureReadyForNextIntermediateStageHandler(xn::GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie)
+{
+ printf("Gesture %s: Ready for next intermediate stage (%f,%f,%f)\n", strGesture, pPosition->X, pPosition->Y, pPosition->Z);
+}
+void XN_CALLBACK_TYPE GestureProgressHandler(xn::GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie)
+{
+ printf("Gesture %s progress: %f (%f,%f,%f)\n", strGesture, fProgress, pPosition->X, pPosition->Y, pPosition->Z);
+}
+
+void XN_CALLBACK_TYPE SessionStarting(const XnPoint3D& ptPosition, void* UserCxt);
+void XN_CALLBACK_TYPE SessionEnding(void* UserCxt);
+void XN_CALLBACK_TYPE NoHands(void* UserCxt);
+
+// xml to initialize OpenNI
+#define SAMPLE_XML_PATH "/Users/royshilkrot/Downloads/NITE-Bin-MacOSX-v1.4.1.2/Data/Sample-Tracking.xml"
+
+
+class OpenNIBackend {
+public:
+ OpenNIBackend():g_SessionState(NOT_IN_SESSION),running(true) {}
+
+ void run() {
+ printf("start openni backend thread");
+ while (running) {
+ XnMapOutputMode mode;
+ g_DepthGenerator.GetMapOutputMode(mode);
+ // Read next available data
+ g_Context.WaitOneUpdateAll(g_DepthGenerator);
+ // Update NITE tree
+ g_pSessionManager->Update(&g_Context);
+ }
+ printf("end openni backend thread");
+ }
+ void stop() { running = false; }
+ bool isDead() { return !running; }
+ int init() {
+
+ XnStatus rc = XN_STATUS_OK;
+ xn::EnumerationErrors errors;
+
+ // Initialize OpenNI
+ rc = g_Context.InitFromXmlFile(SAMPLE_XML_PATH, g_ScriptNode, &errors);
+ CHECK_ERRORS(rc, errors, "InitFromXmlFile");
+ CHECK_RC(rc, "InitFromXmlFile");
+
+ rc = g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator);
+ CHECK_RC(rc, "Find depth generator");
+ rc = g_Context.FindExistingNode(XN_NODE_TYPE_HANDS, g_HandsGenerator);
+ CHECK_RC(rc, "Find hands generator");
+ rc = g_Context.FindExistingNode(XN_NODE_TYPE_GESTURE, g_GestureGenerator);
+ CHECK_RC(rc, "Find gesture generator");
+
+ // XnCallbackHandle h;
+ // if (g_HandsGenerator.IsCapabilitySupported(XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE))
+ // {
+ // g_HandsGenerator.GetHandTouchingFOVEdgeCap().RegisterToHandTouchingFOVEdge(TouchingCallback, NULL, h);
+ // }
+
+ XnCallbackHandle hGestureIntermediateStageCompleted, hGestureProgress, hGestureReadyForNextIntermediateStage;
+ g_GestureGenerator.RegisterToGestureIntermediateStageCompleted(GestureIntermediateStageCompletedHandler, NULL, hGestureIntermediateStageCompleted);
+ g_GestureGenerator.RegisterToGestureReadyForNextIntermediateStage(GestureReadyForNextIntermediateStageHandler, NULL, hGestureReadyForNextIntermediateStage);
+ g_GestureGenerator.RegisterGestureCallbacks(NULL, GestureProgressHandler, NULL, hGestureProgress);
+
+ g_HandsGenerator.SetSmoothing(0.1);
+
+ // Create NITE objects
+ g_pSessionManager = new XnVSessionManager;
+ rc = g_pSessionManager->Initialize(&g_Context, "Click,Wave", "RaiseHand");
+ CHECK_RC(rc, "SessionManager::Initialize");
+
+ g_pSessionManager->RegisterSession(this, SessionStarting, SessionEnding, FocusProgress);
+
+ g_pHandListener = new HandPointControl(g_DepthGenerator,g_pSessionManager);
+ g_pFlowRouter = new XnVFlowRouter;
+ g_pFlowRouter->SetActive(g_pHandListener);
+
+ g_pSessionManager->AddListener(g_pFlowRouter);
+
+ g_pHandListener->RegisterNoPoints(this, NoHands);
+
+ // Initialization done. Start generating
+ rc = g_Context.StartGeneratingAll();
+ CHECK_RC(rc, "StartGenerating");
+
+ }
+
+ SessionState g_SessionState;
+private:
+ bool running;
+
+ // OpenNI objects
+ xn::Context g_Context;
+ xn::ScriptNode g_ScriptNode;
+ xn::DepthGenerator g_DepthGenerator;
+ xn::HandsGenerator g_HandsGenerator;
+ xn::GestureGenerator g_GestureGenerator;
+
+ // NITE objects
+ XnVSessionManager* g_pSessionManager;
+ XnVFlowRouter* g_pFlowRouter;
+
+ HandPointControl* g_pHandListener;
+};
+
+// callback for session start
+void XN_CALLBACK_TYPE SessionStarting(const XnPoint3D& ptPosition, void* UserCxt)
+{
+ printf("Session start: (%f,%f,%f)\n", ptPosition.X, ptPosition.Y, ptPosition.Z);
+ ((OpenNIBackend*)UserCxt)->g_SessionState = IN_SESSION;
+}
+// Callback for session end
+void XN_CALLBACK_TYPE SessionEnding(void* UserCxt)
+{
+ printf("Session end\n");
+ ((OpenNIBackend*)UserCxt)->g_SessionState = NOT_IN_SESSION;
+}
+void XN_CALLBACK_TYPE NoHands(void* UserCxt)
+{
+ if (((OpenNIBackend*)UserCxt)->g_SessionState != NOT_IN_SESSION)
+ {
+ printf("Quick refocus\n");
+ ((OpenNIBackend*)UserCxt)->g_SessionState = QUICK_REFOCUS;
+ }
+}
+
+
+OpenNIBackend onib;
+
+int openni_backend(void* _arg) { onib.run(); }
+void kill_openni_backend() { onib.stop(); }
+bool is_openni_backend_dead() { return onib.isDead(); }
+int init_openni_backend() { return onib.init(); }
18 webkit-plugin-mac/openni_backend.hpp
View
@@ -0,0 +1,18 @@
+/*
+ * openni_backend.h
+ * webkit-plugin-mac
+ *
+ * Created by Roy Shilkrot on 9/30/11.
+ * Copyright 2011 MIT. All rights reserved.
+ *
+ */
+
+#ifndef _OPENNI_BACKEND_HPP
+#define _OPENNI_BACKEND_HPP
+
+int openni_backend(void* _arg);
+void kill_openni_backend();
+bool is_openni_backend_dead();
+int init_openni_backend();
+
+#endif
36 webkit-plugin-mac/webkit-plugin-mac.xcodeproj/project.pbxproj
View
@@ -20,6 +20,11 @@
93F690C71321789600F53A8A /* DLog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93F690C61321789600F53A8A /* DLog.mm */; };
93F691821321A45600F53A8A /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F691811321A45600F53A8A /* JavaScriptCore.framework */; };
D713093013235B55001594A0 /* gesture_engine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D713092E13235B55001594A0 /* gesture_engine.cpp */; };
+ D798BD64143600F7006BB73B /* openni_backend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D798BD63143600F7006BB73B /* openni_backend.cpp */; };
+ D798BDFC14361163006BB73B /* HandMessageListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D798BDFB14361163006BB73B /* HandMessageListener.cpp */; };
+ D798BE09143611F4006BB73B /* libOpenNI.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D798BE06143611F4006BB73B /* libOpenNI.dylib */; };
+ D798BE0A143611F4006BB73B /* libXnVHandGenerator_1_4_1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D798BE07143611F4006BB73B /* libXnVHandGenerator_1_4_1.dylib */; };
+ D798BE0B143611F4006BB73B /* libXnVNite_1_4_1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D798BE08143611F4006BB73B /* libXnVNite_1_4_1.dylib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -72,6 +77,13 @@
D713092E13235B55001594A0 /* gesture_engine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gesture_engine.cpp; sourceTree = "<group>"; };
D713092F13235B55001594A0 /* FreenectDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FreenectDevice.h; sourceTree = "<group>"; };
D713093213235BCB001594A0 /* gesture_engine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gesture_engine.hpp; sourceTree = "<group>"; };
+ D798BD62143600F7006BB73B /* openni_backend.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = openni_backend.hpp; sourceTree = "<group>"; };
+ D798BD63143600F7006BB73B /* openni_backend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = openni_backend.cpp; sourceTree = "<group>"; };
+ D798BDFA14361163006BB73B /* HandMessageListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandMessageListener.h; sourceTree = "<group>"; };
+ D798BDFB14361163006BB73B /* HandMessageListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HandMessageListener.cpp; sourceTree = "<group>"; };
+ D798BE06143611F4006BB73B /* libOpenNI.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libOpenNI.dylib; path = usr/local/lib/libOpenNI.dylib; sourceTree = SDKROOT; };
+ D798BE07143611F4006BB73B /* libXnVHandGenerator_1_4_1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXnVHandGenerator_1_4_1.dylib; path = ../../../Documents/OpenniTry/libXnVHandGenerator_1_4_1.dylib; sourceTree = SOURCE_ROOT; };
+ D798BE08143611F4006BB73B /* libXnVNite_1_4_1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libXnVNite_1_4_1.dylib; path = ../../../Documents/OpenniTry/libXnVNite_1_4_1.dylib; sourceTree = SOURCE_ROOT; };
DD92D38A0106425D02CA0E72 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
@@ -86,6 +98,9 @@
938DB6FE130F3D7D008C37B1 /* libz.dylib in Frameworks */,
938DB702130F43F0008C37B1 /* Accelerate.framework in Frameworks */,
93F691821321A45600F53A8A /* JavaScriptCore.framework in Frameworks */,
+ D798BE09143611F4006BB73B /* libOpenNI.dylib in Frameworks */,
+ D798BE0A143611F4006BB73B /* libXnVHandGenerator_1_4_1.dylib in Frameworks */,
+ D798BE0B143611F4006BB73B /* libXnVNite_1_4_1.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -95,6 +110,9 @@
0259C574FE90428111CA0C5A /* webkit_plugin_mac */ = {
isa = PBXGroup;
children = (
+ D798BE06143611F4006BB73B /* libOpenNI.dylib */,
+ D798BE07143611F4006BB73B /* libXnVHandGenerator_1_4_1.dylib */,
+ D798BE08143611F4006BB73B /* libXnVNite_1_4_1.dylib */,
32DBCF9E0370C38000C91783 /* Classes */,
32DBCF9F0370C38200C91783 /* Other Sources */,
0259C582FE90428111CA0C5A /* Resources */,
@@ -176,6 +194,8 @@
32DBCF9F0370C38200C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
+ D798BDFA14361163006BB73B /* HandMessageListener.h */,
+ D798BDFB14361163006BB73B /* HandMessageListener.cpp */,
D713093213235BCB001594A0 /* gesture_engine.hpp */,
D713092E13235B55001594A0 /* gesture_engine.cpp */,
D713092F13235B55001594A0 /* FreenectDevice.h */,
@@ -185,6 +205,8 @@
938564A7130E6EE0000F4333 /* bg_fg_blobs.hpp */,
938563DC130E61AF000F4333 /* Info.plist */,
32DBCF980370C29C00C91783 /* webkit-plugin-mac_Prefix.pch */,
+ D798BD62143600F7006BB73B /* openni_backend.hpp */,
+ D798BD63143600F7006BB73B /* openni_backend.cpp */,
);
name = "Other Sources";
sourceTree = "<group>";
@@ -273,6 +295,8 @@
938564A8130E6EE0000F4333 /* bg_fg_blobs.cpp in Sources */,
93F690C71321789600F53A8A /* DLog.mm in Sources */,
D713093013235B55001594A0 /* gesture_engine.cpp in Sources */,
+ D798BD64143600F7006BB73B /* openni_backend.cpp in Sources */,
+ D798BDFC14361163006BB73B /* HandMessageListener.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -303,7 +327,10 @@
HEADER_SEARCH_PATHS = "./include/**";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Internet Plug-Ins";
- LIBRARY_SEARCH_PATHS = "$(inherited)";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../../Documents/OpenniTry\"",
+ );
OTHER_LDFLAGS = (
"-lstdc++",
"\"$(SRCROOT)/lib/libfreenect_sync.a\"",
@@ -352,7 +379,10 @@
HEADER_SEARCH_PATHS = "./include/**";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Internet Plug-Ins";
- LIBRARY_SEARCH_PATHS = "$(inherited)";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../../Documents/OpenniTry\"",
+ );
OTHER_LDFLAGS = (
"-lstdc++",
"\"$(SRCROOT)/lib/libfreenect_sync.a\"",
@@ -405,6 +435,8 @@
"-I${SOURCE_ROOT}/include/opencv",
"-I${SOURCE_ROOT}/include/opencv2",
"-I${SOURCE_ROOT}/include/libfreenect",
+ "-I/usr/local/include/ni",
+ "-I/Users/royshilkrot/Downloads/NITE-Bin-MacOSX-v1.4.1.2/Include/",
);
PREBINDING = NO;
SDKROOT = macosx10.6;
14 webkit-plugin-mac/webkit_plugin_macView.mm
View
@@ -11,7 +11,8 @@
#import <string.h>
#import <JavaScriptCore/JavaScriptCore.h>
//#include "ocv_freenect.hpp"
-#include "gesture_engine.hpp"
+//#include "gesture_engine.hpp"
+#include "openni_backend.hpp"
// PRIVATE METHODS ---------------------------------------------------------------------------------
@@ -149,7 +150,8 @@ - (void) ocvMainLoop {
ocvThread = [NSThread currentThread];
[ocvThread setName:@"ocvMainLoop"];
// ocvFreenectThread(NULL);
- gesture_engine(NULL);
+// gesture_engine(NULL);
+ openni_backend(NULL);
}
@end
@@ -211,7 +213,8 @@ - (void) InitDepthJS {
if (!haveInitDevice) {
DLog(@"[DepthJS] Device not yet init; initing");
hostPlugin = self;
- int success = init_gesture_engine();
+ //int success = init_gesture_engine();
+ int success = init_openni_backend();
haveInitDevice = success;
if (haveInitDevice) {
DLog(@"[DepthJS] Successfully inited Kinect; Starting ocv thread");
@@ -231,10 +234,11 @@ - (void) ShutdownDepthJS {
if (hostPlugin == self) {
hostPlugin = NULL;
// killOcvFreenect();
- kill_gesture_engine();
+// kill_gesture_engine();
+ kill_openni_backend();
if (ocvThread != nil) [ocvThread cancel];
ocvThread = nil;
- while (!is_gesture_engine_dead()) {
+ while (!is_openni_backend_dead()) {
[NSThread sleepForTimeInterval:0.01];
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.