summaryrefslogtreecommitdiffstats
path: root/data/skeleton2.py
diff options
context:
space:
mode:
authorJon Whiteaker <jbw@berkeley.edu>2012-02-15 11:42:35 -0800
committerJon Whiteaker <jbw@berkeley.edu>2012-02-15 11:42:35 -0800
commit87dcc50bc1f777b63f5956286d94d3ea8b9592a6 (patch)
tree5fb996b780e7dba3cfc51db3f50252ebb5697a93 /data/skeleton2.py
parentc58338dad01019cfa753c446c22dd6aa0e479838 (diff)
downloadkinect-87dcc50bc1f777b63f5956286d94d3ea8b9592a6.tar.gz
adding data+code to git repo
Diffstat (limited to 'data/skeleton2.py')
-rwxr-xr-xdata/skeleton2.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/data/skeleton2.py b/data/skeleton2.py
new file mode 100755
index 0000000..eac137b
--- /dev/null
+++ b/data/skeleton2.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+
+import time
+import sys
+import math
+import matplotlib.pyplot as plt
+import pickle
+
+plt.ion()
+fig = plt.figure(1)
+
+#sk_file = open(sys.argv[1])
+#j1 = "Spine"
+#j2 = "HipCenter"
+#vals = {}
+#pframe = -1
+X = []
+Y = []
+colors = ['r', 'k', 'y', 'g', 'b', 'm']
+i = 0
+l = 4
+#person = 'Jean'
+prun = 0
+
+
+#while 1:
+# where = sk_file.tell()
+# line = sk_file.readline()
+# if not line:
+# time.sleep(1)
+# file.seek(where)
+# else:
+splt = fig.add_subplot(111)
+people = pickle.load(open(sys.argv[2]))
+for person in people:
+ plt.cla()
+ print person
+ sk_file = open(sys.argv[1])
+ for line in sk_file.readlines():
+ sl = line.split(',') #frame, id, joint, state, x, y, z, dx, dy = line.split(',')
+ name = sl[0]
+ if name == person and sl[l] != '?':
+ run = int(sl[1])
+ if prun != 0 and run != prun:
+ c = "%c+" % (colors[i],)
+ splt.plot(X,Y,c)
+ i = (i+1)%(len(colors))
+ X = []
+ Y = []
+
+
+ dist = float(sl[3])
+ limb = float(sl[l])
+ X += [dist]
+ Y += [limb]
+ prun = run
+ plt.draw()
+ plt.waitforbuttonpress()
+
+# if frame != pframe and vals != {}:
+# if j1 in vals and j2 in vals:
+# dx = vals[j1][0] - vals[j2][0]
+# dy = vals[j1][1] - vals[j2][1]
+# dz = vals[j1][2] - vals[j2][2]
+# limb = math.sqrt(dx*dx + dy*dy + dz*dz)
+# dist = math.fabs((dz + 2*vals[j2][2])/2)
+# X += [dist]
+# Y += [limb]
+# #print str(dist) + " " + str(limb)
+# #print str(dist) + "\t" + str(limb)
+# vals = {}
+# if frame != 'Frame':
+# vals[joint] = [float(x), float(y), float(z)]
+# pframe = frame
+
+
+ #plt.figure(1)
+ #c = "%c+" % (colors[i],)
+ #splt.plot(X,Y,c)
+ #i = (i+1)%(len(colors))
+ #print c
+ #X = []
+ #Y = []
+
+