Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto depth_image = imread("C:\\OpenARK\\OpenARK-test\\000000_depth.png", IMREAD_GRAYSCALE);
- //cout << "n rows depth: " << depth_image.rows << endl;
- //cout << "n cols depth: " << depth_image.cols << endl;
- for (auto v = 0; v < depth_image.rows; v++) {
- for (auto u = 0; u < depth_image.cols; u++) {
- auto depth_value = depth_image.at<float>(v, u);
- Point3f p;
- p.x = ((u - CX)*depth_value*(1.0f / FX)) / 1000.0f;
- p.y = ((v - CY)*depth_value*(1.0f / FY)) / 1000.0f;
- p.z = (depth_value) / 1000.0f;
- xyzBuffer.emplace_back(p);
- }
- }
- /*(for (auto u = 0; u < depth_image.cols; u++) {
- for (auto v = 0; v < depth_image.rows; v++) {
- auto depth_value = depth_image.at<float>(u, v);
- Point3f p;
- p.x = ((u - CX)*depth_value*(1.0f / FX)) / 1000.0f;
- p.y = ((v - CY)*depth_value*(1.0f / FY)) / 1000.0f;
- p.z = (depth_value) / 1000.0f;
- xyzBuffer.emplace_back(p);
- }
- }*/
- //cout << "xyz buffer size: " << xyzBuffer.size() << endl;
- xyzMap = Mat(xyzBuffer, true).reshape(3, 480);
- namedWindow("xyz Map", WINDOW_AUTOSIZE);
- imshow("xyz Map", xyzMap);
- waitKey(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement