Guest User

Untitled

a guest
Sep 14th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment