00001 #ifndef __data_capture_freenect_hpp__ 00002 #define __data_capture_freenect_hpp__ 00003 00004 #include <libfreenect.h> 00005 00006 #include <fovis/fovis.hpp> 00007 00008 namespace fovis_example 00009 { 00010 00011 class DataCapture 00012 { 00013 public: 00014 DataCapture(); 00015 ~DataCapture(); 00016 00017 bool initialize(); 00018 00019 bool startDataCapture(); 00020 00021 bool stopDataCapture(); 00022 00023 bool captureOne(); 00024 00025 fovis::DepthImage* getDepthImage() { 00026 return depth_image; 00027 } 00028 00029 const fovis::CameraIntrinsicsParameters& getRgbParameters() const { 00030 return rgb_params; 00031 } 00032 00033 const uint8_t* getGrayImage() { 00034 return gray_buf; 00035 } 00036 00037 private: 00038 static void depth_cb(freenect_device *dev, void *data, uint32_t timestamp); 00039 static void image_cb(freenect_device *dev, void *data, uint32_t timestamp); 00040 00041 void DepthCallback(void* data, uint32_t timestamp); 00042 void ImageCallback(void* data, uint32_t timestamp); 00043 00044 freenect_context *f_ctx; 00045 freenect_device *f_dev; 00046 00047 int freenect_angle; 00048 int device_number; 00049 00050 fovis::DepthImage* depth_image; 00051 00052 int width; 00053 int height; 00054 00055 fovis::CameraIntrinsicsParameters rgb_params; 00056 00057 bool have_image; 00058 bool have_depth; 00059 00060 float* depth_data; 00061 00062 uint8_t* gray_buf; 00063 }; 00064 00065 } 00066 00067 #endif