Advertisement
lamiastella

Creative Senz 3D camera CVAR dataset

Jun 14th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1.     /*
  2.     F200 camera multi-user ego-centric dataset
  3.     const auto FX = 478.01f;
  4.     const auto FY = 478.01f;
  5.     const auto CX = 321.59f;
  6.     const auto CY = 250.55f;
  7.     */
  8.     /*
  9.      * Creative Senz 3D camera CVAR dataset
  10.      * fx=224.5, fy=230.5, ux=160, uy=120
  11.      */
  12.     const auto FX = 224.5f;
  13.     const auto FY = 230.5f;
  14.     const auto CX = 160.0f;
  15.     const auto CY = 120.0f;
  16.  
  17.     vector<Point3f>  xyzBuffer;
  18.  
  19.  
  20.     auto depth_image = imread("C:\\OpenARK\\OpenARK-test\\000000_depth.png", IMREAD_ANYDEPTH);
  21.  
  22.     namedWindow("depth", WINDOW_AUTOSIZE);
  23.     imshow("depth", depth_image);
  24.     //waitKey(0);
  25.  
  26.     cout << "n rows depth: " << depth_image.rows << endl;
  27.     cout << "n cols depth: " << depth_image.cols << endl;
  28.     cout << "depth type: " << depth_image.type() << endl;
  29.  
  30.     for (auto v = 0; v < depth_image.rows; v++) {
  31.         for (auto u = 0; u < depth_image.cols; u++) {
  32.             auto depth_value = depth_image.at<uint16_t>(v, u);
  33.             Point3f p;
  34.             p.x = ((u - CX)*depth_value*(1.0f / FX)) / 32000.0f;
  35.             p.y = ((v - CY)*depth_value*(1.0f / FY)) / 32000.0f;
  36.             p.z = (depth_value) / 32000.0f;
  37.             xyzBuffer.emplace_back(p);
  38.         }
  39.     }
  40.  
  41.     xyzMap = Mat(xyzBuffer, true).reshape(3, 240);
  42.    
  43.     namedWindow("xyz Map", WINDOW_AUTOSIZE);
  44.     imshow("xyz Map", xyzMap);
  45.     //waitKey(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement