demo_mp_sync.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import freenect
3 import matplotlib.pyplot as mp
4 import frame_convert
5 import signal
6 
7 keep_running = True
8 
9 
10 def get_depth():
11  return frame_convert.pretty_depth(freenect.sync_get_depth()[0])
12 
13 
14 def get_video():
15  return freenect.sync_get_video()[0]
16 
17 
18 def handler(signum, frame):
19  """Sets up the kill handler, catches SIGINT"""
20  global keep_running
21  keep_running = False
22 
23 
24 mp.ion()
25 mp.gray()
26 mp.figure(1)
27 image_depth = mp.imshow(get_depth(), interpolation='nearest', animated=True)
28 mp.figure(2)
29 image_rgb = mp.imshow(get_video(), interpolation='nearest', animated=True)
30 print('Press Ctrl-C in terminal to stop')
31 signal.signal(signal.SIGINT, handler)
32 
33 while keep_running:
34  mp.figure(1)
35  image_depth.set_data(get_depth())
36  mp.figure(2)
37  image_rgb.set_data(get_video())
38  mp.draw()
39  mp.waitforbuttonpress(0.01)
def get_video()
Definition: demo_mp_sync.py:14
def get_depth()
Definition: demo_mp_sync.py:10
def handler(signum, frame)
Definition: demo_mp_sync.py:18
def pretty_depth(depth)
Definition: frame_convert.py:4


libfreenect
Author(s): Hector Martin, Josh Blake, Kyle Machulis, OpenKinect community
autogenerated on Mon Jun 10 2019 13:46:42