Ejemplo n.º 1
0
    def __init__(self,
                 nui_init_flags=RuntimeOptions.uses_color
                 | RuntimeOptions.uses_depth
                 | RuntimeOptions.uses_depth_and_player_index
                 | RuntimeOptions.uses_skeletal_tracking,
                 index=0):
        """Creates a new runtime.  By default initialized to the 1st installed kinect device and tracking all events"""
        self._nui = self._skeleton_event = self._image_event = self._depth_event = None
        self._nui = _NuiCreateSensorByIndex(index)
        try:
            self._nui.NuiInitialize(nui_init_flags)
        except:
            self._nui.NuiShutdown()
            import traceback

            raise KinectError('Unable to create Kinect runtime ' +
                              traceback.format_exc())

        self.depth_frame_ready = _event()
        self.skeleton_frame_ready = _event()
        self.video_frame_ready = _event()

        self._skeleton_event = _CreateEvent(None, True, False, None)
        self._image_event = _CreateEvent(None, True, False, None)
        self._depth_event = _CreateEvent(None, True, False, None)

        self.camera = Camera(self)
        self.skeleton_engine = SkeletonEngine(self)
        self.depth_stream = ImageStream(self)
        self.video_stream = ImageStream(self)

        thread.start_new_thread(self._event_thread, ())
Ejemplo n.º 2
0
    def __init__(self, 
                 nui_init_flags = RuntimeOptions.uses_color| RuntimeOptions.uses_depth | RuntimeOptions.uses_depth_and_player_index | RuntimeOptions.uses_skeletal_tracking,                 
                 index = 0):
        """Creates a new runtime.  By default initialized to the 1st installed kinect device and tracking all events"""
        self._nui = self._skeleton_event = self._image_event = self._depth_event = None
        self._nui = _NuiCreateSensorByIndex(index)
        try:            
            self._nui.NuiInitialize(nui_init_flags)
        except:
            self._nui.NuiShutdown()
            import traceback
            
            raise KinectError('Unable to create Kinect runtime %s' % (traceback.format_exc())) 

        self.depth_frame_ready = _event()
        self.skeleton_frame_ready = _event()
        self.video_frame_ready = _event()

        self._skeleton_event = _CreateEvent(None, True, False, None)
        self._image_event = _CreateEvent(None, True, False, None)
        self._depth_event = _CreateEvent(None, True, False, None)
        
        self.camera = Camera(self)
        self.skeleton_engine = SkeletonEngine(self)
        self.depth_stream = ImageStream(self)
        self.video_stream = ImageStream(self)
        
        thread.start_new_thread(self._event_thread, ())