OCLSLAM  0.1.0
 Hosted by GitHub
freenect_rgbd.hpp
Go to the documentation of this file.
1 
29 #ifndef FREENECT_RGBD_HPP
30 #define FREENECT_RGBD_HPP
31 
32 #include <mutex>
33 #include <libfreenect.hpp>
34 
35 #if defined(__APPLE__) || defined(__MACOSX)
36 #include <OpenCL/cl.hpp>
37 #else
38 #include <CL/cl.hpp>
39 #endif
40 
41 
46 class Kinect : public Freenect::FreenectDevice
47 {
48 public:
49  Kinect (freenect_context *ctx, int idx);
51  void VideoCallback (void *rgb, uint32_t timestamp);
53  void DepthCallback (void *depth, uint32_t timestamp);
55  void setBuffers (cl::CommandQueue &queue, cl::Buffer &rgb, cl::Buffer &depth);
57  bool deliverFrames (cl::CommandQueue &queue, cl::Buffer &rgb, cl::Buffer &depth);
58 
59 private:
60  std::mutex rgbMutex, depthMutex;
61  cl_uchar *rgbPtr; // Aligned to 4KB for pinning in OpenCL
62  cl_ushort *depthPtr; // Aligned to 4KB for pinning in OpenCL
63  bool newRGBFrame, newDepthFrame;
64  unsigned int width, height;
65 
66 };
67 
68 #endif // FREENECT_RGBD_HPP
Kinect(freenect_context *ctx, int idx)
Definition: freenect_rgbd.cpp:37
void DepthCallback(void *depth, uint32_t timestamp)
Delivers the latest Depth frame.
Definition: freenect_rgbd.cpp:66
void VideoCallback(void *rgb, uint32_t timestamp)
Delivers the latest RGB frame.
Definition: freenect_rgbd.cpp:52
bool deliverFrames(cl::CommandQueue &queue, cl::Buffer &rgb, cl::Buffer &depth)
Transfers the RGB and Depth frames to the specified OpenCL buffers.
Definition: freenect_rgbd.cpp:100
A class that extends Freenect::FreenectDevice by defining the VideoCallback and DepthCallback functio...
Definition: freenect_rgbd.hpp:46
void setBuffers(cl::CommandQueue &queue, cl::Buffer &rgb, cl::Buffer &depth)
Sets the host buffers for the RGB and Depth frames.
Definition: freenect_rgbd.cpp:81