iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::OpenNIImageSource Class Reference

#include <nrt/ImageProc/IO/ImageSource/OpenNIImageSource.H>

An image source for capturing image data from an OpenNI compatible device.

OpenNI devices are asynchronous sources of data and as such a call to in() is not guaranteed to always produce new data - new data is available when ok() returns true.

In the case of requesting a mixed data format from the device, such as image + depth (a color depth map), the resultant images will be the size of the largest data source between the desired sources with the smaller source scaled to match the larger one.

For example, if your device produces a 640x480 color image and has a 320x240 depth sensor, the depth sensor image will be resized to 640x480. If this functionality is not desired, request the items individually.

By default, any mixed data types will attempt to register the depth sensor to the image sensor.

Examples:
tests/test-PointCloud2OpenNI.C.

Definition at line 115 of file OpenNIImageSource.H.

Inheritance diagram for nrt::OpenNIImageSource:
nrt::Parameter< openni::datatype, openni::DepthResolution, openni::ImageResolution, openni::IRResolution, openni::interpolate, openni::DepthFPS, openni::ImageFPS, openni::IRFPS, openni::mirror, openni::xml >

Classes

struct  OpenNIData
 A struct containing metadata from the device. More...
 

Public Member Functions

 OpenNIImageSource (std::string instanceID="OpenNI")
 
const bool ok () const
 Checks whether there is a new image available from in()
 
GenericImage const in ()
 Returns the latest image from the OpenNI device that matches our parameters.
 
void in_rgbd (GenericImage &rgb, GenericImage &d, GenericImage &ir)
 Returns the latest combo RGB+depth+ir data from the OpenNI device that matches our parameters.
 
OpenNIData const & getDeviceData () const
 Returns existing device data (data will only be valid after device is initialized)
 
- Public Member Functions inherited from nrt::ImageSourceType
 ImageSourceType (std::string const &instanceID="ImageSourceType")
 
virtual nrt::GenericImage const in ()=0
 
virtual bool const ok () const =0
 
- Public Member Functions inherited from nrt::Component
 Component (std::string const &instanceName)
 Constructor. More...
 
void prepareForDeletion ()
 Prepare for deletion: uninit and disconnect from our parent. More...
 
virtual ~Component ()
 Virtual destructor for safe inheritance. More...
 
template<>
std::shared_ptr< ComponentgetSubComponent (std::string const &instanceName) const
 
template<class Comp >
std::shared_ptr< Comp > addSubComponent (std::string const &instanceName="")
 Pseudo-constructor: construct and add another component as a subcomponent of this one. More...
 
template<class Comp >
void removeSubComponent (std::shared_ptr< Comp > &component)
 Remove a sub-Component from this Component, by shared_ptr. More...
 
void removeSubComponent (std::string const &instanceName)
 Remove a sub-Component from this Component, by instance name.
 
template<class Comp = nrt::Component>
std::shared_ptr< Comp > getSubComponent (std::string const &instanceName) const
 Get a sub-component by instance name. More...
 
bool isTopLevel () const
 Returns true if this component is top-level, i.e., its parent is an nrt::Manager (including nrt::Blackboard)
 
bool initialized () const
 Has this component been initialized yet?
 
bool started () const
 Is this component started, i.e., it has passed the start() state and not yet entered the stop() state.
 
bool running () const
 Is this component running, i.e., has passed start() and been launch()ed and not yet entered the stop() state.
 
void wait ()
 Wait until all run() functions decide on their own that they are finished. More...
 
Component::MetaInfo const & meta () const
 Get the metainfo of this Component. More...
 
template<typename T >
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 Set a parameter value. More...
 
template<typename T >
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 Set a parameter value, simple version assuming only one parameter match. More...
 
template<typename T >
std::vector< std::pair
< std::string, T > > 
getParamVal (std::string const &paramdescriptor) const
 Get parameter(s) value(s) by descriptor. More...
 
template<typename T >
getParamValUnique (std::string const &paramdescriptor) const
 Get a parameter value, simple version assuming only one parameter match. More...
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 Set a parameter value, by string. More...
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 Set a parameter value by string, simple version assuming only one parameter match. More...
 
std::vector< std::pair
< std::string, std::string > > 
getParamString (std::string const &paramdescriptor) const
 Get a parameter value, by string. More...
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 Get a parameter value by string, simple version assuming only one parameter match. More...
 
std::string descriptor () const
 Get our full descriptor (including all parents) as [Classname-Instancename]:[...]:[...].
 
std::string parentModuleUID () const
 Get the ModuleUID (as string) of this Component's nearest parent Module, or an empty string.
 
void prettyPrintTree (std::ostream &os, int indent=0) const
 Produce a nice textual hierarchy of this Component's sub-tree.
 
std::vector< std::pair
< std::string,
nrt::ParameterSummary > > 
getParamSummary (std::string const &paramdescriptor) const
 Return a list of parameter summaries for a given descriptor. More...
 
std::vector< std::pair
< std::string,
nrt::ParameterSummary > > 
getParamSummary (bool skipsubmodules=false) const
 Return a list of parameter summaries for all parameters of this Component and its subcomponents. More...
 
void setPath (std::string const &path)
 Assign a filesystem path to this component.
 
std::string absolutePath (std::string const &path)
 If given path is relative (not starting with /), prepend the Component path to it; otherwise, no-op.
 
virtual void notifyAllParamChanged (nrt::ParameterState const state) const
 This method is called by the Blackboard to refresh a ParamChangedListener.
 
virtual void getAllParamSummaries (std::vector< nrt::ParameterSummary > &ps) const
 Recursively get all param summaries.
 
- Public Member Functions inherited from nrt::ParameterRegistry
void addParameter (ParameterBase *const param)
 The parameter class uses this method to register itself on construction with it's owning Component.
 
void removeParameter (ParameterBase *const param)
 The parameter class uses this method to un-register itself on destruction with it's owning Component.
 

Static Public Member Functions

static std::string const id ()
 Get the name associated with our –in type.
 
static std::string const description ()
 Get a description to show for –help.
 

Protected Member Functions

virtual void run ()
 Capture images and make then available to in() as soon as we are running.
 
Image< PixRGB< byte > > getYUV422Image (xn::ImageMetaData &imageMD)
 Gets an nrt Image from YUV422 data.
 
Image< PixRGB< byte > > getRGB24Image (xn::ImageMetaData &imageMD)
 Gets an nrt Image from RGB24 data.
 
Image< PixGray< byte > > getGray8Image (xn::ImageMetaData &imageMD)
 Gets an nrt Image from 8 bit grayscale data.
 
Image< PixGray< uint16_t > > getGray16Image (xn::ImageMetaData &imageMD)
 Gets an nrt Image from 16 bit grayscale data.
 
Image< PixGray< uint16_t > > getIRImage (xn::IRMetaData &irMD)
 Gets an nrt Image from 16 bit ir grayscale data.
 
Image< PixGray< uint16_t > > getDepthImage (xn::DepthMetaData &depthMD)
 Gets an nrt Image from 16 bit ir depth data.
 
void setFps (xn::MapGenerator &gen, int const &fps)
 
void setResolution (xn::MapGenerator &gen, nrt::openni::Resolution const &res)
 

Additional Inherited Members

- Protected Attributes inherited from nrt::Component
boost::shared_mutex itsMtx
 Mutex used to protect our internals other than subcomponents and parameters.
 
std::vector< std::shared_ptr
< Component > > 
itsSubComponents
 
boost::shared_mutex itsSubMtx
 
Component *const nrt_component_this
 

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