Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes

openni_wrapper::OpenNIDevice Class Reference
[Module io]

Class representing an astract device for Primesense or MS Kinect devices. More...

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

Inheritance diagram for openni_wrapper::OpenNIDevice:
Inheritance graph
[legend]

List of all members.

Public Types

typedef boost::function< void(boost::shared_ptr
< Image >, void *cookie) 
ImageCallbackFunction )
typedef boost::function< void(boost::shared_ptr
< DepthImage >, void *cookie) 
DepthImageCallbackFunction )
typedef unsigned CallbackHandle

Public Member Functions

virtual ~OpenNIDevice () throw ()
virtual bool findCompatibleImageMode (const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const throw (OpenNIException)
virtual bool findCompatibleDepthMode (const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const throw (OpenNIException)
virtual bool isImageModeSupported (const XnMapOutputMode &output_mode) const throw (OpenNIException)
virtual bool isDepthModeSupported (const XnMapOutputMode &output_mode) const throw (OpenNIException)
virtual const XnMapOutputMode & getDefaultImageMode () const throw ()
virtual const XnMapOutputMode & getDefaultDepthMode () const throw ()
virtual void setImageOutputMode (const XnMapOutputMode &output_mode) throw (OpenNIException)
virtual void setDepthOutputMode (const XnMapOutputMode &output_mode) throw (OpenNIException)
XnMapOutputMode getImageOutputMode () const throw (OpenNIException)
XnMapOutputMode getDepthOutputMode () const throw (OpenNIException)
void setDepthRegistration (bool on_off) throw (OpenNIException)
bool isDepthRegistered () const throw (OpenNIException)
virtual void setSynchronization (bool on_off) throw (OpenNIException)
virtual bool isSynchronized () const throw (OpenNIException)
virtual bool isSynchronizationSupported () const throw ()
virtual bool isDepthCropped () const throw (OpenNIException)
virtual void setDepthCropping (unsigned x, unsigned y, unsigned width, unsigned height) throw (OpenNIException)
virtual bool isDepthCroppingSupported () const throw ()
float getImageFocalLength (int output_x_resolution=0) const throw ()
 returns the focal length for the color camera in pixels.
float getDepthFocalLength (int output_x_resolution=0) const throw ()
 returns the focal length for the IR camera in pixels.
float getBaseline () const throw ()
virtual void startImageStream () throw (OpenNIException)
virtual void stopImageStream () throw (OpenNIException)
virtual void startDepthStream () throw (OpenNIException)
virtual void stopDepthStream () throw (OpenNIException)
virtual bool hasImageStream () const throw ()
virtual bool hasDepthStream () const throw ()
bool isImageStreamRunning () const throw (OpenNIException)
bool isDepthStreamRunning () const throw (OpenNIException)
CallbackHandle registerImageCallback (const ImageCallbackFunction &callback, void *cookie=NULL) throw ()
template<typename T >
CallbackHandle registerImageCallback (void(T::*callback)(boost::shared_ptr< Image >, void *cookie), T &instance, void *cookie=NULL) throw ()
bool unregisterImageCallback (const CallbackHandle &callbackHandle) throw ()
CallbackHandle registerDepthCallback (const DepthImageCallbackFunction &callback, void *cookie=NULL) throw ()
template<typename T >
CallbackHandle registerDepthCallback (void(T::*callback)(boost::shared_ptr< DepthImage >, void *cookie), T &instance, void *cookie=NULL) throw ()
bool unregisterDepthCallback (const CallbackHandle &callbackHandle) throw ()
const char * getSerialNumber () const throw ()
 returns the serial number for device.
const char * getConnectionString () const throw ()
 returns the connectionstring for current device, which has following format vendorID/productID@BusID/DeviceID
const char * getVendorName () const throw ()
const char * getProductName () const throw ()
unsigned short getVendorID () const throw ()
unsigned short getProductID () const throw ()
unsigned char getBus () const throw ()
unsigned char getAddress () const throw ()

Protected Types

typedef boost::function< void(boost::shared_ptr
< Image >) > 
ActualImageCallbackFunction
typedef boost::function< void(boost::shared_ptr
< DepthImage >) > 
ActualDepthImageCallbackFunction

Protected Member Functions

 OpenNIDevice (xn::Context &context, const xn::NodeInfo &device_node, const xn::NodeInfo &image_node, const xn::NodeInfo &depth_node) throw (OpenNIException)
 OpenNIDevice (xn::Context &context, const xn::NodeInfo &device_node, const xn::NodeInfo &depth_node) throw (OpenNIException)
void ImageDataThreadFunction () throw (OpenNIException)
void DepthDataThreadFunction () throw (OpenNIException)
virtual bool isImageResizeSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const =0 throw ()
void setRegistration (bool on_off) throw (OpenNIException)
virtual boost::shared_ptr< ImagegetCurrentImage (boost::shared_ptr< xn::ImageMetaData > image_data) const =0 throw ()
virtual void getAvailableModes () throw (OpenNIException)
void Init () throw (OpenNIException)

Static Protected Member Functions

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

Protected Attributes

std::map< CallbackHandle,
ActualImageCallbackFunction
image_callback_
std::map< CallbackHandle,
ActualDepthImageCallbackFunction
depth_callback_
std::vector< XnMapOutputMode > available_image_modes_
std::vector< XnMapOutputMode > available_depth_modes_
const xn::NodeInfo & device_node_info_
 node object for current device
xn::Device device_
xn::DepthGenerator depth_generator_
 Depth generator object.
xn::ImageGenerator image_generator_
 Image generator object.
XnCallbackHandle depth_callback_handle_
XnCallbackHandle image_callback_handle_
float depth_focal_length_SXGA_
 focal length for IR camera producing depth information in native SXGA mode
float baseline_
 distance between the projector and the IR camera
xn::Context & context_
XnUInt64 shadow_value_
 the value for shadow (occluded pixels)
XnUInt64 no_sample_value_
 the value for pixels without a valid disparity measurement
OpenNIDevice::CallbackHandle image_callback_handle_counter_
OpenNIDevice::CallbackHandle depth_callback_handle_counter_
bool running_
boost::mutex image_mutex_
boost::mutex depth_mutex_
boost::condition_variable image_condition_
boost::condition_variable depth_condition_
boost::thread image_thread_
boost::thread depth_thread_

Static Protected Attributes

static const float rgb_focal_length_SXGA_
 focal length for regular camera producing color images in native SXGA mode

Detailed Description

Class representing an astract device for Primesense or MS Kinect devices.

Author:
Suat Gedikli
Date:
02.january 2011

Definition at line 69 of file openni_device.h.


Member Typedef Documentation

typedef boost::function<void(boost::shared_ptr<DepthImage>) > openni_wrapper::OpenNIDevice::ActualDepthImageCallbackFunction [protected]

Definition at line 152 of file openni_device.h.

typedef boost::function<void(boost::shared_ptr<Image>) > openni_wrapper::OpenNIDevice::ActualImageCallbackFunction [protected]

Definition at line 151 of file openni_device.h.

Definition at line 74 of file openni_device.h.

typedef boost::function<void(boost::shared_ptr<DepthImage>, void* cookie) openni_wrapper::OpenNIDevice::DepthImageCallbackFunction)

Definition at line 73 of file openni_device.h.

typedef boost::function<void(boost::shared_ptr<Image>, void* cookie) openni_wrapper::OpenNIDevice::ImageCallbackFunction)

Definition at line 72 of file openni_device.h.


Constructor & Destructor Documentation

virtual openni_wrapper::OpenNIDevice::~OpenNIDevice (  )  throw () [virtual]
openni_wrapper::OpenNIDevice::OpenNIDevice ( xn::Context &  context,
const xn::NodeInfo &  device_node,
const xn::NodeInfo &  image_node,
const xn::NodeInfo &  depth_node 
) throw (OpenNIException) [protected]
openni_wrapper::OpenNIDevice::OpenNIDevice ( xn::Context &  context,
const xn::NodeInfo &  device_node,
const xn::NodeInfo &  depth_node 
) throw (OpenNIException) [protected]

Member Function Documentation

void openni_wrapper::OpenNIDevice::DepthDataThreadFunction (  )  throw (OpenNIException) [protected]
virtual bool openni_wrapper::OpenNIDevice::findCompatibleDepthMode ( const XnMapOutputMode &  output_mode,
XnMapOutputMode &  mode 
) const throw (OpenNIException) [virtual]
virtual bool openni_wrapper::OpenNIDevice::findCompatibleImageMode ( const XnMapOutputMode &  output_mode,
XnMapOutputMode &  mode 
) const throw (OpenNIException) [virtual]
unsigned char openni_wrapper::OpenNIDevice::getAddress (  )  const throw ()
virtual void openni_wrapper::OpenNIDevice::getAvailableModes (  )  throw (OpenNIException) [protected, virtual]
float openni_wrapper::OpenNIDevice::getBaseline (  )  const throw () [inline]

Definition at line 239 of file openni_device.h.

unsigned char openni_wrapper::OpenNIDevice::getBus (  )  const throw ()
const char* openni_wrapper::OpenNIDevice::getConnectionString (  )  const throw ()

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

virtual boost::shared_ptr<Image> openni_wrapper::OpenNIDevice::getCurrentImage ( boost::shared_ptr< xn::ImageMetaData >  image_data  )  const throw () [protected, pure virtual]
virtual const XnMapOutputMode& openni_wrapper::OpenNIDevice::getDefaultDepthMode (  )  const throw () [virtual]
virtual const XnMapOutputMode& openni_wrapper::OpenNIDevice::getDefaultImageMode (  )  const throw () [virtual]
float openni_wrapper::OpenNIDevice::getDepthFocalLength ( int  output_x_resolution = 0  )  const throw () [inline]

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 227 of file openni_device.h.

XnMapOutputMode openni_wrapper::OpenNIDevice::getDepthOutputMode (  )  const throw (OpenNIException)
float openni_wrapper::OpenNIDevice::getImageFocalLength ( int  output_x_resolution = 0  )  const throw () [inline]

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 218 of file openni_device.h.

XnMapOutputMode openni_wrapper::OpenNIDevice::getImageOutputMode (  )  const throw (OpenNIException)
unsigned short openni_wrapper::OpenNIDevice::getProductID (  )  const throw ()
const char* openni_wrapper::OpenNIDevice::getProductName (  )  const throw ()
const char* openni_wrapper::OpenNIDevice::getSerialNumber (  )  const throw ()

returns the serial number for device.

Attention:
This might be an empty string!!!
unsigned short openni_wrapper::OpenNIDevice::getVendorID (  )  const throw ()
const char* openni_wrapper::OpenNIDevice::getVendorName (  )  const throw ()
virtual bool openni_wrapper::OpenNIDevice::hasDepthStream (  )  const throw () [virtual]
virtual bool openni_wrapper::OpenNIDevice::hasImageStream (  )  const throw () [virtual]
void openni_wrapper::OpenNIDevice::ImageDataThreadFunction (  )  throw (OpenNIException) [protected]
void openni_wrapper::OpenNIDevice::Init (  )  throw (OpenNIException) [protected]
virtual bool openni_wrapper::OpenNIDevice::isDepthCropped (  )  const throw (OpenNIException) [virtual]

Reimplemented in openni_wrapper::DeviceKinect.

virtual bool openni_wrapper::OpenNIDevice::isDepthCroppingSupported (  )  const throw () [virtual]

Reimplemented in openni_wrapper::DeviceKinect.

virtual bool openni_wrapper::OpenNIDevice::isDepthModeSupported ( const XnMapOutputMode &  output_mode  )  const throw (OpenNIException) [virtual]
bool openni_wrapper::OpenNIDevice::isDepthRegistered (  )  const throw (OpenNIException)
bool openni_wrapper::OpenNIDevice::isDepthStreamRunning (  )  const throw (OpenNIException)
virtual bool openni_wrapper::OpenNIDevice::isImageModeSupported ( const XnMapOutputMode &  output_mode  )  const throw (OpenNIException) [virtual]
virtual bool openni_wrapper::OpenNIDevice::isImageResizeSupported ( unsigned  input_width,
unsigned  input_height,
unsigned  output_width,
unsigned  output_height 
) const throw () [protected, pure virtual]
bool openni_wrapper::OpenNIDevice::isImageStreamRunning (  )  const throw (OpenNIException)
virtual bool openni_wrapper::OpenNIDevice::isSynchronizationSupported (  )  const throw () [virtual]

Reimplemented in openni_wrapper::DeviceKinect.

virtual bool openni_wrapper::OpenNIDevice::isSynchronized (  )  const throw (OpenNIException) [virtual]

Reimplemented in openni_wrapper::DeviceKinect.

static void __stdcall openni_wrapper::OpenNIDevice::NewDepthDataAvailable ( xn::ProductionNode &  node,
void *  cookie 
) throw () [static, protected]
static void __stdcall openni_wrapper::OpenNIDevice::NewImageDataAvailable ( xn::ProductionNode &  node,
void *  cookie 
) throw () [static, protected]
CallbackHandle openni_wrapper::OpenNIDevice::registerDepthCallback ( const DepthImageCallbackFunction callback,
void *  cookie = NULL 
) throw ()
template<typename T >
OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::registerDepthCallback ( void(T::*)(boost::shared_ptr< DepthImage >, void *cookie)  callback,
T &  instance,
void *  cookie = NULL 
) throw ()

Definition at line 250 of file openni_device.h.

template<typename T >
OpenNIDevice::CallbackHandle openni_wrapper::OpenNIDevice::registerImageCallback ( void(T::*)(boost::shared_ptr< Image >, void *cookie)  callback,
T &  instance,
void *  cookie = NULL 
) throw ()

Definition at line 244 of file openni_device.h.

CallbackHandle openni_wrapper::OpenNIDevice::registerImageCallback ( const ImageCallbackFunction callback,
void *  cookie = NULL 
) throw ()
virtual void openni_wrapper::OpenNIDevice::setDepthCropping ( unsigned  x,
unsigned  y,
unsigned  width,
unsigned  height 
) throw (OpenNIException) [virtual]

Reimplemented in openni_wrapper::DeviceKinect.

virtual void openni_wrapper::OpenNIDevice::setDepthOutputMode ( const XnMapOutputMode &  output_mode  )  throw (OpenNIException) [virtual]
void openni_wrapper::OpenNIDevice::setDepthRegistration ( bool  on_off  )  throw (OpenNIException)
virtual void openni_wrapper::OpenNIDevice::setImageOutputMode ( const XnMapOutputMode &  output_mode  )  throw (OpenNIException) [virtual]
void openni_wrapper::OpenNIDevice::setRegistration ( bool  on_off  )  throw (OpenNIException) [protected]
virtual void openni_wrapper::OpenNIDevice::setSynchronization ( bool  on_off  )  throw (OpenNIException) [virtual]

Reimplemented in openni_wrapper::DeviceKinect.

virtual void openni_wrapper::OpenNIDevice::startDepthStream (  )  throw (OpenNIException) [virtual]
virtual void openni_wrapper::OpenNIDevice::startImageStream (  )  throw (OpenNIException) [virtual]
virtual void openni_wrapper::OpenNIDevice::stopDepthStream (  )  throw (OpenNIException) [virtual]
virtual void openni_wrapper::OpenNIDevice::stopImageStream (  )  throw (OpenNIException) [virtual]
bool openni_wrapper::OpenNIDevice::unregisterDepthCallback ( const CallbackHandle callbackHandle  )  throw ()
bool openni_wrapper::OpenNIDevice::unregisterImageCallback ( const CallbackHandle callbackHandle  )  throw ()

Member Data Documentation

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

Definition at line 179 of file openni_device.h.

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

Definition at line 178 of file openni_device.h.

distance between the projector and the IR camera

Definition at line 196 of file openni_device.h.

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

Definition at line 200 of file openni_device.h.

Definition at line 176 of file openni_device.h.

Definition at line 190 of file openni_device.h.

Definition at line 207 of file openni_device.h.

boost::condition_variable openni_wrapper::OpenNIDevice::depth_condition_ [protected]

Definition at line 213 of file openni_device.h.

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

Definition at line 194 of file openni_device.h.

xn::DepthGenerator openni_wrapper::OpenNIDevice::depth_generator_ [protected]

Depth generator object.

Definition at line 186 of file openni_device.h.

boost::mutex openni_wrapper::OpenNIDevice::depth_mutex_ [mutable, protected]

Definition at line 211 of file openni_device.h.

Definition at line 215 of file openni_device.h.

xn::Device openni_wrapper::OpenNIDevice::device_ [protected]

Definition at line 184 of file openni_device.h.

const xn::NodeInfo& openni_wrapper::OpenNIDevice::device_node_info_ [protected]

node object for current device

Definition at line 182 of file openni_device.h.

Definition at line 175 of file openni_device.h.

Definition at line 191 of file openni_device.h.

Definition at line 206 of file openni_device.h.

boost::condition_variable openni_wrapper::OpenNIDevice::image_condition_ [protected]

Definition at line 212 of file openni_device.h.

xn::ImageGenerator openni_wrapper::OpenNIDevice::image_generator_ [protected]

Image generator object.

Definition at line 188 of file openni_device.h.

boost::mutex openni_wrapper::OpenNIDevice::image_mutex_ [mutable, protected]

Definition at line 210 of file openni_device.h.

Definition at line 214 of file openni_device.h.

the value for pixels without a valid disparity measurement

Definition at line 204 of file openni_device.h.

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

Definition at line 198 of file openni_device.h.

Definition at line 209 of file openni_device.h.

the value for shadow (occluded pixels)

Definition at line 202 of file openni_device.h.


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