|
@@ -1,7 +1,7 @@
|
|
#include <librealsense2/rs.hpp>
|
|
#include <librealsense2/rs.hpp>
|
|
#include <iostream>
|
|
#include <iostream>
|
|
|
|
|
|
-// void update_data_and_save(rs2::frame &colorized_depth, rs2::frame data_frame, rs2::points &points, rs2::pointcloud &pc, rs2::colorizer &color_map, rs2::frame &color, const std::string &fileName);
|
|
|
|
|
|
+void update_data_and_save(rs2::frame data_frame, rs2::points &points, rs2::pointcloud &pc, rs2::frame &color, const std::string &fileName);
|
|
|
|
|
|
int main()
|
|
int main()
|
|
try
|
|
try
|
|
@@ -37,7 +37,6 @@ try
|
|
rs2::video_frame color = data.get_color_frame();
|
|
rs2::video_frame color = data.get_color_frame();
|
|
if (!color)
|
|
if (!color)
|
|
color = data.get_infrared_frame();
|
|
color = data.get_infrared_frame();
|
|
- original_pc.map_to(color);
|
|
|
|
rs2::depth_frame depth_frame = data.get_depth_frame();
|
|
rs2::depth_frame depth_frame = data.get_depth_frame();
|
|
|
|
|
|
rs2::depth_frame filtered = depth_frame;
|
|
rs2::depth_frame filtered = depth_frame;
|
|
@@ -59,14 +58,8 @@ try
|
|
filtered = disparity_to_depth.process(filtered);
|
|
filtered = disparity_to_depth.process(filtered);
|
|
// filtered = hole_filter.process(filtered);
|
|
// filtered = hole_filter.process(filtered);
|
|
|
|
|
|
- // update_data_and_save(colored_depth, depth_frame, original_points, original_pc, color_map, color, "original");
|
|
|
|
- // update_data_and_save(colored_filtered, filtered, filtered_points, filtered_pc, color_map, color, "filtered");
|
|
|
|
-
|
|
|
|
- original_points = original_pc.calculate(depth_frame); // Generate pointcloud from the depth data
|
|
|
|
- filtered_points = filtered_pc.calculate(filtered); // Generate pointcloud from the depth data
|
|
|
|
-
|
|
|
|
- original_points.export_to_ply("original.ply", color);
|
|
|
|
- filtered_points.export_to_ply("filtered.ply", color);
|
|
|
|
|
|
+ update_data_and_save(depth_frame, original_points, original_pc, color, "original");
|
|
|
|
+ update_data_and_save(filtered, filtered_points, filtered_pc, color, "filtered");
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
return EXIT_SUCCESS;
|
|
}
|
|
}
|
|
@@ -81,10 +74,9 @@ catch (const std::exception &e)
|
|
return EXIT_FAILURE;
|
|
return EXIT_FAILURE;
|
|
}
|
|
}
|
|
|
|
|
|
-// void update_data_and_save(rs2::frame &colorized_depth, rs2::frame data_frame, rs2::points &points, rs2::pointcloud &pc, rs2::colorizer &color_map, rs2::frame &color, const std::string &fileName)
|
|
|
|
-// {
|
|
|
|
-// pc.map_to(color); // Map the colored depth to the point cloud
|
|
|
|
-// points = pc.calculate(data_frame); // Generate pointcloud from the depth data
|
|
|
|
-// // colorized_depth = color_map.process(data_frame); // Colorize the depth frame with a color map (vorher: colorized_depth)
|
|
|
|
-// points.export_to_ply(fileName, color);
|
|
|
|
-// }
|
|
|
|
|
|
+void update_data_and_save(rs2::frame data_frame, rs2::points &points, rs2::pointcloud &pc, rs2::frame &color, const std::string &fileName)
|
|
|
|
+{
|
|
|
|
+ pc.map_to(color); // Map the colored image to the point cloud
|
|
|
|
+ points = pc.calculate(data_frame); // Generate pointcloud from the depth data
|
|
|
|
+ points.export_to_ply(fileName + ".ply", color); // export pointcloud to .ply file
|
|
|
|
+}
|