Advertisement
lamiastella

what?

Jun 13th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. auto depth_image = imread("C:\\OpenARK\\OpenARK-test\\000000_depth.png", IMREAD_GRAYSCALE);
  2.     //cout << "n rows depth: " << depth_image.rows << endl;
  3.     //cout << "n cols depth: " << depth_image.cols << endl;
  4.     for (auto v = 0; v < depth_image.rows; v++) {
  5.         for (auto u = 0; u < depth_image.cols; u++) {
  6.             auto depth_value = depth_image.at<float>(v, u);
  7.             Point3f p;
  8.             p.x = ((u - CX)*depth_value*(1.0f / FX)) / 1000.0f;
  9.             p.y = ((v - CY)*depth_value*(1.0f / FY)) / 1000.0f;
  10.             p.z = (depth_value) / 1000.0f;
  11.             xyzBuffer.emplace_back(p);
  12.         }
  13.     }
  14.  
  15.     /*(for (auto u = 0; u < depth_image.cols; u++) {
  16.         for (auto v = 0; v < depth_image.rows; v++) {
  17.             auto depth_value = depth_image.at<float>(u, v);
  18.             Point3f p;
  19.             p.x = ((u - CX)*depth_value*(1.0f / FX)) / 1000.0f;
  20.             p.y = ((v - CY)*depth_value*(1.0f / FY)) / 1000.0f;
  21.             p.z = (depth_value) / 1000.0f;
  22.             xyzBuffer.emplace_back(p);
  23.         }
  24.     }*/
  25.  
  26.     //cout << "xyz buffer size: " << xyzBuffer.size() << endl;
  27.    
  28.     xyzMap = Mat(xyzBuffer, true).reshape(3, 480);
  29.     namedWindow("xyz Map", WINDOW_AUTOSIZE);
  30.     imshow("xyz Map", xyzMap);
  31.     waitKey(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement