38 #ifndef __OPENNI_IDEVICE_H__ 39 #define __OPENNI_IDEVICE_H__ 44 #include <XnCppWrapper.h> 45 #include <boost/noncopyable.hpp> 46 #include <boost/function.hpp> 47 #include <boost/thread.hpp> 48 #include <boost/thread/condition.hpp> 79 virtual
bool findCompatibleDepthMode (const XnMapOutputMode& output_mode, XnMapOutputMode& mode ) const throw (OpenNIException);
81 virtual
bool isImageModeSupported (const XnMapOutputMode& output_mode) const throw (OpenNIException);
82 virtual
bool isDepthModeSupported (const XnMapOutputMode& output_mode) const throw (OpenNIException);
88 virtual
void setImageOutputMode (const XnMapOutputMode& output_mode) throw (OpenNIException);
89 virtual
void setDepthOutputMode (const XnMapOutputMode& output_mode) throw (OpenNIException);
90 virtual
void setIROutputMode (const XnMapOutputMode& output_mode) throw (OpenNIException);
106 virtual
void setDepthCropping (
unsigned x,
unsigned y,
unsigned width,
unsigned height) throw (OpenNIException);
138 template<typename T> CallbackHandle
registerImageCallback (
void (T::*callback)(
boost::shared_ptr<
Image>,
void* cookie), T& instance,
void* cookie = NULL) throw ();
146 template<typename T> CallbackHandle
registerIRCallback (
void (T::*callback)(
boost::shared_ptr<
IRImage>,
void* cookie), T& instance,
void* cookie = NULL) throw ();
160 unsigned char getBus () const throw ();
167 OpenNIDevice (xn::Context& context, const xn::NodeInfo& device_node, const xn::NodeInfo& image_node, const xn::NodeInfo& depth_node, const xn::NodeInfo& ir_node) throw (OpenNIException);
168 OpenNIDevice (xn::Context& context, const xn::NodeInfo& device_node, const xn::NodeInfo& depth_node, const xn::NodeInfo& ir_node) throw (OpenNIException);
169 OpenNIDevice (xn::Context& context) throw (OpenNIException);
180 virtual
bool isImageResizeSupported (
unsigned input_width,
unsigned input_height,
unsigned output_width,
unsigned output_height) const throw () = 0;
186 void Init () throw (OpenNIException);
241 if (output_x_resolution == 0)
244 float scale = output_x_resolution / (float)XN_SXGA_X_RES;
245 return rgb_focal_length_SXGA_ * scale;
250 if (output_x_resolution == 0)
253 float scale = output_x_resolution / (float)XN_SXGA_X_RES;
284 #endif // __OPENNI_IDEVICE_H__ void IRDataThreadFunction()
virtual bool isImageResizeSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const =0
virtual bool isImageStreamRunning() const
float getImageFocalLength(int output_x_resolution=0) const
returns the focal length for the color camera in pixels. The pixels are assumed to be square...
virtual void startImageStream()
boost::condition_variable depth_condition_
boost::function< void(boost::shared_ptr< IRImage >, void *cookie) > IRImageCallbackFunction
unsigned short getVendorID() const
const char * getProductName() const
virtual void setSynchronization(bool on_off)
void setRegistration(bool on_off)
CallbackHandle registerIRCallback(const IRImageCallbackFunction &callback, void *cookie=NULL)
boost::function< void(boost::shared_ptr< Image >) > ActualImageCallbackFunction
std::map< CallbackHandle, ActualIRImageCallbackFunction > ir_callback_
virtual bool isDepthCropped() const
xn::IRGenerator ir_generator_
IR generator object.
OpenNIDevice::CallbackHandle image_callback_handle_counter_
virtual bool isDepthCroppingSupported() const
static void __stdcall NewIRDataAvailable(xn::ProductionNode &node, void *cookie)
virtual void enumAvailableModes()
Image class containing just a reference to image meta data. Thus this class just provides an interfac...
virtual void setDepthCropping(unsigned x, unsigned y, unsigned width, unsigned height)
std::vector< XnMapOutputMode > available_image_modes_
virtual boost::shared_ptr< Image > getCurrentImage(boost::shared_ptr< xn::ImageMetaData > image_data) const =0
virtual void stopDepthStream()
float baseline_
distance between the projector and the IR camera
bool unregisterImageCallback(const CallbackHandle &callbackHandle)
const char * getSerialNumber()
returns the serial number for device.
virtual bool isDepthStreamRunning() const
void ImageDataThreadFunction()
XnUInt64 no_sample_value_
boost::condition_variable ir_condition_
bool hasDepthStream() const
boost::function< void(boost::shared_ptr< DepthImage >) > ActualDepthImageCallbackFunction
virtual void setImageOutputMode(const XnMapOutputMode &output_mode)
virtual bool isIRStreamRunning() const
virtual bool isDepthRegistrationSupported() const
virtual const XnMapOutputMode & getDefaultDepthMode() const
static void __stdcall NewImageDataAvailable(xn::ProductionNode &node, void *cookie)
boost::mutex image_mutex_
virtual void setDepthOutputMode(const XnMapOutputMode &output_mode)
XnCallbackHandle ir_callback_handle_
boost::thread_group data_threads_
unsigned short getProductID() const
bool hasImageStream() const
bool unregisterIRCallback(const CallbackHandle &callbackHandle)
xn::DepthGenerator depth_generator_
Depth generator object.
bool unregisterDepthCallback(const CallbackHandle &callbackHandle)
std::map< CallbackHandle, ActualImageCallbackFunction > image_callback_
CallbackHandle registerDepthCallback(const DepthImageCallbackFunction &callback, void *cookie=NULL)
boost::condition_variable image_condition_
float depth_focal_length_SXGA_
focal length for IR camera producing depth information in native SXGA mode
xn::NodeInfo device_node_info_
node object for current device
virtual void setDepthRegistration(bool on_off)
XnCallbackHandle image_callback_handle_
virtual bool isSynchronizationSupported() const
static void __stdcall NewDepthDataAvailable(xn::ProductionNode &node, void *cookie)
XnMapOutputMode getIROutputMode() const
XnCallbackHandle depth_callback_handle_
xn::ImageGenerator image_generator_
Image generator object.
virtual void stopImageStream()
boost::function< void(boost::shared_ptr< IRImage >) > ActualIRImageCallbackFunction
boost::function< void(boost::shared_ptr< DepthImage >, void *cookie) > DepthImageCallbackFunction
boost::function< void(boost::shared_ptr< Image >, void *cookie) > ImageCallbackFunction
void DepthDataThreadFunction()
unsigned char getBus() const
std::map< CallbackHandle, ActualDepthImageCallbackFunction > depth_callback_
unsigned char getAddress() const
XnMapOutputMode getImageOutputMode() const
const char * getConnectionString() const
returns the connectionstring for current device, which has following format vendorID/productID@BusID/...
virtual void stopIRStream()
CallbackHandle registerImageCallback(const ImageCallbackFunction &callback, void *cookie=NULL)
virtual const XnMapOutputMode & getDefaultImageMode() const
const char * getVendorName() const
virtual void setIROutputMode(const XnMapOutputMode &output_mode)
float getBaseline() const
float getDepthFocalLength(int output_x_resolution=0) const
returns the focal length for the IR camera in pixels. The pixels are assumed to be square...
Class representing an astract device for Primesense or MS Kinect devices.
virtual bool isSynchronized() const
XnMapOutputMode getDepthOutputMode() const
xn::Context & context_
context to OpenNI driver
This class provides methods to fill a depth or disparity image.
virtual bool findCompatibleDepthMode(const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const
bool isDepthRegistered() const
OpenNIDevice::CallbackHandle depth_callback_handle_counter_
virtual bool isDepthModeSupported(const XnMapOutputMode &output_mode) const
virtual bool findCompatibleImageMode(const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const
std::vector< XnMapOutputMode > available_depth_modes_
boost::mutex depth_mutex_
Class containing just a reference to IR meta data.
OpenNIDevice::CallbackHandle ir_callback_handle_counter_
virtual void startDepthStream()
virtual void startIRStream()
virtual bool isImageModeSupported(const XnMapOutputMode &output_mode) const
virtual const XnMapOutputMode & getDefaultIRMode() const
static const float rgb_focal_length_SXGA_
focal length for regular camera producing color images in native SXGA mode