00001 #ifndef PANGOLIN_OPENNI_H 00002 #define PANGOLIN_OPENNI_H 00003 00004 #include <pangolin/pangolin.h> 00005 #include <pangolin/video.h> 00006 00007 #include <XnCppWrapper.h> 00008 00009 namespace pangolin 00010 { 00011 00012 enum OpenNiSensorType 00013 { 00014 OpenNiUnassigned = -1, 00015 OpenNiRgb = 0, 00016 OpenNiIr = 1, 00017 OpenNiDepth = 2 00018 }; 00019 00021 struct OpenNiVideo : public VideoInterface 00022 { 00023 public: 00024 OpenNiVideo(OpenNiSensorType s1, OpenNiSensorType s2); 00025 ~OpenNiVideo(); 00026 unsigned Width() const; 00027 unsigned Height() const; 00028 size_t SizeBytes() const; 00029 00030 std::string PixFormat() const; 00031 00032 void Start(); 00033 void Stop(); 00034 bool GrabNext( unsigned char* image, bool wait = true ); 00035 bool GrabNewest( unsigned char* image, bool wait = true ); 00036 00037 protected: 00038 xn::Context context; 00039 xn::DepthGenerator depthNode; 00040 xn::ImageGenerator imageNode; 00041 xn::IRGenerator irNode; 00042 00043 OpenNiSensorType s1; 00044 OpenNiSensorType s2; 00045 size_t s1SizeBytes; 00046 size_t s2SizeBytes; 00047 size_t sizeBytes; 00048 }; 00049 00050 } 00051 00052 #endif // PANGOLIN_OPENNI_H