1 #ifndef VIDEOSOURCE_KINECT2_HH
2 #define VIDEOSOURCE_KINECT2_HH
4 #include <VideoSource/VideoSource_Base.hh>
5 #include <Image/Camera.hh>
6 #include <libfreenect2/libfreenect2.hpp>
7 #include <libfreenect2/frame_listener.hpp>
23 :
public VideoSource,
public libfreenect2::FrameListener
37 void SetMode(Kinect2Mode mode);
41 virtual int OpenDevice();
45 virtual int OpenDevice(
int device);
48 virtual int CloseDevice();
51 virtual int PreGrab();
54 virtual int PostGrab();
91 virtual int GetNumDevices();
99 virtual bool onNewFrame(libfreenect2::Frame::Type type, libfreenect2::Frame *frame);
103 static libfreenect2::Freenect2 *freenect2_;
104 libfreenect2::Freenect2Device *dev_;
105 libfreenect2::PacketPipeline *pipeline_;
107 static const int buffersize_ = 4;
112 imbuffer() : curProd(0), curCons(0) {
113 sem_init(&sProd,
true,buffersize_);
114 sem_init(&sCons,
true,0);
115 for (
int i=0;i<buffersize_;i++) buffer[i].Init(512,424,1);
117 Image<float> buffer[buffersize_];
120 int curProd, curCons;
127 colorbuffer() : curProd(0), curCons(0) {
128 sem_init(&sProd,
true,buffersize_);
129 sem_init(&sCons,
true,0);
130 for (
int i=0;i<buffersize_;i++) buffer[i].Init(1920,1080,3);
132 Image<unsigned char> buffer[buffersize_];
135 int curProd, curCons;
138 imbuffer depthbuffer_;
140 colorbuffer colorbuffer_;
142 Kinect2Mode grabMode_;
149 #endif // VIDEOSOURCE_KINECT2_HH
Defines a common interface to different devices.
Use the Kinect2 class to grab images from the Microsoft Kinect2.
The image template class for specific storage types.
Checks for VideoSource capabilities.
This is the base class for images in BIAS.