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()
bool hasDepthStream() const
virtual bool isImageResizeSupported(unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const =0
virtual bool findCompatibleImageMode(const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const
unsigned short getVendorID() const
virtual void startImageStream()
XnMapOutputMode getDepthOutputMode() const
virtual bool isDepthStreamRunning() const
boost::condition_variable depth_condition_
boost::function< void(boost::shared_ptr< IRImage >, void *cookie) > IRImageCallbackFunction
virtual void setSynchronization(bool on_off)
unsigned char getAddress() const
void setRegistration(bool on_off)
virtual bool isSynchronizationSupported() const
CallbackHandle registerIRCallback(const IRImageCallbackFunction &callback, void *cookie=NULL)
boost::function< void(boost::shared_ptr< Image >) > ActualImageCallbackFunction
std::map< CallbackHandle, ActualIRImageCallbackFunction > ir_callback_
virtual bool isSynchronized() const
xn::IRGenerator ir_generator_
IR generator object.
OpenNIDevice::CallbackHandle image_callback_handle_counter_
static void __stdcall NewIRDataAvailable(xn::ProductionNode &node, void *cookie)
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 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)
virtual bool isDepthRegistrationSupported() const
std::vector< XnMapOutputMode > available_image_modes_
virtual boost::shared_ptr< Image > getCurrentImage(boost::shared_ptr< xn::ImageMetaData > image_data) const =0
virtual void stopDepthStream()
virtual bool isDepthCropped() const
float baseline_
distance between the projector and the IR camera
bool unregisterImageCallback(const CallbackHandle &callbackHandle)
const char * getSerialNumber()
returns the serial number for device.
XnMapOutputMode getIROutputMode() const
float getBaseline() const
void ImageDataThreadFunction()
XnUInt64 no_sample_value_
boost::condition_variable ir_condition_
boost::function< void(boost::shared_ptr< DepthImage >) > ActualDepthImageCallbackFunction
virtual void setImageOutputMode(const XnMapOutputMode &output_mode)
static void __stdcall NewImageDataAvailable(xn::ProductionNode &node, void *cookie)
boost::mutex image_mutex_
virtual const XnMapOutputMode & getDefaultDepthMode() const
virtual bool isIRStreamRunning() const
virtual void setDepthOutputMode(const XnMapOutputMode &output_mode)
virtual const XnMapOutputMode & getDefaultIRMode() const
bool hasImageStream() const
XnCallbackHandle ir_callback_handle_
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...
boost::thread_group data_threads_
virtual const XnMapOutputMode & getDefaultImageMode() const
virtual bool isDepthCroppingSupported() 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_
virtual bool isDepthModeSupported(const XnMapOutputMode &output_mode) const
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_
unsigned short getProductID() const
static void __stdcall NewDepthDataAvailable(xn::ProductionNode &node, void *cookie)
XnCallbackHandle depth_callback_handle_
xn::ImageGenerator image_generator_
Image generator object.
virtual bool isImageModeSupported(const XnMapOutputMode &output_mode) const
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()
std::map< CallbackHandle, ActualDepthImageCallbackFunction > depth_callback_
const char * getProductName() const
virtual void stopIRStream()
const char * getVendorName() const
CallbackHandle registerImageCallback(const ImageCallbackFunction &callback, void *cookie=NULL)
bool isDepthRegistered() const
virtual void setIROutputMode(const XnMapOutputMode &output_mode)
Class representing an astract device for Primesense or MS Kinect devices.
const char * getConnectionString() const
returns the connectionstring for current device, which has following format vendorID/productID@BusID/...
unsigned char getBus() const
xn::Context & context_
context to OpenNI driver
This class provides methods to fill a depth or disparity image.
OpenNIDevice::CallbackHandle depth_callback_handle_counter_
std::vector< XnMapOutputMode > available_depth_modes_
boost::mutex depth_mutex_
Class containing just a reference to IR meta data.
XnMapOutputMode getImageOutputMode() const
OpenNIDevice::CallbackHandle ir_callback_handle_counter_
virtual bool isImageStreamRunning() const
virtual void startDepthStream()
virtual void startIRStream()
virtual bool findCompatibleDepthMode(const XnMapOutputMode &output_mode, XnMapOutputMode &mode) const
static const float rgb_focal_length_SXGA_
focal length for regular camera producing color images in native SXGA mode