48 namespace icl_openni {
54 if (std::numeric_limits<T>::max() < src -> ZRes()){
55 max = ((float) std::numeric_limits<T>::max()) / ((
float) src -> ZRes());
58 dst -> setSize(
utils::Size(src -> XRes(), src -> YRes()));
59 T*
data = dst -> getData(0);
61 const XnDepthPixel* pDepthRow = src -> Data();
63 for (
unsigned int y = 0; y < src -> YRes(); ++y){
64 for (
unsigned int x = 0; x < src -> XRes(); ++x, ++pDepthRow, ++
data){
69 for (
unsigned int y = 0; y < src -> YRes(); ++y){
70 for (
unsigned int x = 0; x < src -> XRes(); ++x, ++pDepthRow, ++
data){
71 *
data = *pDepthRow * max;
80 dst -> setSize(
utils::Size(src -> XRes(), src -> YRes()));
82 const XnIRPixel* pIRRow = src -> Data();
84 for (
unsigned int y = 0; y < src -> YRes(); ++y){
85 for (
unsigned int x = 0; x < src -> XRes(); ++x, ++pIRRow, ++
data){
97 dst -> setSize(
utils::Size(src -> XRes(), src -> YRes()));
100 icl8u* rChannel = dst -> getData(0);
101 icl8u* gChannel = dst -> getData(1);
102 icl8u* bChannel = dst -> getData(2);
103 const XnRGB24Pixel* rgbPixel = src -> RGB24Data();
104 for (
unsigned int y = 0; y < src -> YRes(); ++y){
105 for (
unsigned int x = 0; x < src -> XRes(); ++x, ++rgbPixel, ++rChannel,
106 ++gChannel, ++bChannel)
108 *rChannel = rgbPixel -> nRed;
109 *gChannel = rgbPixel -> nGreen;
110 *bChannel = rgbPixel -> nBlue;
122 dst -> setSize(
utils::Size(src -> XRes(), src -> YRes()));
125 icl8u* rChannel = dst -> getData(0);
126 icl8u* gChannel = dst -> getData(1);
127 icl8u* bChannel = dst -> getData(2);
128 const XnYUV422DoublePixel* yuvPixel = src -> YUV422Data();
130 for (
int i = 0; i < dst-> getDim()/2 ; ++i){
132 *rChannel = r; ++rChannel;
133 *gChannel = g; ++gChannel;
134 *bChannel = b; ++bChannel;
136 *rChannel = r; ++rChannel;
137 *gChannel = g; ++gChannel;
138 *bChannel = b; ++bChannel;
149 dst -> setSize(
utils::Size(src -> XRes(), src -> YRes()));
152 icl8u* gChannel = dst -> getData(0);
153 const XnGrayscale8Pixel* grayPixel = src -> Grayscale8Data();
154 for (
int i = 0; i < dst-> getDim() ; ++i){
155 *gChannel = *grayPixel;
156 ++gChannel; ++grayPixel;
230 int omit_max_wait_millis=1000,
231 int omit_sleep_micros=1000){
243 }
else if(!omit_double_frames){
342 const xn::Query* pQuery,
343 xn::NodeInfoList& TreesList,
344 xn::EnumerationErrors* pErrors = NULL);
347 static XnStatus
Create(xn::DepthGenerator* generator);
void setReset()
mark buffers to be reset on next write-access.
Definition: OpenNIUtils.h:279
static XnStatus EnumerateProductionTrees(XnProductionNodeType type, const xn::Query *pQuery, xn::NodeInfoList &TreesList, xn::EnumerationErrors *pErrors=NULL)
calls EnumerateProductionTrees on the internal OpenNI context.
IR Image Generator.
Definition: OpenNIUtils.h:515
This is used for concurrent writing and reading of Buffers.
Definition: OpenNIUtils.h:175
abstract super-class of all Image generators
Definition: OpenNIUtils.h:408
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
static std::string getMapOutputModeInfo(xn::MapGenerator *gen)
creates an info string for MapOutputModes of MapGenerator gen.
void unlock()
unlocks the mutex
Definition: Mutex.h:111
~OpenNIDepthGenerator()
Destructor frees all resouurces.
value_type toMilliSeconds() const
Ipp8u icl8u
8Bit unsigned integer type for the ICL
Definition: BasicTypes.h:64
Generators getGeneratorType()
tells the type of the Generator
MapGeneratorOptions * getMapGeneratorOptions()
getter for MapGeneratorOptions
core::Img8u * convertGrayScale8Img(xn::ImageMetaData *src, core::Img8u *dst)
Definition: OpenNIUtils.h:148
Generators getGeneratorType()
tells the type of the Generator
virtual core::ImgBase * initBuffer()=0
Creates an core::ImgBase for ReadWriteBuffer.
Definition: OpenNIUtils.h:414
unsigned int m_FrameId
the id of the last grabbed frame
Definition: OpenNIUtils.h:545
xn::NodeInfo * m_DeviceInfo
A NodeInfo for the used device.
Definition: OpenNIUtils.h:496
ICLCore_API void cc_util_yuv_to_rgb(const icl32s y, const icl32s u, const icl32s v, icl32s &r, icl32s &g, icl32s &b)
converts given (y,u,v) pixel into the rgb format
T * m_Buffers[3]
current objects which alternately are read and written.
Definition: OpenNIUtils.h:305
xn::IRGenerator * m_IrGenerator
the underlying it-image generator
Definition: OpenNIUtils.h:539
this class interprets and sets Properties of OpenNI DepthGenerators
Definition: OpenNIUtils.h:380
ReadWriteBufferHandler< T > * m_BufferHandler
the handler used to create new buffers
Definition: OpenNIUtils.h:303
ICL Time class (taken from the Ice lib)
Definition: Time.h:52
static void usleep(unsigned int usec)
just calling usleep
MapGeneratorOptions * m_Options
pointer to internally used MapGeneratorOptions
Definition: OpenNIUtils.h:511
bool acquireImage(core::ImgBase *dest)
grab function grabs an image returns whether grabbing worked
xn::Context m_Context
The internal context object.
Definition: OpenNIUtils.h:355
xn::IRGenerator * m_IrGenerator
Definition: OpenNIUtils.h:507
ReadWriteBuffer(ReadWriteBufferHandler< T > *buffer_handler)
Constructor creates and initializes resources.
Definition: OpenNIUtils.h:178
core::Img8u * convertYuv422Img(xn::ImageMetaData *src, core::Img8u *dst)
Definition: OpenNIUtils.h:121
bool acquireImage(core::ImgBase *dest)
grab function grabs an image returns whether grabbing worked
A Context object encapsulating the OpenNI-Context-object.
Definition: OpenNIUtils.h:321
~OpenNIRgbGenerator()
Destructor frees all resouurces.
std::vector< std::string > m_Capabilities
A vector holding all capabilities of the MapGenerator.
Definition: OpenNIUtils.h:374
void addGeneralIntProperty(const std::string name)
adds a general int capability as property
OpenNIContext()
This is a singleton class so Constructor is private.
xn::ImageMetaData m_RgbMD
a ImagehMetaData object holding image information
Definition: OpenNIUtils.h:509
~OpenNIContext()
releases the corresponding OpenNI context object.
std::map< std::string, xn::ProductionNode > m_ProductionNodeMap
A Map Holding all used ProductionNodes.
Definition: OpenNIUtils.h:376
virtual xn::MapGenerator * getMapGenerator()=0
returns underlying xn::MapGenerator instance
bool acquireImage(core::ImgBase *dest)
grab function grabs an image returns whether grabbing worked
T * getNextWriteBuffer()
returns a pointer to the next write Buffer.
Definition: OpenNIUtils.h:262
Time age() const
Definition: Time.h:99
~OpenNIIRGenerator()
Destructor frees all resouurces.
core::ImgBase * initBuffer()
Creates an core::Img16s for ReadWriteBuffer.
xn::MapGenerator * getMapGenerator()
returns underlying xn::MapGenerator instance
bool m_Initialized
Tells whether the internal context in initialized or not.
Definition: OpenNIUtils.h:353
void processPropertyChange(const utils::Configurable::Property &prop)
callback for changed configurable properties
~ReadWriteBuffer()
Destructor frees allocated memory.
Definition: OpenNIUtils.h:192
T * getNextReadBuffer()
returns a pointer to the most recent actualized buffer.
Definition: OpenNIUtils.h:204
virtual MapGeneratorOptions * getMapGeneratorOptions()=0
getter for MapGeneratorOptions
Generators
an enum listing all supported data generators
Definition: OpenNIUtils.h:412
static XnStatus waitAndUpdate()
calls waitAnyUpdateAll on the internal OpenNI context.
xn::DepthGenerator * m_DepthGenerator
the underlying core::depth generator
Definition: OpenNIUtils.h:464
ICLQt_API ImgROI data(ImgQ &r)
creates full ROI ROI-struct
Generators getGeneratorType()
tells the type of the Generator
Ipp32s icl32s
32bit signed integer type for the ICL
Definition: BasicTypes.h:58
static OpenNIMapGenerator * createGenerator(std::string id)
Creates the corresponding Generator.
core::Img8u * convertRGBImg(xn::ImageMetaData *src, core::Img8u *dst)
Definition: OpenNIUtils.h:96
MapGeneratorOptions * getMapGeneratorOptions()
getter for MapGeneratorOptions
xn::MapGenerator * getMapGenerator()
returns underlying xn::MapGenerator instance
unsigned int m_FrameId
the id of the last grabbed frame
Definition: OpenNIUtils.h:470
MapGeneratorOptions * m_Options
pointer to internally used MapGeneratorOptions
Definition: OpenNIUtils.h:468
int m_Write
the object currently written to.
Definition: OpenNIUtils.h:311
bool newAvailable()
tells whether a new ConvBuffers is available
Definition: OpenNIUtils.h:296
Depth Image Generator.
Definition: OpenNIUtils.h:442
MapGeneratorOptions * m_Options
pointer to internally used MapGeneratorOptions
Definition: OpenNIUtils.h:543
virtual bool acquireImage(core::ImgBase *dest)=0
grab function grabs an image returns whether grabbing worked
Size class of the ICL.
Definition: Size.h:61
core::Img16s * convertIRImg(xn::IRMetaData *src, core::Img16s *dst)
fills an core::Img16s from OpenNI IRMetaData
Definition: OpenNIUtils.h:79
this class interprets and sets Properties of OpenNI MapGenerators
Definition: OpenNIUtils.h:359
bool newFrameAvailable()
checks whether a new frame is available
xn::ImageGenerator * m_ImageGenerator
the used ImageGenerator
Definition: OpenNIUtils.h:404
Definition: OpenNIUtils.h:413
bool m_ResetBuffers[3]
a bool for every buffer telling whether it needs a reset
Definition: OpenNIUtils.h:307
RGB Image Generator.
Definition: OpenNIUtils.h:474
xn::DepthGenerator * m_DepthGenerator
the underlying core::depth generator
Definition: OpenNIUtils.h:506
core::Img8u * initBuffer()
Creates an core::Img8u for ReadWriteBuffer.
xn::DepthMetaData m_DepthMD
a DepthMetaData object holding image information
Definition: OpenNIUtils.h:466
virtual bool newFrameAvailable()=0
checks whether a new frame is available
void processPropertyChange(const utils::Configurable::Property &prop)
callback for changed configurable properties
virtual Generators getGeneratorType()=0
tells the type of the Generator
Property & prop(const std::string &propertyName)
this CAN be used e.g. to store a property value in internal property-list
Definition: OpenNIUtils.h:416
this class interprets and sets Properties of OpenNI ImageGenerators
Definition: OpenNIUtils.h:394
bool m_Avail
tells whether an actualized object was written.
Definition: OpenNIUtils.h:317
xn::DepthGenerator * m_DepthGenerator
the used DepthGenerator
Definition: OpenNIUtils.h:390
utils::Mutex m_Lock
Lock for thread safety.
Definition: OpenNIUtils.h:351
utils::Mutex m_Mutex
the mutex is used for concurrent reading and writing.
Definition: OpenNIUtils.h:309
xn::MapGenerator * getMapGenerator()
returns underlying xn::MapGenerator instance
xn::NodeInfo * m_DeviceInfo
A NodeInfo for the used device.
Definition: OpenNIUtils.h:537
OpenNIRgbGenerator(int num)
Creates RgbGenerator number num from Context.
Interface for classes that can be configured from configuration-files and GUI-Components.
Definition: Configurable.h:194
static std::string getCurrentMapOutputMode(xn::MapGenerator *gen)
creates a string describing the current MapOutputMode
xn::IRMetaData m_IrMD
a ImagehMetaData object holding image information
Definition: OpenNIUtils.h:541
xn::MapGenerator * m_Generator
the used MapGenerator
Definition: OpenNIUtils.h:372
MapGeneratorOptions(xn::MapGenerator *generator)
constructor
static OpenNIContext * getInst()
initializes the context. only used internally.
void switchHandler(ReadWriteBufferHandler< T > *new_handler)
switches the handler
Definition: OpenNIUtils.h:287
OpenNIDepthGenerator(int num)
Creates DepthGenerator number num from Context.
MapGeneratorOptions * getMapGeneratorOptions()
getter for MapGeneratorOptions
#define ICL_DELETE(X)
Definition: Macros.h:242
int m_Next
the write object currently not written to.
Definition: OpenNIUtils.h:313
void processPropertyChange(const utils::Configurable::Property &prop)
callback for changed configurable properties
bool newFrameAvailable()
checks whether a new frame is available
unsigned int m_FrameId
the id of the last grabbed frame
Definition: OpenNIUtils.h:500
T * getNextReadBuffer(bool omit_double_frames=false, int omit_max_wait_millis=1000, int omit_sleep_micros=1000)
returns pointer to most recent buffer.
Definition: OpenNIUtils.h:229
static XnStatus CreateProductionTree(xn::NodeInfo &Tree, xn::ProductionNode &node)
calls CreateProductionTree on the internal OpenNI context.
Represents a single property.
Definition: Configurable.h:200
DepthGeneratorOptions(xn::DepthGenerator *generator)
constructor
bool newFrameAvailable()
checks whether a new frame is available
Ipp16s icl16s
16bit signed integer type for the ICL (range [-32767, 32768 ])
Definition: BasicTypes.h:61
virtual T * initBuffer()=0
creates an instance of T and returns a pointer. passes ownership.
static XnStatus Create(xn::DepthGenerator *generator)
calls Create on the internal OpenNI context.
Mutex class of the ICL.
Definition: Mutex.h:54
A BufferHandlers only task is to create T's.
Definition: OpenNIUtils.h:163
Definition: OpenNIUtils.h:415
core::Img16s * initBuffer()
Creates an core::Img8u for ReadWriteBuffer.
ImageGeneratorOptions(xn::ImageGenerator *generator)
constructor
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
Locks a mutex on the stack (mutex is unlocked when the stack's section is released.
Definition: Mutex.h:120
xn::ImageGenerator * m_RgbGenerator
the underlying rgb-image generator
Definition: OpenNIUtils.h:498
OpenNIIRGenerator(int num)
Creates IRGenerator number num from Context.
void lock()
locks the mutex
Definition: Mutex.h:91
int m_Read
the object currently read from.
Definition: OpenNIUtils.h:315
core::Img< T > * convertDepthImg(xn::DepthMetaData *src, core::Img< T > *dst)
fills an core::core::Img<T> from OpenNI DepthMetaData
Definition: OpenNIUtils.h:52