Point Cloud Library (PCL)  1.14.1-dev
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
openni_wrapper::OpenNIDevice Class Referenceabstract

Class representing an astract device for OpenNI devices: Primesense PSDK, Microsoft Kinect, Asus Xtion Pro/Live. More...

#include <pcl/io/openni_camera/openni_device.h>

+ Inheritance diagram for openni_wrapper::OpenNIDevice:
+ Collaboration diagram for openni_wrapper::OpenNIDevice:

Classes

struct  ShiftConversion
 

Public Types

enum  DepthMode { OpenNI_shift_values = 0 , OpenNI_12_bit_depth = 1 }
 
using Ptr = pcl::shared_ptr< OpenNIDevice >
 
using ConstPtr = pcl::shared_ptr< const OpenNIDevice >
 
using ImageCallbackFunction = std::function< void(Image::Ptr, void *cookie) >
 
using DepthImageCallbackFunction = std::function< void(DepthImage::Ptr, void *cookie) >
 
using IRImageCallbackFunction = std::function< void(IRImage::Ptr, void *cookie) >
 
using CallbackHandle = unsigned
 

Public Member Functions

virtual ~OpenNIDevice () noexcept
 virtual destructor. More...
 
bool findCompatibleImageMode (const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const noexcept
 finds an image output mode that can be used to retrieve images in desired output mode. More...
 
bool findCompatibleDepthMode (const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const noexcept
 finds a depth output mode that can be used to retrieve depth images in desired output mode. More...
 
bool isImageModeSupported (const XnMapOutputMode &output_mode) const noexcept
 returns whether a given mode is natively supported by the device or not More...
 
bool isDepthModeSupported (const XnMapOutputMode &output_mode) const noexcept
 returns whether a given mode is natively supported by the device or not More...
 
const XnMapOutputMode & getDefaultImageMode () const noexcept
 returns the default image mode, which is simply the first entry in the list of modes More...
 
const XnMapOutputMode & getDefaultDepthMode () const noexcept
 returns the default depth mode, which is simply the first entry in the list of modes More...
 
const XnMapOutputMode & getDefaultIRMode () const noexcept
 returns the default IR mode, which is simply the first entry in the list of modes More...
 
void setImageOutputMode (const XnMapOutputMode &output_mode)
 sets the output mode of the image stream More...
 
void setDepthOutputMode (const XnMapOutputMode &output_mode)
 sets the output mode of the depth stream More...
 
void setIROutputMode (const XnMapOutputMode &output_mode)
 sets the output mode of the IR stream More...
 
XnMapOutputMode getImageOutputMode () const
 
XnMapOutputMode getDepthOutputMode () const
 
XnMapOutputMode getIROutputMode () const
 
void setDepthRegistration (bool on_off)
 set the depth stream registration on or off More...
 
bool isDepthRegistered () const noexcept
 
bool isDepthRegistrationSupported () const noexcept
 
void setSynchronization (bool on_off)
 set the hardware synchronization between Depth and RGB stream on or off. More...
 
bool isSynchronized () const noexcept
 
virtual bool isSynchronizationSupported () const noexcept
 
bool isDepthCropped () const
 
void setDepthCropping (unsigned x, unsigned y, unsigned width, unsigned height)
 turn on cropping for the depth stream. More...
 
bool isDepthCroppingSupported () const noexcept
 
float getImageFocalLength (int output_x_resolution=0) const noexcept
 returns the focal length for the color camera in pixels. More...
 
float getDepthFocalLength (int output_x_resolution=0) const noexcept
 returns the focal length for the IR camera in pixels. More...
 
float getBaseline () const noexcept
 
virtual void startImageStream ()
 starts the image stream. More...
 
virtual void stopImageStream ()
 stops the image stream. More...
 
virtual void startDepthStream ()
 starts the depth stream. More...
 
virtual void stopDepthStream ()
 stops the depth stream. More...
 
virtual void startIRStream ()
 starts the IR stream. More...
 
virtual void stopIRStream ()
 stops the IR stream. More...
 
bool hasImageStream () const noexcept
 
bool hasDepthStream () const noexcept
 
bool hasIRStream () const noexcept
 
virtual bool isImageStreamRunning () const noexcept
 
virtual bool isDepthStreamRunning () const noexcept
 
virtual bool isIRStreamRunning () const noexcept
 
CallbackHandle registerImageCallback (const ImageCallbackFunction &callback, void *cookie=nullptr) noexcept
 registers a callback function of std::function type for the image stream with an optional user defined parameter. More...
 
template<typename T >
CallbackHandle registerImageCallback (void(T::*callback)(Image::Ptr, void *cookie), T &instance, void *cookie=nullptr) noexcept
 registers a callback function for the image stream with an optional user defined parameter. More...
 
bool unregisterImageCallback (const CallbackHandle &callbackHandle) noexcept
 unregisters a callback function. More...
 
CallbackHandle registerDepthCallback (const DepthImageCallbackFunction &callback, void *cookie=nullptr) noexcept
 registers a callback function of std::function type for the depth stream with an optional user defined parameter. More...
 
template<typename T >
CallbackHandle registerDepthCallback (void(T::*callback)(DepthImage::Ptr, void *cookie), T &instance, void *cookie=nullptr) noexcept
 registers a callback function for the depth stream with an optional user defined parameter. More...
 
bool unregisterDepthCallback (const CallbackHandle &callbackHandle) noexcept
 unregisters a callback function. More...
 
CallbackHandle registerIRCallback (const IRImageCallbackFunction &callback, void *cookie=nullptr) noexcept
 registers a callback function of std::function type for the IR stream with an optional user defined parameter. More...
 
template<typename T >
CallbackHandle registerIRCallback (void(T::*callback)(IRImage::Ptr, void *cookie), T &instance, void *cookie=nullptr) noexcept
 registers a callback function for the IR stream with an optional user defined parameter. More...
 
bool unregisterIRCallback (const CallbackHandle &callbackHandle) noexcept
 unregisters a callback function. More...
 
const char * getSerialNumber () const noexcept
 returns the serial number for device. More...
 
const char * getConnectionString () const noexcept
 returns the connection string for current device, which has following format vendorID/productID@BusID/DeviceID. More...
 
const char * getVendorName () const noexcept
 
const char * getProductName () const noexcept
 
unsigned short getVendorID () const noexcept
 
unsigned short getProductID () const noexcept
 
unsigned char getBus () const noexcept
 
unsigned char getAddress () const noexcept
 
void setRGBFocalLength (float focal_length)
 Set the RGB image focal length. More...
 
void setDepthFocalLength (float focal_length)
 Set the depth image focal length. More...
 
void setDepthOutputFormat (const DepthMode &depth_mode=OpenNI_12_bit_depth)
 Set the depth output format. More...
 
XnUInt64 getDepthOutputFormat () const
 Get the depth output format as set by the user. More...
 
std::uint16_t shiftToDepth (std::uint16_t shift_value) const
 Convert shift to depth value. More...
 

Protected Types

using ActualImageCallbackFunction = std::function< void(Image::Ptr) >
 
using ActualDepthImageCallbackFunction = std::function< void(DepthImage::Ptr) >
 
using ActualIRImageCallbackFunction = std::function< void(IRImage::Ptr) >
 

Protected Member Functions

 OpenNIDevice (xn::Context &context, const xn::NodeInfo &device_node, const xn::NodeInfo &image_node, const xn::NodeInfo &depth_node, const xn::NodeInfo &ir_node)
 
 OpenNIDevice (xn::Context &context, const xn::NodeInfo &device_node, const xn::NodeInfo &depth_node, const xn::NodeInfo &ir_node)
 
 OpenNIDevice (xn::Context &context)
 
void ImageDataThreadFunction ()
 
void DepthDataThreadFunction ()
 
void IRDataThreadFunction ()
 
virtual bool isImageResizeSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const noexcept=0
 
void setRegistration (bool on_off)
 
virtual Image::Ptr getCurrentImage (pcl::shared_ptr< xn::ImageMetaData > image_data) const noexcept=0
 
void Init ()
 
void InitShiftToDepthConversion ()
 
void ReadDeviceParametersFromSensorNode ()
 

Static Protected Member Functions

static void __stdcall NewDepthDataAvailable (xn::ProductionNode &node, void *cookie) noexcept
 
static void __stdcall NewImageDataAvailable (xn::ProductionNode &node, void *cookie) noexcept
 
static void __stdcall NewIRDataAvailable (xn::ProductionNode &node, void *cookie) noexcept
 

Protected Attributes

struct openni_wrapper::OpenNIDevice::ShiftConversion shift_conversion_parameters_
 
std::vector< std::uint16_t > shift_to_depth_table_
 
std::map< CallbackHandle, ActualImageCallbackFunctionimage_callback_
 
std::map< CallbackHandle, ActualDepthImageCallbackFunctiondepth_callback_
 
std::map< CallbackHandle, ActualIRImageCallbackFunctionir_callback_
 
std::vector< XnMapOutputMode > available_image_modes_
 
std::vector< XnMapOutputMode > available_depth_modes_
 
xn::Context & context_
 context to OpenNI driver More...
 
xn::NodeInfo device_node_info_
 node object for current device More...
 
xn::DepthGenerator depth_generator_
 Depth generator object. More...
 
xn::ImageGenerator image_generator_
 Image generator object. More...
 
xn::IRGenerator ir_generator_
 IR generator object. More...
 
XnCallbackHandle depth_callback_handle_
 
XnCallbackHandle image_callback_handle_
 
XnCallbackHandle ir_callback_handle_
 
float depth_focal_length_SXGA_
 focal length for IR camera producing depth information in native SXGA mode More...
 
float baseline_
 distance between the projector and the IR camera More...
 
float rgb_focal_length_SXGA_
 focal length for regular camera producing color images in native SXGA mode More...
 
XnUInt64 shadow_value_
 the value for shadow (occluded pixels) More...
 
XnUInt64 no_sample_value_
 the value for pixels without a valid disparity measurement More...
 
OpenNIDevice::CallbackHandle image_callback_handle_counter_
 
OpenNIDevice::CallbackHandle depth_callback_handle_counter_
 
OpenNIDevice::CallbackHandle ir_callback_handle_counter_
 
bool quit_
 
std::mutex image_mutex_
 
std::mutex depth_mutex_
 
std::mutex ir_mutex_
 
std::condition_variable image_condition_
 
std::condition_variable depth_condition_
 
std::condition_variable ir_condition_
 
std::thread image_thread_
 
std::thread depth_thread_
 
std::thread ir_thread_
 

Detailed Description

Class representing an astract device for OpenNI devices: Primesense PSDK, Microsoft Kinect, Asus Xtion Pro/Live.

Author
Suat Gedikli

Definition at line 71 of file openni_device.h.

Member Typedef Documentation

◆ ActualDepthImageCallbackFunction

Definition at line 450 of file openni_device.h.

◆ ActualImageCallbackFunction

Definition at line 449 of file openni_device.h.

◆ ActualIRImageCallbackFunction

Definition at line 451 of file openni_device.h.

◆ CallbackHandle

Definition at line 86 of file openni_device.h.

◆ ConstPtr

using openni_wrapper::OpenNIDevice::ConstPtr = pcl::shared_ptr<const OpenNIDevice>

Definition at line 81 of file openni_device.h.

◆ DepthImageCallbackFunction

Definition at line 84 of file openni_device.h.

◆ ImageCallbackFunction

using openni_wrapper::OpenNIDevice::ImageCallbackFunction = std::function<void(Image::Ptr, void* cookie) >

Definition at line 83 of file openni_device.h.

◆ IRImageCallbackFunction

using openni_wrapper::OpenNIDevice::IRImageCallbackFunction = std::function<void(IRImage::Ptr, void* cookie) >

Definition at line 85 of file openni_device.h.

◆ Ptr

Definition at line 80 of file openni_device.h.

Member Enumeration Documentation

◆ DepthMode

Enumerator
OpenNI_shift_values 
OpenNI_12_bit_depth 

Definition at line 74 of file openni_device.h.

Constructor & Destructor Documentation

◆ ~OpenNIDevice()

virtual openni_wrapper::OpenNIDevice::~OpenNIDevice ( )
virtualnoexcept

virtual destructor.

Never throws an exception.

◆ OpenNIDevice() [1/3]

openni_wrapper::OpenNIDevice::OpenNIDevice ( xn::Context &  context,
const xn::NodeInfo &  device_node,
const xn::NodeInfo &  image_node,
const xn::NodeInfo &  depth_node,
const xn::NodeInfo &  ir_node 
)
protected

◆ OpenNIDevice() [2/3]

openni_wrapper::OpenNIDevice::OpenNIDevice ( xn::Context &  context,
const xn::NodeInfo &  device_node,
const xn::NodeInfo &  depth_node,
const xn::NodeInfo &  ir_node 
)
protected

◆ OpenNIDevice() [3/3]

openni_wrapper::OpenNIDevice::OpenNIDevice ( xn::Context &  context)
protected

Member Function Documentation

◆ DepthDataThreadFunction()

void openni_wrapper::OpenNIDevice::DepthDataThreadFunction ( )
protected

◆ findCompatibleDepthMode()

bool openni_wrapper::OpenNIDevice::findCompatibleDepthMode ( const XnMapOutputMode &  output_mode,
XnMapOutputMode &  mode 
) const
noexcept

finds a depth output mode that can be used to retrieve depth images in desired output mode.

e.g If device just supports VGA at 30Hz, then a desired mode of QVGA at 30Hz would be possible by downsampling, but the modes VGA at 25Hz and SXGA at 30Hz would not be compatible.

Parameters
[in]output_modethe desired output mode
[out]modethe compatible mode that the device natively supports.
Returns
true, if a compatible mode could be found, false otherwise.

◆ findCompatibleImageMode()

bool openni_wrapper::OpenNIDevice::findCompatibleImageMode ( const XnMapOutputMode &  output_mode,
XnMapOutputMode &  mode 
) const
noexcept

finds an image output mode that can be used to retrieve images in desired output mode.

e.g If device just supports VGA at 30Hz, then the desired mode QVGA at 30Hz would be possible by down sampling, but the modes VGA at 25Hz and SXGA at 30Hz would not be compatible.

Parameters
[in]output_modethe desired output mode
[out]modethe compatible mode that the device natively supports.
Returns
true, if a compatible mode could be found, false otherwise.

◆ getAddress()

unsigned char openni_wrapper::OpenNIDevice::getAddress ( ) const
noexcept
Returns
the USB Address of the device.

◆ getBaseline()

float openni_wrapper::OpenNIDevice::getBaseline ( ) const
inlinenoexcept
Returns
Baseline of the "stereo" frame. i.e. for PSDK compatible devices its the distance between the Projector and the IR camera.

Definition at line 587 of file openni_device.h.

References baseline_.

◆ getBus()

unsigned char openni_wrapper::OpenNIDevice::getBus ( ) const
noexcept
Returns
the USB bus on which the device is connected.

◆ getConnectionString()

const char* openni_wrapper::OpenNIDevice::getConnectionString ( ) const
noexcept

returns the connection string for current device, which has following format vendorID/productID@BusID/DeviceID.

◆ getCurrentImage()

virtual Image::Ptr openni_wrapper::OpenNIDevice::getCurrentImage ( pcl::shared_ptr< xn::ImageMetaData >  image_data) const
protectedpure virtualnoexcept

◆ getDefaultDepthMode()

const XnMapOutputMode& openni_wrapper::OpenNIDevice::getDefaultDepthMode ( ) const
noexcept

returns the default depth mode, which is simply the first entry in the list of modes

Returns
the default depth mode

◆ getDefaultImageMode()

const XnMapOutputMode& openni_wrapper::OpenNIDevice::getDefaultImageMode ( ) const
noexcept

returns the default image mode, which is simply the first entry in the list of modes

Returns
the default image mode

◆ getDefaultIRMode()

const XnMapOutputMode& openni_wrapper::OpenNIDevice::getDefaultIRMode ( ) const
noexcept

returns the default IR mode, which is simply the first entry in the list of modes

Returns
the default IR mode

◆ getDepthFocalLength()

float openni_wrapper::OpenNIDevice::getDepthFocalLength ( int  output_x_resolution = 0) const
inlinenoexcept

returns the focal length for the IR camera in pixels.

The pixels are assumed to be square. Result depends on the output resolution of the depth image.

Definition at line 574 of file openni_device.h.

◆ getDepthOutputFormat()

XnUInt64 openni_wrapper::OpenNIDevice::getDepthOutputFormat ( ) const

Get the depth output format as set by the user.

◆ getDepthOutputMode()

XnMapOutputMode openni_wrapper::OpenNIDevice::getDepthOutputMode ( ) const
Returns
the current output mode of the depth stream

◆ getImageFocalLength()

float openni_wrapper::OpenNIDevice::getImageFocalLength ( int  output_x_resolution = 0) const
inlinenoexcept

returns the focal length for the color camera in pixels.

The pixels are assumed to be square. Result depends on the output resolution of the image.

Definition at line 563 of file openni_device.h.

◆ getImageOutputMode()

XnMapOutputMode openni_wrapper::OpenNIDevice::getImageOutputMode ( ) const
Returns
the current output mode of the image stream

◆ getIROutputMode()

XnMapOutputMode openni_wrapper::OpenNIDevice::getIROutputMode ( ) const
Returns
the current output mode of the IR stream

◆ getProductID()

unsigned short openni_wrapper::OpenNIDevice::getProductID ( ) const
noexcept
Returns
the product ID of the USB device.

◆ getProductName()

const char* openni_wrapper::OpenNIDevice::getProductName ( ) const
noexcept
Returns
the product name of the USB device.

◆ getSerialNumber()

const char* openni_wrapper::OpenNIDevice::getSerialNumber ( ) const
noexcept

returns the serial number for device.

Attention
This might be an empty string!!!

◆ getVendorID()

unsigned short openni_wrapper::OpenNIDevice::getVendorID ( ) const
noexcept
Returns
the vendor ID of the USB device.

◆ getVendorName()

const char* openni_wrapper::OpenNIDevice::getVendorName ( ) const
noexcept
Returns
the Vendor name of the USB device.

◆ hasDepthStream()

bool openni_wrapper::OpenNIDevice::hasDepthStream ( ) const
noexcept
Returns
true if the device supports a depth stream, false otherwise.

◆ hasImageStream()

bool openni_wrapper::OpenNIDevice::hasImageStream ( ) const
noexcept
Returns
true if the device supports an image stream, false otherwise.

◆ hasIRStream()

bool openni_wrapper::OpenNIDevice::hasIRStream ( ) const
noexcept
Returns
true if the device supports an IR stream, false otherwise.

◆ ImageDataThreadFunction()

void openni_wrapper::OpenNIDevice::ImageDataThreadFunction ( )
protected

◆ Init()

void openni_wrapper::OpenNIDevice::Init ( )
protected

◆ InitShiftToDepthConversion()

void openni_wrapper::OpenNIDevice::InitShiftToDepthConversion ( )
protected

◆ IRDataThreadFunction()

void openni_wrapper::OpenNIDevice::IRDataThreadFunction ( )
protected

◆ isDepthCropped()

bool openni_wrapper::OpenNIDevice::isDepthCropped ( ) const
Returns
true if depth stream is a cropped version of the native depth stream, false otherwise.

◆ isDepthCroppingSupported()

bool openni_wrapper::OpenNIDevice::isDepthCroppingSupported ( ) const
noexcept
Returns
true if cropping of the depth stream is supported, false otherwise.

◆ isDepthModeSupported()

bool openni_wrapper::OpenNIDevice::isDepthModeSupported ( const XnMapOutputMode &  output_mode) const
noexcept

returns whether a given mode is natively supported by the device or not

Parameters
[in]output_modemode to be checked
Returns
true if mode natively available, false otherwise

◆ isDepthRegistered()

bool openni_wrapper::OpenNIDevice::isDepthRegistered ( ) const
noexcept
Returns
whether the depth stream is registered to the RGB camera frame or not.

◆ isDepthRegistrationSupported()

bool openni_wrapper::OpenNIDevice::isDepthRegistrationSupported ( ) const
noexcept
Returns
whether a registration of the depth stream to the RGB camera frame is supported or not.

◆ isDepthStreamRunning()

virtual bool openni_wrapper::OpenNIDevice::isDepthStreamRunning ( ) const
virtualnoexcept
Returns
true if the depth stream is running / started, false otherwise.

Reimplemented in openni_wrapper::DeviceONI.

◆ isImageModeSupported()

bool openni_wrapper::OpenNIDevice::isImageModeSupported ( const XnMapOutputMode &  output_mode) const
noexcept

returns whether a given mode is natively supported by the device or not

Parameters
[in]output_modemode to be checked
Returns
true if mode natively available, false otherwise

◆ isImageResizeSupported()

virtual bool openni_wrapper::OpenNIDevice::isImageResizeSupported ( unsigned  input_width,
unsigned  input_height,
unsigned  output_width,
unsigned  output_height 
) const
protectedpure virtualnoexcept

◆ isImageStreamRunning()

virtual bool openni_wrapper::OpenNIDevice::isImageStreamRunning ( ) const
virtualnoexcept
Returns
true if the image stream is running / started, false otherwise.

Reimplemented in openni_wrapper::DeviceONI.

◆ isIRStreamRunning()

virtual bool openni_wrapper::OpenNIDevice::isIRStreamRunning ( ) const
virtualnoexcept
Returns
true if the IR stream is running / started, false otherwise.

Reimplemented in openni_wrapper::DeviceONI.

◆ isSynchronizationSupported()

virtual bool openni_wrapper::OpenNIDevice::isSynchronizationSupported ( ) const
virtualnoexcept
Returns
true if the Device supports hardware synchronization between Depth and RGB streams or not.

Reimplemented in openni_wrapper::DeviceKinect.

◆ isSynchronized()

bool openni_wrapper::OpenNIDevice::isSynchronized ( ) const
noexcept
Returns
true if Depth stream is synchronized to RGB stream, false otherwise.

◆ NewDepthDataAvailable()

static void __stdcall openni_wrapper::OpenNIDevice::NewDepthDataAvailable ( xn::ProductionNode &  node,
void *  cookie 
)
staticprotectednoexcept

◆ NewImageDataAvailable()

static void __stdcall openni_wrapper::OpenNIDevice::NewImageDataAvailable ( xn::ProductionNode &  node,
void *  cookie 
)
staticprotectednoexcept

◆ NewIRDataAvailable()

static void __stdcall openni_wrapper::OpenNIDevice::NewIRDataAvailable ( xn::ProductionNode &  node,
void *  cookie 
)
staticprotectednoexcept

◆ ReadDeviceParametersFromSensorNode()

void openni_wrapper::OpenNIDevice::ReadDeviceParametersFromSensorNode ( )
protected

◆ registerDepthCallback() [1/2]

CallbackHandle openni_wrapper::OpenNIDevice::registerDepthCallback ( const DepthImageCallbackFunction callback,
void *  cookie = nullptr 
)
noexcept

registers a callback function of std::function type for the depth stream with an optional user defined parameter.

The callback will always be called with a new depth image and the user data "cookie".

Parameters
[in]callbackthe user callback to be called if a new depth image is available
[in]cookiethe cookie that needs to be passed to the callback together with the new depth image.
Returns
a callback handler that can be used to remove the user callback from list of depth-stream callbacks.

◆ registerDepthCallback() [2/2]

template<typename T >
OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::registerDepthCallback ( void(T::*)(DepthImage::Ptr, void *cookie)  callback,
T &  instance,
void *  cookie = nullptr 
)
noexcept

registers a callback function for the depth stream with an optional user defined parameter.

This version is used to register a member function of any class. The callback will always be called with a new depth image and the user data "cookie".

Parameters
[in]callbackthe user callback to be called if a new depth image is available
instance
[in]cookiethe cookie that needs to be passed to the callback together with the new depth image.
Returns
a callback handler that can be used to remove the user callback from list of depth-stream callbacks.

Definition at line 602 of file openni_device.h.

◆ registerImageCallback() [1/2]

CallbackHandle openni_wrapper::OpenNIDevice::registerImageCallback ( const ImageCallbackFunction callback,
void *  cookie = nullptr 
)
noexcept

registers a callback function of std::function type for the image stream with an optional user defined parameter.

The callback will always be called with a new image and the user data "cookie".

Parameters
[in]callbackthe user callback to be called if a new image is available
[in]cookiethe cookie that needs to be passed to the callback together with the new image.
Returns
a callback handler that can be used to remove the user callback from list of image-stream callbacks.

◆ registerImageCallback() [2/2]

template<typename T >
OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::registerImageCallback ( void(T::*)(Image::Ptr, void *cookie)  callback,
T &  instance,
void *  cookie = nullptr 
)
noexcept

registers a callback function for the image stream with an optional user defined parameter.

This version is used to register a member function of any class. The callback will always be called with a new image and the user data "cookie".

Parameters
[in]callbackthe user callback to be called if a new image is available
instance
[in]cookiethe cookie that needs to be passed to the callback together with the new image.
Returns
a callback handler that can be used to remove the user callback from list of image-stream callbacks.

Definition at line 594 of file openni_device.h.

◆ registerIRCallback() [1/2]

CallbackHandle openni_wrapper::OpenNIDevice::registerIRCallback ( const IRImageCallbackFunction callback,
void *  cookie = nullptr 
)
noexcept

registers a callback function of std::function type for the IR stream with an optional user defined parameter.

The callback will always be called with a new IR image and the user data "cookie".

Parameters
[in]callbackthe user callback to be called if a new IR image is available
[in]cookiethe cookie that needs to be passed to the callback together with the new IR image.
Returns
a callback handler that can be used to remove the user callback from list of IR-stream callbacks.

◆ registerIRCallback() [2/2]

template<typename T >
OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::registerIRCallback ( void(T::*)(IRImage::Ptr, void *cookie)  callback,
T &  instance,
void *  cookie = nullptr 
)
noexcept

registers a callback function for the IR stream with an optional user defined parameter.

This version is used to register a member function of any class. The callback will always be called with a new IR image and the user data "cookie".

Parameters
[in]callbackthe user callback to be called if a new IR image is available
instance
[in]cookiethe cookie that needs to be passed to the callback together with the new IR image.
Returns
a callback handler that can be used to remove the user callback from list of IR-stream callbacks.

Definition at line 610 of file openni_device.h.

◆ setDepthCropping()

void openni_wrapper::OpenNIDevice::setDepthCropping ( unsigned  x,
unsigned  y,
unsigned  width,
unsigned  height 
)

turn on cropping for the depth stream.

Parameters
[in]xx-position of the rectangular subregion.
[in]yy-position of the rectangular subregion.
[in]widthwidth of the rectangular subregion.
[in]heightheight of the rectangular subregion.

◆ setDepthFocalLength()

void openni_wrapper::OpenNIDevice::setDepthFocalLength ( float  focal_length)
inline

Set the depth image focal length.

Parameters
[in]focal_lengththe depth image focal length

Definition at line 413 of file openni_device.h.

◆ setDepthOutputFormat()

void openni_wrapper::OpenNIDevice::setDepthOutputFormat ( const DepthMode depth_mode = OpenNI_12_bit_depth)

Set the depth output format.

Use 12bit depth values or shift values.

Parameters
[in]depth_modethe depth output format

◆ setDepthOutputMode()

void openni_wrapper::OpenNIDevice::setDepthOutputMode ( const XnMapOutputMode &  output_mode)

sets the output mode of the depth stream

Parameters
[in]output_modethe desired output mode

◆ setDepthRegistration()

void openni_wrapper::OpenNIDevice::setDepthRegistration ( bool  on_off)

set the depth stream registration on or off

Parameters
[in]on_off

◆ setImageOutputMode()

void openni_wrapper::OpenNIDevice::setImageOutputMode ( const XnMapOutputMode &  output_mode)

sets the output mode of the image stream

Parameters
[in]output_modethe desired output mode

◆ setIROutputMode()

void openni_wrapper::OpenNIDevice::setIROutputMode ( const XnMapOutputMode &  output_mode)

sets the output mode of the IR stream

Parameters
[in]output_modethe desired output mode

◆ setRegistration()

void openni_wrapper::OpenNIDevice::setRegistration ( bool  on_off)
protected

◆ setRGBFocalLength()

void openni_wrapper::OpenNIDevice::setRGBFocalLength ( float  focal_length)
inline

Set the RGB image focal length.

Parameters
[in]focal_lengththe RGB image focal length

Definition at line 404 of file openni_device.h.

◆ setSynchronization()

void openni_wrapper::OpenNIDevice::setSynchronization ( bool  on_off)

set the hardware synchronization between Depth and RGB stream on or off.

Parameters
[in]on_off

◆ shiftToDepth()

std::uint16_t openni_wrapper::OpenNIDevice::shiftToDepth ( std::uint16_t  shift_value) const
inline

Convert shift to depth value.

Definition at line 431 of file openni_device.h.

◆ startDepthStream()

virtual void openni_wrapper::OpenNIDevice::startDepthStream ( )
virtual

◆ startImageStream()

virtual void openni_wrapper::OpenNIDevice::startImageStream ( )
virtual

starts the image stream.

Reimplemented in openni_wrapper::DevicePrimesense, and openni_wrapper::DeviceONI.

◆ startIRStream()

virtual void openni_wrapper::OpenNIDevice::startIRStream ( )
virtual

starts the IR stream.

Reimplemented in openni_wrapper::DeviceONI.

◆ stopDepthStream()

virtual void openni_wrapper::OpenNIDevice::stopDepthStream ( )
virtual

stops the depth stream.

Reimplemented in openni_wrapper::DeviceONI.

◆ stopImageStream()

virtual void openni_wrapper::OpenNIDevice::stopImageStream ( )
virtual

stops the image stream.

Reimplemented in openni_wrapper::DeviceONI.

◆ stopIRStream()

virtual void openni_wrapper::OpenNIDevice::stopIRStream ( )
virtual

stops the IR stream.

Reimplemented in openni_wrapper::DeviceONI.

◆ unregisterDepthCallback()

bool openni_wrapper::OpenNIDevice::unregisterDepthCallback ( const CallbackHandle callbackHandle)
noexcept

unregisters a callback function.

i.e. removes that function from the list of depth stream callbacks.

Parameters
[in]callbackHandlethe handle of the callback to unregister.
Returns
true, if callback was in list and could be unregistered, false otherwise.

◆ unregisterImageCallback()

bool openni_wrapper::OpenNIDevice::unregisterImageCallback ( const CallbackHandle callbackHandle)
noexcept

unregisters a callback function.

i.e. removes that function from the list of image stream callbacks.

Parameters
[in]callbackHandlethe handle of the callback to unregister.
Returns
true, if callback was in list and could be unregistered, false otherwise.

◆ unregisterIRCallback()

bool openni_wrapper::OpenNIDevice::unregisterIRCallback ( const CallbackHandle callbackHandle)
noexcept

unregisters a callback function.

i.e. removes that function from the list of IR stream callbacks.

Parameters
[in]callbackHandlethe handle of the callback to unregister.
Returns
true, if callback was in list and could be unregistered, false otherwise.

Member Data Documentation

◆ available_depth_modes_

std::vector<XnMapOutputMode> openni_wrapper::OpenNIDevice::available_depth_modes_
protected

Definition at line 515 of file openni_device.h.

◆ available_image_modes_

std::vector<XnMapOutputMode> openni_wrapper::OpenNIDevice::available_image_modes_
protected

Definition at line 514 of file openni_device.h.

◆ baseline_

float openni_wrapper::OpenNIDevice::baseline_
protected

distance between the projector and the IR camera

Definition at line 536 of file openni_device.h.

Referenced by getBaseline().

◆ context_

xn::Context& openni_wrapper::OpenNIDevice::context_
protected

context to OpenNI driver

Definition at line 518 of file openni_device.h.

◆ depth_callback_

std::map<CallbackHandle, ActualDepthImageCallbackFunction> openni_wrapper::OpenNIDevice::depth_callback_
protected

Definition at line 511 of file openni_device.h.

◆ depth_callback_handle_

XnCallbackHandle openni_wrapper::OpenNIDevice::depth_callback_handle_
protected

Definition at line 529 of file openni_device.h.

◆ depth_callback_handle_counter_

OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::depth_callback_handle_counter_
protected

Definition at line 546 of file openni_device.h.

◆ depth_condition_

std::condition_variable openni_wrapper::OpenNIDevice::depth_condition_
protected

Definition at line 554 of file openni_device.h.

◆ depth_focal_length_SXGA_

float openni_wrapper::OpenNIDevice::depth_focal_length_SXGA_
protected

focal length for IR camera producing depth information in native SXGA mode

Definition at line 534 of file openni_device.h.

◆ depth_generator_

xn::DepthGenerator openni_wrapper::OpenNIDevice::depth_generator_
protected

Depth generator object.

Definition at line 523 of file openni_device.h.

◆ depth_mutex_

std::mutex openni_wrapper::OpenNIDevice::depth_mutex_
mutableprotected

Definition at line 551 of file openni_device.h.

◆ depth_thread_

std::thread openni_wrapper::OpenNIDevice::depth_thread_
protected

Definition at line 557 of file openni_device.h.

◆ device_node_info_

xn::NodeInfo openni_wrapper::OpenNIDevice::device_node_info_
protected

node object for current device

Definition at line 520 of file openni_device.h.

◆ image_callback_

std::map<CallbackHandle, ActualImageCallbackFunction> openni_wrapper::OpenNIDevice::image_callback_
protected

Definition at line 510 of file openni_device.h.

◆ image_callback_handle_

XnCallbackHandle openni_wrapper::OpenNIDevice::image_callback_handle_
protected

Definition at line 530 of file openni_device.h.

◆ image_callback_handle_counter_

OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::image_callback_handle_counter_
protected

Definition at line 545 of file openni_device.h.

◆ image_condition_

std::condition_variable openni_wrapper::OpenNIDevice::image_condition_
protected

Definition at line 553 of file openni_device.h.

◆ image_generator_

xn::ImageGenerator openni_wrapper::OpenNIDevice::image_generator_
protected

Image generator object.

Definition at line 525 of file openni_device.h.

◆ image_mutex_

std::mutex openni_wrapper::OpenNIDevice::image_mutex_
mutableprotected

Definition at line 550 of file openni_device.h.

◆ image_thread_

std::thread openni_wrapper::OpenNIDevice::image_thread_
protected

Definition at line 556 of file openni_device.h.

◆ ir_callback_

std::map<CallbackHandle, ActualIRImageCallbackFunction> openni_wrapper::OpenNIDevice::ir_callback_
protected

Definition at line 512 of file openni_device.h.

◆ ir_callback_handle_

XnCallbackHandle openni_wrapper::OpenNIDevice::ir_callback_handle_
protected

Definition at line 531 of file openni_device.h.

◆ ir_callback_handle_counter_

OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::ir_callback_handle_counter_
protected

Definition at line 547 of file openni_device.h.

◆ ir_condition_

std::condition_variable openni_wrapper::OpenNIDevice::ir_condition_
protected

Definition at line 555 of file openni_device.h.

◆ ir_generator_

xn::IRGenerator openni_wrapper::OpenNIDevice::ir_generator_
protected

IR generator object.

Definition at line 527 of file openni_device.h.

◆ ir_mutex_

std::mutex openni_wrapper::OpenNIDevice::ir_mutex_
mutableprotected

Definition at line 552 of file openni_device.h.

◆ ir_thread_

std::thread openni_wrapper::OpenNIDevice::ir_thread_
protected

Definition at line 558 of file openni_device.h.

◆ no_sample_value_

XnUInt64 openni_wrapper::OpenNIDevice::no_sample_value_
protected

the value for pixels without a valid disparity measurement

Definition at line 543 of file openni_device.h.

◆ quit_

bool openni_wrapper::OpenNIDevice::quit_
protected

Definition at line 549 of file openni_device.h.

◆ rgb_focal_length_SXGA_

float openni_wrapper::OpenNIDevice::rgb_focal_length_SXGA_
protected

focal length for regular camera producing color images in native SXGA mode

Definition at line 538 of file openni_device.h.

◆ shadow_value_

XnUInt64 openni_wrapper::OpenNIDevice::shadow_value_
protected

the value for shadow (occluded pixels)

Definition at line 541 of file openni_device.h.

◆ shift_conversion_parameters_

struct openni_wrapper::OpenNIDevice::ShiftConversion openni_wrapper::OpenNIDevice::shift_conversion_parameters_
protected

◆ shift_to_depth_table_

std::vector<std::uint16_t> openni_wrapper::OpenNIDevice::shift_to_depth_table_
protected

Definition at line 505 of file openni_device.h.


The documentation for this class was generated from the following file: