Point Cloud Library (PCL) 1.15.0
Loading...
Searching...
No Matches
openni_wrapper::DeviceKinect Class Reference

Concrete implementation of the interface OpenNIDevice for a MS Kinect device. More...

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

Inheritance diagram for openni_wrapper::DeviceKinect:
Collaboration diagram for openni_wrapper::DeviceKinect:

Public Member Functions

 DeviceKinect (xn::Context &context, const xn::NodeInfo &device_node, const xn::NodeInfo &image_node, const xn::NodeInfo &depth_node, const xn::NodeInfo &ir_node)
 ~DeviceKinect () noexcept override
void setDebayeringMethod (const ImageBayerGRBG::DebayeringMethod &debayering_method) noexcept
const ImageBayerGRBG::DebayeringMethodgetDebayeringMethod () const noexcept
bool isSynchronizationSupported () const noexcept override
Public Member Functions inherited from openni_wrapper::OpenNIDevice
virtual ~OpenNIDevice () noexcept
 virtual destructor.
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.
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.
bool isImageModeSupported (const XnMapOutputMode &output_mode) const noexcept
 returns whether a given mode is natively supported by the device or not
bool isDepthModeSupported (const XnMapOutputMode &output_mode) const noexcept
 returns whether a given mode is natively supported by the device or not
const XnMapOutputMode & getDefaultImageMode () const noexcept
 returns the default image mode, which is simply the first entry in the list of modes
const XnMapOutputMode & getDefaultDepthMode () const noexcept
 returns the default depth mode, which is simply the first entry in the list of modes
const XnMapOutputMode & getDefaultIRMode () const noexcept
 returns the default IR mode, which is simply the first entry in the list of modes
void setImageOutputMode (const XnMapOutputMode &output_mode)
 sets the output mode of the image stream
void setDepthOutputMode (const XnMapOutputMode &output_mode)
 sets the output mode of the depth stream
void setIROutputMode (const XnMapOutputMode &output_mode)
 sets the output mode of the IR stream
XnMapOutputMode getImageOutputMode () const
XnMapOutputMode getDepthOutputMode () const
XnMapOutputMode getIROutputMode () const
void setDepthRegistration (bool on_off)
 set the depth stream registration on or off
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.
bool isSynchronized () const noexcept
bool isDepthCropped () const
void setDepthCropping (unsigned x, unsigned y, unsigned width, unsigned height)
 turn on cropping for the depth stream.
bool isDepthCroppingSupported () const noexcept
float getImageFocalLength (int output_x_resolution=0) const noexcept
 returns the focal length for the color camera in pixels.
float getDepthFocalLength (int output_x_resolution=0) const noexcept
 returns the focal length for the IR camera in pixels.
float getBaseline () const noexcept
virtual void startImageStream ()
 starts the image stream.
virtual void stopImageStream ()
 stops the image stream.
virtual void startDepthStream ()
 starts the depth stream.
virtual void stopDepthStream ()
 stops the depth stream.
virtual void startIRStream ()
 starts the IR stream.
virtual void stopIRStream ()
 stops the IR stream.
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.
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.
bool unregisterImageCallback (const CallbackHandle &callbackHandle) noexcept
 unregisters a callback function.
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.
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.
bool unregisterDepthCallback (const CallbackHandle &callbackHandle) noexcept
 unregisters a callback function.
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.
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.
bool unregisterIRCallback (const CallbackHandle &callbackHandle) noexcept
 unregisters a callback function.
const char * getSerialNumber () const noexcept
 returns the serial number for device.
const char * getConnectionString () const noexcept
 returns the connection string for current device, which has following format vendorID/productID@BusID/DeviceID.
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.
void setDepthFocalLength (float focal_length)
 Set the depth image focal length.
void setDepthOutputFormat (const DepthMode &depth_mode=OpenNI_12_bit_depth)
 Set the depth output format.
XnUInt64 getDepthOutputFormat () const
 Get the depth output format as set by the user.
std::uint16_t shiftToDepth (std::uint16_t shift_value) const
 Convert shift to depth value.

Protected Member Functions

Image::Ptr getCurrentImage (pcl::shared_ptr< xn::ImageMetaData > image_meta_data) const noexcept override
void enumAvailableModes () noexcept
bool isImageResizeSupported (unsigned input_width, unsigned input_height, unsigned output_width, unsigned output_height) const noexcept override
Protected Member Functions inherited from openni_wrapper::OpenNIDevice
 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 ()
void setRegistration (bool on_off)
void Init ()
void InitShiftToDepthConversion ()
void ReadDeviceParametersFromSensorNode ()

Protected Attributes

ImageBayerGRBG::DebayeringMethod debayering_method_ {ImageBayerGRBG::EdgeAwareWeighted}
Protected Attributes inherited from openni_wrapper::OpenNIDevice
struct openni_wrapper::OpenNIDevice::ShiftConversion shift_conversion_parameters_
std::vector< std::uint16_t > shift_to_depth_table_
std::map< CallbackHandle, ActualImageCallbackFunctionimage_callback_
std::map< CallbackHandle, ActualDepthImageCallbackFunctiondepth_callback_
std::map< CallbackHandle, ActualIRImageCallbackFunctionir_callback_
std::vector< XnMapOutputMode > available_image_modes_
std::vector< XnMapOutputMode > available_depth_modes_
xn::Context & context_
 context to OpenNI driver
xn::NodeInfo device_node_info_
 node object for current device
xn::DepthGenerator depth_generator_
 Depth generator object.
xn::ImageGenerator image_generator_
 Image generator object.
xn::IRGenerator ir_generator_
 IR generator object.
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
float baseline_
 distance between the projector and the IR camera
float rgb_focal_length_SXGA_
 focal length for regular camera producing color images in native SXGA mode
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_
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_

Friends

class OpenNIDriver

Additional Inherited Members

Public Types inherited from openni_wrapper::OpenNIDevice
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
Protected Types inherited from openni_wrapper::OpenNIDevice
using ActualImageCallbackFunction = std::function<void(Image::Ptr) >
using ActualDepthImageCallbackFunction = std::function<void(DepthImage::Ptr) >
using ActualIRImageCallbackFunction = std::function<void(IRImage::Ptr) >
Static Protected Member Functions inherited from openni_wrapper::OpenNIDevice
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

Detailed Description

Concrete implementation of the interface OpenNIDevice for a MS Kinect device.

Author
Suat Gedikli
Date
02.january 2011

Definition at line 56 of file openni_device_kinect.h.

Constructor & Destructor Documentation

◆ DeviceKinect()

openni_wrapper::DeviceKinect::DeviceKinect ( xn::Context & context,
const xn::NodeInfo & device_node,
const xn::NodeInfo & image_node,
const xn::NodeInfo & depth_node,
const xn::NodeInfo & ir_node )

◆ ~DeviceKinect()

openni_wrapper::DeviceKinect::~DeviceKinect ( )
overridenoexcept

Member Function Documentation

◆ enumAvailableModes()

void openni_wrapper::DeviceKinect::enumAvailableModes ( )
protectednoexcept

References enumAvailableModes().

Referenced by enumAvailableModes().

◆ getCurrentImage()

Image::Ptr openni_wrapper::DeviceKinect::getCurrentImage ( pcl::shared_ptr< xn::ImageMetaData > image_meta_data) const
overrideprotectedvirtualnoexcept

Implements openni_wrapper::OpenNIDevice.

References getCurrentImage().

Referenced by getCurrentImage().

◆ getDebayeringMethod()

const ImageBayerGRBG::DebayeringMethod & openni_wrapper::DeviceKinect::getDebayeringMethod ( ) const
inlinenoexcept

Definition at line 82 of file openni_device_kinect.h.

References debayering_method_.

Referenced by ~DeviceKinect().

◆ isImageResizeSupported()

bool openni_wrapper::DeviceKinect::isImageResizeSupported ( unsigned input_width,
unsigned input_height,
unsigned output_width,
unsigned output_height ) const
overrideprotectedvirtualnoexcept

◆ isSynchronizationSupported()

bool openni_wrapper::DeviceKinect::isSynchronizationSupported ( ) const
overridevirtualnoexcept
Returns
true if the Device supports hardware synchronization between Depth and RGB streams or not.

Reimplemented from openni_wrapper::OpenNIDevice.

References isSynchronizationSupported().

Referenced by isSynchronizationSupported().

◆ setDebayeringMethod()

void openni_wrapper::DeviceKinect::setDebayeringMethod ( const ImageBayerGRBG::DebayeringMethod & debayering_method)
inlinenoexcept

Definition at line 76 of file openni_device_kinect.h.

References debayering_method_.

Referenced by ~DeviceKinect().

◆ OpenNIDriver

friend class OpenNIDriver
friend

Definition at line 58 of file openni_device_kinect.h.

References OpenNIDriver.

Referenced by OpenNIDriver.

Member Data Documentation

◆ debayering_method_

ImageBayerGRBG::DebayeringMethod openni_wrapper::DeviceKinect::debayering_method_ {ImageBayerGRBG::EdgeAwareWeighted}
protected

Definition at line 72 of file openni_device_kinect.h.

Referenced by getDebayeringMethod(), and setDebayeringMethod().


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