-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDel2Backup.py
51 lines (40 loc) · 1.24 KB
/
Del2Backup.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
41
42
43
44
45
46
47
48
49
50
51
from Leap import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import random
import globalVariables as gv
controller = Controller()
lines = []
matplotlib.interactive(True)
fig = plt.figure(figsize = (8, 6))
ax = fig.add_subplot(111, projection='3d')
ax.set_xlim(-300, 300)
ax.set_ylim(-50, 250)
ax.set_zlim(50, 500)
ax.view_init(azim=90)
while True:
frame = controller.frame()
while (lines):
ln = lines.pop()
ln.pop(0).remove()
del ln
ln = []
# if at least one hand is in the frame
if (frame.hands):
hand = frame.hands[0]
for i in range(0, 5):
finger = hand.fingers[i]
for j in range(0, 4):
bone = finger.bone(j)
boneBase = bone.prev_joint
boneTip = bone.next_joint
print boneTip
xBase = boneBase[0]
yBase = boneBase[1]
zBase = boneBase[2]
xTip = boneTip[0]
yTip = boneTip[1]
zTip = boneTip[2]
lines.append(ax.plot([-xBase, -xTip], [zBase, zTip], [yBase, yTip], 'r'))
plt.pause(0.00001)