MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / main

Function main

tools/lum.cpp:58–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56using CloudVector = std::vector<CloudPair>;
57
58int
59main (int argc, char **argv)
60{
61 double dist = 2.5;
62 pcl::console::parse_argument (argc, argv, "-d", dist);
63
64 int iter = 10;
65 pcl::console::parse_argument (argc, argv, "-i", iter);
66
67 int lumIter = 1;
68 pcl::console::parse_argument (argc, argv, "-l", lumIter);
69
70 double loopDist = 5.0;
71 pcl::console::parse_argument (argc, argv, "-D", loopDist);
72
73 unsigned int loopCount = 20;
74 pcl::console::parse_argument (argc, argv, "-c", loopCount);
75
76 pcl::registration::LUM<PointType> lum;
77 lum.setMaxIterations (lumIter);
78 lum.setConvergenceThreshold (0.001f);
79
80 std::vector<int> pcd_indices;
81 pcd_indices = pcl::console::parse_file_extension_argument (argc, argv, ".pcd");
82
83 CloudVector clouds;
84 for (std::size_t i = 0; i < pcd_indices.size (); i++)
85 {
86 CloudPtr pc (new Cloud);
87 pcl::io::loadPCDFile (argv[pcd_indices[i]], *pc);
88 clouds.emplace_back(argv[pcd_indices[i]], pc);
89 std::cout << "loading file: " << argv[pcd_indices[i]] << " size: " << pc->size () << std::endl;
90 lum.addPointCloud (clouds[i].second);
91 }
92
93 for (int i = 0; i < iter; i++)
94 {
95 for (std::size_t i = 1; i < clouds.size (); i++)
96 for (std::size_t j = 0; j < i; j++)
97 {
98 Eigen::Vector4f ci, cj;
99 pcl::compute3DCentroid (*(clouds[i].second), ci);
100 pcl::compute3DCentroid (*(clouds[j].second), cj);
101 Eigen::Vector4f diff = ci - cj;
102
103 //std::cout << i << " " << j << " " << diff.norm () << std::endl;
104
105 if(diff.norm () < loopDist && (i - j == 1 || i - j > loopCount))
106 {
107 if(i - j > loopCount)
108 std::cout << "add connection between " << i << " (" << clouds[i].first << ") and " << j << " (" << clouds[j].first << ")" << std::endl;
109 pcl::registration::CorrespondenceEstimation<PointType, PointType> ce;
110 ce.setInputTarget (clouds[i].second);
111 ce.setInputSource (clouds[j].second);
112 pcl::CorrespondencesPtr corr (new pcl::Correspondences);
113 ce.determineCorrespondences (*corr, dist);
114 if (corr->size () > 2)
115 lum.setCorrespondences (j, i, corr);

Callers

nothing calls this directly

Calls 15

parse_argumentFunction · 0.85
loadPCDFileFunction · 0.85
savePCDFileBinaryFunction · 0.85
emplace_backMethod · 0.80
getNumVerticesMethod · 0.80
getTransformedCloudMethod · 0.80
compute3DCentroidFunction · 0.50
setMaxIterationsMethod · 0.45
sizeMethod · 0.45
addPointCloudMethod · 0.45

Tested by

no test coverage detected