def start(self):
        """Starts the Kinect v2 sensor stream.

        Raises
        ------
        IOError
            If the Kinect v2 is not detected.
        """
        # open packet pipeline
        if self._packet_pipeline_mode == Kinect2PacketPipelineMode.OPENGL:
            self._pipeline = lf2.OpenGLPacketPipeline()
        elif self._packet_pipeline_mode == Kinect2PacketPipelineMode.CPU:
            self._pipeline = lf2.CpuPacketPipeline()

        # setup logger
        self._logger = lf2.createConsoleLogger(lf2.LoggerLevel.Warning)
        lf2.setGlobalLogger(self._logger)

        # check devices
        self._fn_handle = lf2.Freenect2()
        self._num_devices = self._fn_handle.enumerateDevices()
        if self._num_devices == 0:
            raise IOError('Failed to start stream. No Kinect2 devices available!')
        if self._num_devices <= self._device_num:
            raise IOError('Failed to start stream. Device num %d unavailable!' %(self._device_num))

        # open device
        self._serial = self._fn_handle.getDeviceSerialNumber(self._device_num)
        self._device = self._fn_handle.openDevice(self._serial, pipeline=self._pipeline)

        # add device sync modes
        self._listener = lf2.SyncMultiFrameListener(
            lf2.FrameType.Color | lf2.FrameType.Ir | lf2.FrameType.Depth)
        self._device.setColorFrameListener(self._listener)
        self._device.setIrAndDepthFrameListener(self._listener)

        # start device
        self._device.start()

        # open registration
        self._registration = None
        if self._registration_mode == Kinect2RegistrationMode.COLOR_TO_DEPTH:
            logging.debug('Using color to depth registration')
            self._registration = lf2.Registration(self._device.getIrCameraParams(),
                                                  self._device.getColorCameraParams())
        self._running = True
def start ( self ) : if self . _packet_pipeline_mode == Kinect2PacketPipelineMode . OPENGL : self . _pipeline = lf2 . OpenGLPacketPipeline ( ) elif self . _packet_pipeline_mode == Kinect2PacketPipelineMode . CPU : self . _pipeline = lf2 . CpuPacketPipeline ( ) self . _logger = lf2 . createConsoleLogger ( lf2 . LoggerLevel . Warning ) lf2 . setGlobalLogger ( self . _logger ) self . _fn_handle = lf2 . Freenect2 ( ) self . _num_devices = self . _fn_handle . enumerateDevices ( ) if self . _num_devices == 0 : raise IOError ( 'Failed to start stream. No Kinect2 devices available!' ) if self . _num_devices <= self . _device_num : raise IOError ( 'Failed to start stream. Device num %d unavailable!' % ( self . _device_num ) ) self . _serial = self . _fn_handle . getDeviceSerialNumber ( self . _device_num ) self . _device = self . _fn_handle . openDevice ( self . _serial , pipeline = self . _pipeline ) self . _listener = lf2 . SyncMultiFrameListener ( lf2 . FrameType . Color | lf2 . FrameType . Ir | lf2 . FrameType . Depth ) self . _device . setColorFrameListener ( self . _listener ) self . _device . setIrAndDepthFrameListener ( self . _listener ) self . _device . start ( ) self . _registration = None if self . _registration_mode == Kinect2RegistrationMode . COLOR_TO_DEPTH : logging . debug ( 'Using color to depth registration' ) self . _registration = lf2 . Registration ( self . _device . getIrCameraParams ( ) , self . _device . getColorCameraParams ( ) ) self . _running = True
Starts the Kinect v2 sensor stream.

        Raises
        ------
        IOError
            If the Kinect v2 is not detected.