demo_cv_sync_multi.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """This goes through each kinect on your system, grabs one frame and
3 displays it. Uncomment the commented line to shut down after each frame
4 if your system can't handle it (will get very low FPS but it should work).
5 This will keep trying indeces until it finds one that doesn't work, then it
6 starts from 0.
7 """
8 import freenect
9 import cv
10 import frame_convert
11 
12 cv.NamedWindow('Depth')
13 cv.NamedWindow('Video')
14 ind = 0
15 print('%s\nPress ESC to stop' % __doc__)
16 
17 
18 def get_depth(ind):
19  return frame_convert.pretty_depth_cv(freenect.sync_get_depth(ind)[0])
20 
21 
22 def get_video(ind):
23  return frame_convert.video_cv(freenect.sync_get_video(ind)[0])
24 
25 
26 while 1:
27  print(ind)
28  try:
29  depth = get_depth(ind)
30  video = get_video(ind)
31  except TypeError:
32  ind = 0
33  continue
34  ind += 1
35  cv.ShowImage('Depth', depth)
36  cv.ShowImage('Video', video)
37  if cv.WaitKey(10) == 27:
38  break
39  #freenect.sync_stop() # NOTE: Uncomment if your machine can't handle it
def pretty_depth_cv(depth)
def video_cv(video)


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