| 100 | } |
| 101 | |
| 102 | int |
| 103 | main (int argc, char **argv) |
| 104 | { |
| 105 | double dist = 0.1; |
| 106 | pcl::console::parse_argument (argc, argv, "-d", dist); |
| 107 | |
| 108 | double rans = 0.1; |
| 109 | pcl::console::parse_argument (argc, argv, "-r", rans); |
| 110 | |
| 111 | int iter = 100; |
| 112 | pcl::console::parse_argument (argc, argv, "-i", iter); |
| 113 | |
| 114 | pcl::registration::ELCH<PointType> elch; |
| 115 | pcl::IterativeClosestPoint<PointType, PointType>::Ptr icp (new pcl::IterativeClosestPoint<PointType, PointType>); |
| 116 | icp->setMaximumIterations (iter); |
| 117 | icp->setMaxCorrespondenceDistance (dist); |
| 118 | icp->setRANSACOutlierRejectionThreshold (rans); |
| 119 | elch.setReg (icp); |
| 120 | |
| 121 | std::vector<int> pcd_indices; |
| 122 | pcd_indices = pcl::console::parse_file_extension_argument (argc, argv, ".pcd"); |
| 123 | |
| 124 | CloudVector clouds; |
| 125 | for (std::size_t i = 0; i < pcd_indices.size (); i++) |
| 126 | { |
| 127 | CloudPtr pc (new Cloud); |
| 128 | pcl::io::loadPCDFile (argv[pcd_indices[i]], *pc); |
| 129 | clouds.emplace_back(argv[pcd_indices[i]], pc); |
| 130 | std::cout << "loading file: " << argv[pcd_indices[i]] << " size: " << pc->size () << std::endl; |
| 131 | elch.addPointCloud (clouds[i].second); |
| 132 | } |
| 133 | |
| 134 | int first = 0, last = 0; |
| 135 | |
| 136 | for (std::size_t i = 0; i < clouds.size (); i++) |
| 137 | { |
| 138 | |
| 139 | if (loopDetection (static_cast<int>(i), clouds, 3.0, first, last)) |
| 140 | { |
| 141 | std::cout << "Loop between " << first << " (" << clouds[first].first << ") and " << last << " (" << clouds[last].first << ")" << std::endl; |
| 142 | elch.setLoopStart (first); |
| 143 | elch.setLoopEnd (last); |
| 144 | elch.compute (); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | for (const auto &cloud : clouds) |
| 149 | { |
| 150 | std::string result_filename (cloud.first); |
| 151 | result_filename = result_filename.substr (result_filename.rfind ('/') + 1); |
| 152 | pcl::io::savePCDFileBinary (result_filename, *(cloud.second)); |
| 153 | std::cout << "saving result to " << result_filename << std::endl; |
| 154 | } |
| 155 | |
| 156 | return 0; |
| 157 | } |
nothing calls this directly
no test coverage detected