Skip to content

samplesCode

Florian Lance edited this page Apr 17, 2014 · 11 revisions

kinect

  • Simple kinect interface

    #include #include "devices/rgbd/SWKinect.h"

    int main() { // create an opencv window cvNamedWindow("rgb_kinect", CV_WINDOW_AUTOSIZE | CV_GUI_NORMAL);

      SWKinect kinectDevice;
      
      // init the kinect device
      if(kinectDevice.init() == -1)
      {
      	std::cerr << "Error initializing kinect device. " << std::endl;
      	return -1;
      }
      
      char key = ' ';
      cv::Mat bgrImage;
      
      // set the display loop
      while(key != 'q')
      {
      	// grab new kinect frame
      	kinectDevice.grab();
    
      	// display the kinect rgb image in the opencv window
      	cv::imshow("rgb_kinect",kinectDevice.bgrImage);
      	
      	// wait key event for escaping the loop
      	key = waitKey(5);
      }
      
      cvDestroyWindow("rgb_kinect");
      
      return 0;
    

    }

  • Threaded kinect interface

...

Clone this wiki locally