Image Component Library (ICL)
OpenNIGrabber.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLIO/src/ICLIO/OpenNIGrabber.h **
10 ** Module : ICLIO **
11 ** Authors: Viktor Richter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLIO/Grabber.h>
34 #include <ICLUtils/Time.h>
35 #include <ICLIO/OpenNIUtils.h>
36 #include <ICLUtils/Thread.h>
37 #include <ICLIO/OpenNIIncludes.h>
38 
39 namespace icl {
40  namespace io{
41 
42  // Forward declaration of OpenNIGrabberImpl
43  class OpenNIGrabber;
44 
47  public:
48 
51 
54 
56 
59  void addGrabber(OpenNIGrabber* grabber);
60 
62 
65  void removeGrabber(OpenNIGrabber* grabber);
66 
67  private:
69  void run();
70 
72  std::set<OpenNIGrabber*> m_Grabber;
73  };
74 
76  class OpenNIGrabber : public Grabber {
77  public:
78  friend class OpenNIGrabberThread;
79 
81 
84  OpenNIGrabber(std::string args);
85 
88 
90 
91  virtual const core::ImgBase* acquireImage();
92 
97  virtual void* getHandle();
98 
99  private:
101  void grabNextImage();
102 
109 
112 
114  std::string getName();
115 
119  std::string m_Id;
126  };
127 
128  } // namespace io
129 } //namespace icl
130 
void run()
constantly calls update on OpenNI context and updates image buffers. While grabbers are registered.
Grabber implementation for OpenNI based camera access.
Definition: OpenNIGrabber.h:76
This is used for concurrent writing and reading of Buffers.
Definition: OpenNIUtils.h:175
void grabNextImage()
makes the MapGenerator grab a new image. called repeatedly in thread.
abstract super-class of all Image generators
Definition: OpenNIUtils.h:408
undocument this line if you encounter any issues!
Definition: Any.h:37
Simple object oriented thread class wrapping the pthread library.
Definition: Thread.h:90
OpenNIGrabber(std::string args)
The constructor.
std::string getName()
Returns the string representation of the currently used device.
void setGeneratorTo(icl_openni::OpenNIMapGenerator::Generators desired)
Generators
an enum listing all supported data generators
Definition: OpenNIUtils.h:412
icl_openni::ReadWriteBuffer< core::ImgBase > * m_Buffer
internally used ReadWriteBuffer
Definition: OpenNIGrabber.h:123
icl_openni::OpenNIMapGenerator * m_Generator
pointer to the currently used image generator
Definition: OpenNIGrabber.h:121
virtual void * getHandle()
Internally spawned thread class for continuous grabbing. Only one instance needed.
Definition: OpenNIGrabber.h:46
Common interface class for all grabbers.
Definition: Grabber.h:153
~OpenNIGrabberThread()
Destructor stops thread and releases all resources.
Property & prop(const std::string &propertyName)
this CAN be used e.g. to store a property value in internal property-list
~OpenNIGrabber()
Destructor.
std::string m_Id
a grabber id
Definition: OpenNIGrabber.h:119
void processPropertyChange(const utils::Configurable::Property &prop)
callback for changed configurable properties
virtual const core::ImgBase * acquireImage()
grab function grabs an image (destination image is adapted on demand)
OpenNIGrabberThread()
Constructor set up GrabberThread.
void addGrabber(OpenNIGrabber *grabber)
adds a grabber to be updated every frame.
void removeGrabber(OpenNIGrabber *grabber)
removes a grabber so it no longer will be updated.
Represents a single property.
Definition: Configurable.h:200
utils::Mutex m_Mutex
Mutex used for concurrency issues.
Definition: OpenNIGrabber.h:117
std::set< OpenNIGrabber * > m_Grabber
internally used set of grabber pointers
Definition: OpenNIGrabber.h:72
Mutex class of the ICL.
Definition: Mutex.h:54
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
bool m_OmitDoubleFrames
whether double frames should be omited
Definition: OpenNIGrabber.h:125