54 int main(
int argc,
char *argv[])
63 string outputFileName(argv[0]);
66 std::shared_ptr<PM::Transformation> rigidTrans;
70 std::shared_ptr<PM::DataPointsFilter> densityFilter =
71 PM::get().DataPointsFilterRegistrar.create(
72 "SurfaceNormalDataPointsFilter",
77 {
"keepDensities",
"1"}
81 std::shared_ptr<PM::DataPointsFilter> maxDensitySubsample =
82 PM::get().DataPointsFilterRegistrar.create(
83 "MaxDensityDataPointsFilter",
90 ifstream ifs(argv[1]);
92 icp.loadFromYaml(ifs);
99 for(
unsigned i=0; i < list.size(); i++)
101 cout <<
"---------------------\nLoading: " << list[i].readingFileName << endl;
104 newCloud =
DP::load(list[i].readingFileName);
106 if(mapPointCloud.getNbPoints() == 0)
108 mapPointCloud = newCloud;
122 catch (PM::ConvergenceError& error)
124 cout <<
"ERROR PM::ICP failed to converge: " << endl;
125 cout <<
" " << error.what() << endl;
137 mapPointCloud.concatenate(newCloud);
140 mapPointCloud = densityFilter->filter(mapPointCloud);
141 mapPointCloud = maxDensitySubsample->filter(mapPointCloud);
144 stringstream outputFileNameIter;
145 outputFileNameIter << outputFileName <<
"_" << i <<
".vtk";
147 cout <<
"outputFileName: " << outputFileNameIter.str() << endl;
148 mapPointCloud.save(outputFileNameIter.str());
158 cerr <<
"Error in command line, usage " << argv[0] <<
" icpConfiguration.yaml listOfFiles.csv" << endl;
159 cerr << endl <<
"Example:" << endl;
160 cerr << argv[0] <<
" ../examples/data/default.yaml ../examples/data/carCloudList.csv" << endl;
161 cerr << endl <<
" - or - " << endl << endl;
162 cerr << argv[0] <<
" ../examples/data/default.yaml ../examples/data/cloudList.csv" << endl << endl;