daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. how to get depth values and then convert to millimetres in OpenCV with Kinect?
  2. int main( int argc, char* argv[] ){
  3.  
  4. VideoCapture capture(CV_CAP_OPENNI); // or CV_CAP_OPENNI
  5. for(;;)
  6. {
  7.     Mat depthMap;
  8.     Mat bgrImage;
  9.  
  10.     capture.grab();
  11.  
  12.     capture.retrieve( depthMap, CV_CAP_OPENNI_DEPTH_MAP ); // Depth values in mm (CV_16UC1)
  13.     capture.retrieve( bgrImage, CV_CAP_OPENNI_BGR_IMAGE );
  14.  
  15.     cout << "rows: " << depthMap.rows << " cols: " << depthMap.cols << endl;
  16.     cout << "depth: " << depthMap.at<int>(0,0) << endl;
  17.  
  18.     imshow("RGB image", bgrImage);
  19.  
  20.     if( waitKey( 30 ) >= 0 )
  21.         break;
  22. }h
  23. return 0;
  24.    
  25. rows: 480 cols: 640
  26. depth: 1157
  27. rows: 480 cols: 640
  28. depth: 1157
  29. rows: 480 cols: 640
  30. depth: 1157
  31. rows: 480 cols: 640
  32. depth: 1157
  33.    
  34. rows: 480 cols: 640
  35. depth: 83690629
  36. rows: 480 cols: 640
  37. depth: 83690629
  38. rows: 480 cols: 640
  39. depth: 83690629
  40. rows: 480 cols: 640
  41. depth: 83690629
  42. rows: 480 cols: 640
  43. depth: 83690629
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top