25 #ifndef VIDEOSOURCE_OPENNI_HH_
26 #define VIDEOSOURCE_OPENNI_HH_
28 #if __cplusplus > 199711L
38 #include <XnCppWrapper.h>
39 #include <VideoSource/VideoSource_Kinect_Base.hh>
40 #include <Image/Camera.hh>
57 virtual int OpenDevice();
60 virtual int OpenDevice(
int device);
63 virtual int CloseDevice();
66 virtual int PreGrab();
68 virtual int PostGrab();
81 virtual int SetVideoModeColor();
82 virtual int SetVideoModeIR();
86 virtual int SetSwitchVideoModeAfterGrab();
88 virtual int SetTilt(
double degrees);
89 virtual int SetLed(
int mode);
90 virtual int GetAccelerometer(
double &tilt,
double &x,
double &y,
double &z);
106 virtual int CreateDepthLookupTable(
double px,
double py,
double fx,
double fy);
108 virtual int StartDepthStream();
110 virtual int StopDepthStream();
112 virtual int ToggleDepthStream();
116 struct ONIDeviceNode {
117 ONIDeviceNode(
const xn::NodeInfo& device,
const xn::NodeInfo& image,
const xn::NodeInfo& ir,
const xn::NodeInfo& depth)
118 : deviceInfo(device), imageInfo(image), irInfo(ir), depthInfo(depth)
121 xn::NodeInfo deviceInfo;
122 xn::NodeInfo imageInfo;
124 xn::NodeInfo depthInfo;
127 xn::DepthGenerator depthGenerator_;
128 xn::UserGenerator userGenerator_;
129 xn::ImageGenerator colorGenerator_;
130 xn::IRGenerator irGenerator_;
132 xn::DepthMetaData depthMD_;
133 xn::ImageMetaData colorMD_;
134 xn::IRMetaData irMD_;
137 xn::EnumerationErrors errors_;
143 static int numInstances_;
144 static int numDevices_;
147 static xn::Context context_;
148 static std::vector<ONIDeviceNode> devices_;
150 static xn::NodeInfoList device_nodes_;
151 static xn::NodeInfoList depth_nodes_;
152 static xn::NodeInfoList image_nodes_;
153 static xn::NodeInfoList ir_nodes_;
155 void CreateLookupTable_(
double px = 328.82739,
double py = 252.6967098,
double fx = 585.9303337,
double fy = 585.548233470985);
156 void DeleteLookupTable_();
158 static bool CheckError_(XnStatus rc, std::string what);
166 bool switchModeEveryFrame_;
168 static pthread_mutex_t *exclusive_mutex;
int BIASVideoSource_EXPORT ScanBus(std::stringstream &ofs)
support function to get the number of cameras and IDs of all cameras on one bus
Use OpenNI just like the ToF Cameras.
BIAS::Image< float > * depthLookupTable_
virtual xn::Context * GetOpenNIContext()
The image template class for specific storage types.
Checks for VideoSource capabilities.
virtual bool GetColorGeneratorMode()
get if generating color (=true)
virtual int GetNumDevices()
Use Kinect just like the ToF Cameras.
This is the base class for images in BIAS.