Point Cloud Library (PCL)
1.14.1-dev
|
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>
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, ActualImageCallbackFunction > | image_callback_ |
std::map< CallbackHandle, ActualDepthImageCallbackFunction > | depth_callback_ |
std::map< CallbackHandle, ActualIRImageCallbackFunction > | ir_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_ |
Class representing an astract device for OpenNI devices: Primesense PSDK, Microsoft Kinect, Asus Xtion Pro/Live.
Definition at line 71 of file openni_device.h.
|
protected |
Definition at line 450 of file openni_device.h.
|
protected |
Definition at line 449 of file openni_device.h.
|
protected |
Definition at line 451 of file openni_device.h.
using openni_wrapper::OpenNIDevice::CallbackHandle = unsigned |
Definition at line 86 of file openni_device.h.
using openni_wrapper::OpenNIDevice::ConstPtr = pcl::shared_ptr<const OpenNIDevice> |
Definition at line 81 of file openni_device.h.
using openni_wrapper::OpenNIDevice::DepthImageCallbackFunction = std::function<void(DepthImage::Ptr, void* cookie) > |
Definition at line 84 of file openni_device.h.
using openni_wrapper::OpenNIDevice::ImageCallbackFunction = std::function<void(Image::Ptr, void* cookie) > |
Definition at line 83 of file openni_device.h.
using openni_wrapper::OpenNIDevice::IRImageCallbackFunction = std::function<void(IRImage::Ptr, void* cookie) > |
Definition at line 85 of file openni_device.h.
using openni_wrapper::OpenNIDevice::Ptr = pcl::shared_ptr<OpenNIDevice> |
Definition at line 80 of file openni_device.h.
Enumerator | |
---|---|
OpenNI_shift_values | |
OpenNI_12_bit_depth |
Definition at line 74 of file openni_device.h.
|
virtualnoexcept |
virtual destructor.
Never throws an exception.
|
protected |
|
protected |
|
protected |
|
protected |
|
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.
[in] | output_mode | the desired output mode |
[out] | mode | the compatible mode that the device natively supports. |
|
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.
[in] | output_mode | the desired output mode |
[out] | mode | the compatible mode that the device natively supports. |
|
noexcept |
|
inlinenoexcept |
Definition at line 587 of file openni_device.h.
References baseline_.
|
noexcept |
|
noexcept |
returns the connection string for current device, which has following format vendorID/productID@BusID/DeviceID.
|
protectedpure virtualnoexcept |
|
noexcept |
returns the default depth mode, which is simply the first entry in the list of modes
|
noexcept |
returns the default image mode, which is simply the first entry in the list of modes
|
noexcept |
returns the default IR mode, which is simply the first entry in the list of modes
|
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.
XnUInt64 openni_wrapper::OpenNIDevice::getDepthOutputFormat | ( | ) | const |
Get the depth output format as set by the user.
XnMapOutputMode openni_wrapper::OpenNIDevice::getDepthOutputMode | ( | ) | 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.
XnMapOutputMode openni_wrapper::OpenNIDevice::getImageOutputMode | ( | ) | const |
XnMapOutputMode openni_wrapper::OpenNIDevice::getIROutputMode | ( | ) | const |
|
noexcept |
|
noexcept |
|
noexcept |
returns the serial number for device.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
protected |
|
protected |
|
protected |
|
protected |
bool openni_wrapper::OpenNIDevice::isDepthCropped | ( | ) | const |
|
noexcept |
|
noexcept |
returns whether a given mode is natively supported by the device or not
[in] | output_mode | mode to be checked |
|
noexcept |
|
noexcept |
|
virtualnoexcept |
Reimplemented in openni_wrapper::DeviceONI.
|
noexcept |
returns whether a given mode is natively supported by the device or not
[in] | output_mode | mode to be checked |
|
protectedpure virtualnoexcept |
|
virtualnoexcept |
Reimplemented in openni_wrapper::DeviceONI.
|
virtualnoexcept |
Reimplemented in openni_wrapper::DeviceONI.
|
virtualnoexcept |
Reimplemented in openni_wrapper::DeviceKinect.
|
noexcept |
|
staticprotectednoexcept |
|
staticprotectednoexcept |
|
staticprotectednoexcept |
|
protected |
|
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".
[in] | callback | the user callback to be called if a new depth image is available |
[in] | cookie | the cookie that needs to be passed to the callback together with the new depth image. |
|
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".
[in] | callback | the user callback to be called if a new depth image is available |
instance | ||
[in] | cookie | the cookie that needs to be passed to the callback together with the new depth image. |
Definition at line 602 of file openni_device.h.
|
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".
[in] | callback | the user callback to be called if a new image is available |
[in] | cookie | the cookie that needs to be passed to the callback together with the new image. |
|
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".
[in] | callback | the user callback to be called if a new image is available |
instance | ||
[in] | cookie | the cookie that needs to be passed to the callback together with the new image. |
Definition at line 594 of file openni_device.h.
|
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".
[in] | callback | the user callback to be called if a new IR image is available |
[in] | cookie | the cookie that needs to be passed to the callback together with the new IR image. |
|
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".
[in] | callback | the user callback to be called if a new IR image is available |
instance | ||
[in] | cookie | the cookie that needs to be passed to the callback together with the new IR image. |
Definition at line 610 of file openni_device.h.
void openni_wrapper::OpenNIDevice::setDepthCropping | ( | unsigned | x, |
unsigned | y, | ||
unsigned | width, | ||
unsigned | height | ||
) |
turn on cropping for the depth stream.
[in] | x | x-position of the rectangular subregion. |
[in] | y | y-position of the rectangular subregion. |
[in] | width | width of the rectangular subregion. |
[in] | height | height of the rectangular subregion. |
|
inline |
Set the depth image focal length.
[in] | focal_length | the depth image focal length |
Definition at line 413 of file openni_device.h.
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.
[in] | depth_mode | the depth output format |
void openni_wrapper::OpenNIDevice::setDepthOutputMode | ( | const XnMapOutputMode & | output_mode | ) |
sets the output mode of the depth stream
[in] | output_mode | the desired output mode |
void openni_wrapper::OpenNIDevice::setDepthRegistration | ( | bool | on_off | ) |
set the depth stream registration on or off
[in] | on_off |
void openni_wrapper::OpenNIDevice::setImageOutputMode | ( | const XnMapOutputMode & | output_mode | ) |
sets the output mode of the image stream
[in] | output_mode | the desired output mode |
void openni_wrapper::OpenNIDevice::setIROutputMode | ( | const XnMapOutputMode & | output_mode | ) |
sets the output mode of the IR stream
[in] | output_mode | the desired output mode |
|
protected |
|
inline |
Set the RGB image focal length.
[in] | focal_length | the RGB image focal length |
Definition at line 404 of file openni_device.h.
void openni_wrapper::OpenNIDevice::setSynchronization | ( | bool | on_off | ) |
set the hardware synchronization between Depth and RGB stream on or off.
[in] | on_off |
|
inline |
Convert shift to depth value.
Definition at line 431 of file openni_device.h.
|
virtual |
starts the depth stream.
Reimplemented in openni_wrapper::DeviceXtionPro, openni_wrapper::DevicePrimesense, and openni_wrapper::DeviceONI.
|
virtual |
starts the image stream.
Reimplemented in openni_wrapper::DevicePrimesense, and openni_wrapper::DeviceONI.
|
virtual |
starts the IR stream.
Reimplemented in openni_wrapper::DeviceONI.
|
virtual |
stops the depth stream.
Reimplemented in openni_wrapper::DeviceONI.
|
virtual |
stops the image stream.
Reimplemented in openni_wrapper::DeviceONI.
|
virtual |
stops the IR stream.
Reimplemented in openni_wrapper::DeviceONI.
|
noexcept |
unregisters a callback function.
i.e. removes that function from the list of depth stream callbacks.
[in] | callbackHandle | the handle of the callback to unregister. |
|
noexcept |
unregisters a callback function.
i.e. removes that function from the list of image stream callbacks.
[in] | callbackHandle | the handle of the callback to unregister. |
|
noexcept |
unregisters a callback function.
i.e. removes that function from the list of IR stream callbacks.
[in] | callbackHandle | the handle of the callback to unregister. |
|
protected |
Definition at line 515 of file openni_device.h.
|
protected |
Definition at line 514 of file openni_device.h.
|
protected |
distance between the projector and the IR camera
Definition at line 536 of file openni_device.h.
Referenced by getBaseline().
|
protected |
context to OpenNI driver
Definition at line 518 of file openni_device.h.
|
protected |
Definition at line 511 of file openni_device.h.
|
protected |
Definition at line 529 of file openni_device.h.
|
protected |
Definition at line 546 of file openni_device.h.
|
protected |
Definition at line 554 of file openni_device.h.
|
protected |
focal length for IR camera producing depth information in native SXGA mode
Definition at line 534 of file openni_device.h.
|
protected |
Depth generator object.
Definition at line 523 of file openni_device.h.
|
mutableprotected |
Definition at line 551 of file openni_device.h.
|
protected |
Definition at line 557 of file openni_device.h.
|
protected |
node object for current device
Definition at line 520 of file openni_device.h.
|
protected |
Definition at line 510 of file openni_device.h.
|
protected |
Definition at line 530 of file openni_device.h.
|
protected |
Definition at line 545 of file openni_device.h.
|
protected |
Definition at line 553 of file openni_device.h.
|
protected |
Image generator object.
Definition at line 525 of file openni_device.h.
|
mutableprotected |
Definition at line 550 of file openni_device.h.
|
protected |
Definition at line 556 of file openni_device.h.
|
protected |
Definition at line 512 of file openni_device.h.
|
protected |
Definition at line 531 of file openni_device.h.
|
protected |
Definition at line 547 of file openni_device.h.
|
protected |
Definition at line 555 of file openni_device.h.
|
protected |
IR generator object.
Definition at line 527 of file openni_device.h.
|
mutableprotected |
Definition at line 552 of file openni_device.h.
|
protected |
Definition at line 558 of file openni_device.h.
|
protected |
the value for pixels without a valid disparity measurement
Definition at line 543 of file openni_device.h.
|
protected |
Definition at line 549 of file openni_device.h.
|
protected |
focal length for regular camera producing color images in native SXGA mode
Definition at line 538 of file openni_device.h.
|
protected |
the value for shadow (occluded pixels)
Definition at line 541 of file openni_device.h.
|
protected |
|
protected |
Definition at line 505 of file openni_device.h.