PLY export - #5110
Conversation
… save_to_ply callback
ev-mp
left a comment
There was a problem hiding this comment.
I tested it and it looks good.
Several minor suggestions to enhance user experience
| ImGui::NewLine(); | ||
| ImGui::SetCursorScreenPos({ (float)(x0 + 15), (float)(y0 + 90) }); | ||
| ImGui::Separator(); | ||
| if (ImGui::Checkbox("Meshing", &mesh)) |
There was a problem hiding this comment.
The checkbox explanation and caption are not complete, especially what will be the output if button left unchecked. The button would be used as an addon "Generate Mesh" to generate Polygons in addition to Points (that always present)
| ImGui::PushStyleColor(ImGuiCol_Text, alpha(light_grey, 1. - t)); | ||
|
|
||
| std::string s = to_string() << "Saving 3D view " | ||
| << (get_manager().get_data().is<rs2::points>() ? "without texture to " : "to ") << |
There was a problem hiding this comment.
Not clear what "without texture to.. means - also couldn't reproduce this flow
There was a problem hiding this comment.
You are right, this is redundant today (remains from early versions where you could have pointcloud without texture)
|
|
||
| config_file::instance().set_default(configurations::ply::mesh, true); | ||
| config_file::instance().set_default(configurations::ply::use_normals, false); | ||
| config_file::instance().set_default(configurations::ply::encoding, 1); |
There was a problem hiding this comment.
pls replace int with enum for maintainability
| @@ -81,76 +111,174 @@ namespace rs2 | |||
| auto width = profile.width(), height = profile.height(); | |||
| static const auto threshold = 0.05f; | |||
There was a problem hiding this comment.
Is it possible to add the threshold to the list of PLY options ? This will allow for better fine-tune of resulted models
|
Thanks @ev-mp |
|
@ev-mp - updated, please approve |
| register_simple_option(OPTION_PLY_MESH, option_range{ 0, 1, 1, 1 }); | ||
| register_simple_option(OPTION_PLY_NORMALS, option_range{ 0, 1, 0, 1 }); | ||
| register_simple_option(OPTION_PLY_BINARY, option_range{ 0, 1, 1, 1 }); | ||
| register_simple_option(OPTION_PLY_THRESHOLD, option_range{ 0, 1, 0.05f, 0 }); |
There was a problem hiding this comment.
adjust the default 0.05 as in original
| { | ||
| idx_map[i] = new_verts.size(); | ||
| new_verts.push_back(verts[i]); | ||
| new_verts.push_back({ verts[i].x, -1 * verts[i].y, -1 * verts[i].z }); |
There was a problem hiding this comment.
Can you add a comment that explain RLS->PLY coordinate system adjustment?
| option_ignore_color = realsense.option.count + 1; | ||
| option_ply_mesh = realsense.option.count + 2; | ||
| option_ply_binary = realsense.option.count + 3; | ||
| option_ply_normals = realsense.option.count + 4; |
| # Set options to the desired values | ||
| # In this example we'll generate a textual PLY with normals (mesh is already created by default) | ||
| ply.set_option(rs.save_to_ply.option_ply_binary, False) | ||
| ply.set_option(rs.save_to_ply.option_ply_normals, True) |
There was a problem hiding this comment.
OPTION_PLY_THRESHOLD Optional here - can be added for tutoring
| .def_readonly_static("option_ignore_color", &rs2::save_to_ply::OPTION_IGNORE_COLOR) | ||
| .def_readonly_static("option_ply_mesh", &rs2::save_to_ply::OPTION_PLY_MESH) | ||
| .def_readonly_static("option_ply_binary", &rs2::save_to_ply::OPTION_PLY_BINARY) | ||
| .def_readonly_static("option_ply_normals", &rs2::save_to_ply::OPTION_PLY_NORMALS); |
| const rs2_option save_to_ply::OPTION_IGNORE_COLOR; | ||
| const rs2_option save_to_ply::OPTION_PLY_MESH; | ||
| const rs2_option save_to_ply::OPTION_PLY_BINARY; | ||
| const rs2_option save_to_ply::OPTION_PLY_NORMALS; |
There was a problem hiding this comment.
Is it required here - OPTION_PLY_THRESHOLD ?
| auto profile = p.get_profile().as<video_stream_profile>(); | ||
| auto width = profile.width(), height = profile.height(); | ||
| static const auto threshold = 0.05f; | ||
| static const auto threshold = get_option(OPTION_PLY_THRESHOLD); |
There was a problem hiding this comment.
Probably should be queried per invocation
Continuation of #4906 by @AnnaRomanov