-
Notifications
You must be signed in to change notification settings - Fork 0
/
skel.py
executable file
·40 lines (31 loc) · 862 Bytes
/
skel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/python
import sys
import time
import ni
c = ni.Context("Config.xml")
#c = ni.Context('/home/oaubert/src/kinect/Nite-1.3.0.18/Data/Sample-User.xml')
if c is None:
print "Cannot create context."
sys.exit(0)
q = ni.NodeQuery()
err = ni.EnumerationErrors()
def debug(*p):
print "DEBUG CB", str(p)
d = c.createDepthGenerator(q, err)
if not d:
print "Error when creating depth generator"
u = c.createUserGenerator(q, err)
if not u.isCapabilitySupported(ni.Capability.SKELETON):
raise "Unable to create UserGenerator"
h = u.registerUserCallbacks(ni.cb.UserHandler(debug), ni.cb.UserHandler(debug), "User")
print "Registered cb %x" % h
s=c.startGeneratingAll()
if s:
ni.error(s)
print "Waiting"
for i in range(9):
s = c.waitAndUpdateAll()
if s:
ni.error(s)
print "Update", u.getUsers()
time.sleep(.1)