libfreenect2 0.4
Open source driver for the Kinect for Windows v2 (K4W2) sensor
Loading...
Searching...
No Matches

Device control. More...

#include <libfreenect2/libfreenect2.hpp>

Classes

struct  ColorCameraParams
 Color camera calibration parameters. More...
struct  IrCameraParams
 IR camera intrinsic calibration parameters. More...
struct  Config
 Configuration of depth processing. More...

Public Member Functions

virtual ~Freenect2Device ()
virtual std::string getSerialNumber ()=0
virtual std::string getFirmwareVersion ()=0
virtual std::string getPacketPipelineName ()=0
virtual DeviceState getState () const =0
 Return a thread-safe snapshot of the current lifecycle state.
virtual std::string getLastError () const =0
 Return a thread-safe snapshot of the most recent lifecycle error.
virtual DeviceRuntimeStatistics getRuntimeStatistics () const
 Return monotonic counters for the lifetime of this device object.
virtual bool getCalibrationData (CalibrationData &calibration) const
 Copy the immutable calibration captured during successful initialization.
virtual bool getCalibrationProfile (CalibrationProfile &profile) const
 Copy an optional user profile attached to a durable recording.
virtual ColorCameraParams getColorCameraParams ()=0
 Get current color parameters.
virtual IrCameraParams getIrCameraParams ()=0
 Get current depth parameters.
virtual void setColorCameraParams (const ColorCameraParams &params)=0
 Replace factory preset color camera parameters.
virtual void setIrCameraParams (const IrCameraParams &params)=0
 Replace factory preset depth camera parameters.
virtual void setConfiguration (const Config &config)=0
 Configure depth processing.
virtual void setColorFrameListener (FrameListener *rgb_frame_listener)=0
 Provide your listener to receive color frames.
virtual void setIrAndDepthFrameListener (FrameListener *ir_frame_listener)=0
 Provide your listener to receive IR and depth frames.
virtual void setColorAutoExposure (float exposure_compensation=0)=0
 Sets the RGB camera to fully automatic exposure setting.
virtual void setColorSemiAutoExposure (float pseudo_exposure_time_ms)=0
 Sets a flicker-free exposure time of the RGB camera in pseudo-ms, value in range [0.0, 640] ms.
virtual void setColorManualExposure (float integration_time_ms, float analog_gain)=0
 Manually set true exposure time and analog gain of the RGB camera.
virtual void setColorSetting (ColorSettingCommandType cmd, uint32_t value)=0
 Set/get an individual setting value of the RGB camera.
virtual void setColorSetting (ColorSettingCommandType cmd, float value)=0
virtual uint32_t getColorSetting (ColorSettingCommandType cmd)=0
virtual float getColorSettingFloat (ColorSettingCommandType cmd)=0
virtual void setLedStatus (LedSettings led)=0
 Set the settings of a Kinect LED.
virtual bool start ()=0
 Start data processing with both RGB and depth streams.
virtual bool startStreams (bool rgb, bool depth)=0
 Start data processing with or without some streams.
virtual bool stop ()=0
 Stop data processing.
virtual bool close ()=0
 Shut down the device.

Static Public Attributes

static const unsigned int VendorId = 0x045E
static const unsigned int ProductId = 0x02D8
static const unsigned int ProductIdPreview = 0x02C4

Detailed Description

Device control.

Constructor & Destructor Documentation

◆ ~Freenect2Device()

virtual ~Freenect2Device ( )
virtual

Member Function Documentation

◆ getSerialNumber()

virtual std::string getSerialNumber ( )
pure virtual

◆ getFirmwareVersion()

virtual std::string getFirmwareVersion ( )
pure virtual

◆ getPacketPipelineName()

virtual std::string getPacketPipelineName ( )
pure virtual

◆ getState()

virtual DeviceState getState ( ) const
pure virtual

Return a thread-safe snapshot of the current lifecycle state.

◆ getLastError()

virtual std::string getLastError ( ) const
pure virtual

Return a thread-safe snapshot of the most recent lifecycle error.

◆ getRuntimeStatistics()

virtual DeviceRuntimeStatistics getRuntimeStatistics ( ) const
virtual

Return monotonic counters for the lifetime of this device object.

◆ getCalibrationData()

virtual bool getCalibrationData ( CalibrationData & calibration) const
virtual

Copy the immutable calibration captured during successful initialization.

Returns false until calibration is available.

◆ getCalibrationProfile()

virtual bool getCalibrationProfile ( CalibrationProfile & profile) const
virtual

Copy an optional user profile attached to a durable recording.

Live devices and legacy recordings return false.

◆ getColorCameraParams()

virtual ColorCameraParams getColorCameraParams ( )
pure virtual

Get current color parameters.

Kinect v2 includes factory preset values for these parameters. They are used in Registration.

◆ getIrCameraParams()

virtual IrCameraParams getIrCameraParams ( )
pure virtual

Get current depth parameters.

Kinect v2 includes factory preset values for these parameters. They are used in depth image decoding, and Registration.

◆ setColorCameraParams()

virtual void setColorCameraParams ( const ColorCameraParams & params)
pure virtual

Replace factory preset color camera parameters.

We do not have a clear understanding of the meaning of the parameters right now. You probably want to leave it as it is.

◆ setIrCameraParams()

virtual void setIrCameraParams ( const IrCameraParams & params)
pure virtual

Replace factory preset depth camera parameters.

This decides accuracy in depth images. You are recommended to provide calibrated values.

◆ setConfiguration()

virtual void setConfiguration ( const Config & config)
pure virtual

Configure depth processing.

◆ setColorFrameListener()

virtual void setColorFrameListener ( FrameListener * rgb_frame_listener)
pure virtual

Provide your listener to receive color frames.

◆ setIrAndDepthFrameListener()

virtual void setIrAndDepthFrameListener ( FrameListener * ir_frame_listener)
pure virtual

Provide your listener to receive IR and depth frames.

◆ setColorAutoExposure()

virtual void setColorAutoExposure ( float exposure_compensation = 0)
pure virtual

Sets the RGB camera to fully automatic exposure setting.

Exposure compensation: negative value gives an underexposed image, positive gives an overexposed image.

Parameters
exposure_compensationExposure compensation, range [-2.0, 2.0]

◆ setColorSemiAutoExposure()

virtual void setColorSemiAutoExposure ( float pseudo_exposure_time_ms)
pure virtual

Sets a flicker-free exposure time of the RGB camera in pseudo-ms, value in range [0.0, 640] ms.

The actual frame integration time is set to a multiple of fluorescent light period that is shorter than the requested time e.g. requesting 16 ms will set 10 ms in Australia (100Hz light flicker), 8.33 ms in USA (120Hz light flicker). The gain is automatically set to compensate for the reduced integration time, as if the gain was set to 1.0 and the integration time was the requested value.

Requesting less than a single fluorescent light period will set the integration time to the requested value, so the image brightness will flicker.

To set the shortest non-flickering integration period for any country, simply set a pseudo-exposure time of between (10.0, 16.667) ms, which will automatically drop the integration time to 10 or 8.3 ms depending on country, while setting the analog gain control to a brighter value.

Parameters
pseudo_exposure_time_msPseudo-exposure time in milliseconds, range (0.0, 66.0+]

◆ setColorManualExposure()

virtual void setColorManualExposure ( float integration_time_ms,
float analog_gain )
pure virtual

Manually set true exposure time and analog gain of the RGB camera.

Parameters
integration_time_msTrue shutter time in milliseconds, range (0.0, 66.0]
analog_gainAnalog gain, range [1.0, 4.0]

◆ setColorSetting() [1/2]

virtual void setColorSetting ( ColorSettingCommandType cmd,
uint32_t value )
pure virtual

Set/get an individual setting value of the RGB camera.

◆ setColorSetting() [2/2]

virtual void setColorSetting ( ColorSettingCommandType cmd,
float value )
pure virtual

◆ getColorSetting()

virtual uint32_t getColorSetting ( ColorSettingCommandType cmd)
pure virtual

◆ getColorSettingFloat()

virtual float getColorSettingFloat ( ColorSettingCommandType cmd)
pure virtual

◆ setLedStatus()

virtual void setLedStatus ( LedSettings led)
pure virtual

Set the settings of a Kinect LED.

Parameters
ledSettings for a single LED.

◆ start()

virtual bool start ( )
pure virtual

Start data processing with both RGB and depth streams.

All above configuration must only be called before start() or after stop().

FrameListener will receive frames when the device is running.

Returns
true if ok, false if error.

◆ startStreams()

virtual bool startStreams ( bool rgb,
bool depth )
pure virtual

Start data processing with or without some streams.

FrameListener will receive enabled frames when the device is running.

Parameters
rgbWhether to enable RGB stream.
depthWhether to enable depth stream.
Returns
true if ok, false if error.

◆ stop()

virtual bool stop ( )
pure virtual

Stop data processing.

Returns
true if ok, false if error.

◆ close()

virtual bool close ( )
pure virtual

Shut down the device.

Returns
true if ok, false if error.

Member Data Documentation

◆ VendorId

const unsigned int VendorId = 0x045E
static

◆ ProductId

const unsigned int ProductId = 0x02D8
static

◆ ProductIdPreview

const unsigned int ProductIdPreview = 0x02C4
static