25 #include <VideoSource/VideoSource_Kinect2.hh>
26 #include <Base/Image/ImageIO.hh>
32 int main(
int argc,
char *argv[])
34 cout <<
"ExampleVideoSource_Kinect2 [<devID>] [<imgNum>]" << endl;
35 int devnum = argc > 1 ? atoi(argv[1]) : -1;
36 int imgnum = argc > 2 ? atoi(argv[2]) : 1;
56 cout <<
"OpenDevice() -> " << res << endl;
57 if (res < 0)
return -1;
66 cout <<
"PreGrab() -> " << res << endl;
69 cout <<
"Grabbing " << imgnum <<
" images..." << endl;
70 for (
int i = 0; i < imgnum; i++) {
77 std::cout <<
"." << std::flush;
85 cout <<
"PostGrab() -> " << res << endl;
88 cout <<
"CloseDevice() -> " << res << endl;
void SetMode(Kinect2Mode mode)
virtual int PostGrab()
Stop grabbing.
virtual int GrabSingleDepth(BIAS::Camera< float > &image)
grab the depth image (slow).
Use the Kinect2 class to grab images from the Microsoft Kinect2.
virtual int InitDepthImage(BIAS::ImageBase &Image)
kinect 2 depth image will be 512x424, float in Millimeters
virtual int GrabSingleIR(BIAS::Camera< float > &image)
grab the raw ir data dump (very fast).
virtual int GrabSingle(BIAS::Camera< unsigned char > &image)
grab single color image. Note: This image has already been jpeg compressed
virtual int InitIrImage(BIAS::ImageBase &Image)
kinect 2 ir image will be 512x424, single channel unsigned char
get color, ir and depth images (default)
virtual int PreGrab()
Start grabbing.
static int Save(const std::string &filename, const ImageBase &img, const enum TFileFormat FileFormat=FF_auto, const bool sync=BIAS_DEFAULT_SYNC, const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY, const bool forceNewID=BIAS_DEFAULT_FORCENEWID, const bool &writeMetaData=true)
Export image as file using extrnal libs.
virtual int OpenDevice()
Opens first device found, OpenDevice(0)
virtual int CloseDevice()
Close device, if no other kinect cameras are in use, context is deleted (i.e. close usb bus connectio...
virtual int InitImage(BIAS::ImageBase &Image)
kinect 2 color image will be 1920x1080, RGB.