40 #include <pcl/pcl_config.h>
44 #include "openni_exception.h"
47 #include <pcl/io/boost.h>
48 #include <pcl/io/openni_camera/openni_image.h>
49 #include <pcl/io/openni_camera/openni_depth_image.h>
50 #include <pcl/io/openni_camera/openni_ir_image.h>
53 #include <condition_variable>
78 OpenNI_shift_values = 0,
79 OpenNI_12_bit_depth = 1,
82 using Ptr = pcl::shared_ptr<OpenNIDevice>;
83 using ConstPtr = pcl::shared_ptr<const OpenNIDevice>;
103 findCompatibleImageMode (const XnMapOutputMode& output_mode, XnMapOutputMode& mode ) const throw ();
113 findCompatibleDepthMode (const XnMapOutputMode& output_mode, XnMapOutputMode& mode ) const throw ();
120 isImageModeSupported (const XnMapOutputMode& output_mode) const throw ();
127 isDepthModeSupported (const XnMapOutputMode& output_mode) const throw ();
132 const XnMapOutputMode&
133 getDefaultImageMode () const throw ();
138 const XnMapOutputMode&
139 getDefaultDepthMode () const throw ();
144 const XnMapOutputMode&
145 getDefaultIRMode () const throw ();
151 setImageOutputMode (const XnMapOutputMode& output_mode);
157 setDepthOutputMode (const XnMapOutputMode& output_mode);
163 setIROutputMode (const XnMapOutputMode& output_mode);
167 getImageOutputMode () const;
171 getDepthOutputMode () const;
175 getIROutputMode () const;
181 setDepthRegistration (
bool on_off);
185 isDepthRegistered () const throw ();
189 isDepthRegistrationSupported () const throw ();
195 setSynchronization (
bool on_off);
199 isSynchronized () const throw ();
203 isSynchronizationSupported () const throw ();
207 isDepthCropped () const;
216 setDepthCropping (
unsigned x,
unsigned y,
unsigned width,
unsigned height);
220 isDepthCroppingSupported () const throw ();
226 getImageFocalLength (
int output_x_resolution = 0) const throw ();
232 getDepthFocalLength (
int output_x_resolution = 0) const throw ();
236 getBaseline () const throw ();
264 hasImageStream () const throw ();
268 hasDepthStream () const throw ();
272 hasIRStream () const throw ();
276 isImageStreamRunning () const throw ();
280 isDepthStreamRunning () const throw ();
284 isIRStreamRunning () const throw ();
304 registerImageCallback (
void (T::*callback)(
Image::
Ptr,
void* cookie), T& instance,
void* cookie =
nullptr) noexcept;
332 registerDepthCallback (
void (T::*callback)(
DepthImage::
Ptr,
void* cookie), T& instance,
void* cookie =
nullptr) noexcept;
359 registerIRCallback (
void (T::*callback)(
IRImage::
Ptr,
void* cookie), T& instance,
void* cookie =
nullptr) noexcept;
372 getSerialNumber () const throw ();
376 getConnectionString () const throw ();
380 getVendorName () const throw ();
384 getProductName () const throw ();
388 getVendorID () const throw ();
392 getProductID () const throw ();
396 getBus () const throw ();
400 getAddress () const throw ();
406 setRGBFocalLength (
float focal_length)
408 rgb_focal_length_SXGA_ = focal_length;
417 depth_focal_length_SXGA_ = focal_length;
435 assert (shift_conversion_parameters_.init_);
440 if (shift_value<shift_to_depth_table_.size())
441 ret = shift_to_depth_table_[shift_value];
455 OpenNIDevice (xn::Context& context,
const xn::NodeInfo& device_node,
const xn::NodeInfo& image_node,
const xn::NodeInfo& depth_node,
const xn::NodeInfo& ir_node);
456 OpenNIDevice (xn::Context& context,
const xn::NodeInfo& device_node,
const xn::NodeInfo& depth_node,
const xn::NodeInfo& ir_node);
474 isImageResizeSupported (
unsigned input_width,
unsigned input_height,
unsigned output_width,
unsigned output_height)
const throw () = 0;
505 } shift_conversion_parameters_;
567 if (output_x_resolution == 0)
568 output_x_resolution = getImageOutputMode ().nXRes;
570 float scale =
static_cast<float> (output_x_resolution) /
static_cast<float> (XN_SXGA_X_RES);
571 return (rgb_focal_length_SXGA_ * scale);
578 if (output_x_resolution == 0)
579 output_x_resolution = getDepthOutputMode ().nXRes;
581 float scale =
static_cast<float> (output_x_resolution) /
static_cast<float> (XN_SXGA_X_RES);
582 if (isDepthRegistered ())
583 return (rgb_focal_length_SXGA_ * scale);
584 return (depth_focal_length_SXGA_ * scale);
598 image_callback_[image_callback_handle_counter_] = [=, &instance] (
Image::Ptr img) { (instance.*callback) (img, custom_data); };
599 return (image_callback_handle_counter_++);
606 depth_callback_[depth_callback_handle_counter_] = [=, &instance] (
DepthImage::Ptr img) { (instance.*callback) (img, custom_data); };
607 return (depth_callback_handle_counter_++);
614 ir_callback_[ir_callback_handle_counter_] = [=, &instance] (
IRImage::Ptr img) { (instance.*callback) (img, custom_data); };
615 return (ir_callback_handle_counter_++);
619 #endif // HAVE_OPENNI