MCPcopy Create free account
hub / github.com/LiangliangNan/PolyFit / reconstruct

Function reconstruct

code/method/reconstruction.cpp:27–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27Map* reconstruct(
28 PointSet *point_cloud, // input point cloud
29 LinearProgramSolver::SolverName solver, // solver name
30 float data_fitting, // weight for data fitting term
31 float model_coverage, // weight for model coverage term
32 float model_complexity // weight for model complexity term
33)
34{
35 // step 1: refine planes
36 const std::vector<VertexGroup::Ptr>& groups = point_cloud->groups();
37 if (groups.empty()) {
38 std::cerr << "planar segments do not exist" << std::endl;
39 return nullptr;
40 }
41 HypothesisGenerator hypothesis(point_cloud);
42 hypothesis.refine_planes();
43
44 // step 2: generate face hypothesis
45 Map* mesh = hypothesis.generate();
46 if (!mesh) {
47 std::cerr << "failed generating candidate faces. Please check if the input point cloud has good planar segments" << std::endl;
48 return nullptr;
49 }
50 hypothesis.compute_confidences(mesh, false);
51
52 // step 3: face selection
53 FaceSelection selector(point_cloud, mesh);
54 selector.optimize(&hypothesis, solver, data_fitting, model_coverage, model_complexity);
55
56 if (mesh->size_of_facets() == 0) {
57 std::cerr << "optimization failed: result has no face" << std::endl;
58 return nullptr;
59 }
60 // now we don't need the point cloud anymore, and it can be deleted
61 return mesh;
62}
63

Callers 1

mainFunction · 0.85

Calls 5

refine_planesMethod · 0.80
compute_confidencesMethod · 0.80
emptyMethod · 0.45
generateMethod · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected