39 #include "boost/filesystem.hpp" 54 int main(
int argc,
char *argv[])
75 name =
"MinDistDataPointsFilter";
76 params[
"minDist"] =
"1.0";
78 PM::get().DataPointsFilterRegistrar.create(name, params);
81 name =
"RandomSamplingDataPointsFilter";
82 params[
"prob"] =
"0.05";
83 std::shared_ptr<PM::DataPointsFilter>
rand_read =
84 PM::get().DataPointsFilterRegistrar.create(name, params);
88 name =
"MinDistDataPointsFilter";
89 params[
"minDist"] =
"1.0";
91 PM::get().DataPointsFilterRegistrar.create(name, params);
94 name =
"RandomSamplingDataPointsFilter";
95 params[
"prob"] =
"0.05";
96 std::shared_ptr<PM::DataPointsFilter>
rand_ref =
97 PM::get().DataPointsFilterRegistrar.create(name, params);
101 name =
"KDTreeMatcher";
103 params[
"epsilon"] =
"3.16";
104 std::shared_ptr<PM::Matcher>
kdtree =
105 PM::get().MatcherRegistrar.create(name, params);
109 name =
"TrimmedDistOutlierFilter";
110 params[
"ratio"] =
"0.75";
111 std::shared_ptr<PM::OutlierFilter>
trim =
112 PM::get().OutlierFilterRegistrar.create(name, params);
116 name =
"PointToPointErrorMinimizer";
118 PM::get().ErrorMinimizerRegistrar.create(name);
121 name =
"CounterTransformationChecker";
122 params[
"maxIterationCount"] =
"150";
123 std::shared_ptr<PM::TransformationChecker>
maxIter =
124 PM::get().TransformationCheckerRegistrar.create(name, params);
127 name =
"DifferentialTransformationChecker";
128 params[
"minDiffRotErr"] =
"0.001";
129 params[
"minDiffTransErr"] =
"0.01";
130 params[
"smoothLength"] =
"4";
131 std::shared_ptr<PM::TransformationChecker>
diff =
132 PM::get().TransformationCheckerRegistrar.create(name, params);
137 PM::get().InspectorRegistrar.create(
"NullInspector");
148 std::shared_ptr<PM::Transformation> rigidTrans =
149 PM::get().TransformationRegistrar.create(
"RigidTransformation");
152 icp.readingDataPointsFilters.push_back(minDist_read);
153 icp.readingDataPointsFilters.push_back(rand_read);
155 icp.referenceDataPointsFilters.push_back(minDist_ref);
156 icp.referenceDataPointsFilters.push_back(rand_ref);
160 icp.outlierFilters.push_back(trim);
164 icp.transformationCheckers.push_back(maxIter);
165 icp.transformationCheckers.push_back(diff);
171 icp.transformations.push_back(rigidTrans);
178 icp.transformations.apply(data_out, T);
181 ref.
save(
"test_ref.vtk");
182 data.
save(
"test_data_in.vtk");
183 data_out.
save(
"test_data_out.vtk");
184 cout <<
"Final transformation:" << endl << T << endl;
193 cerr <<
"Wrong number of arguments, usage " << argv[0] <<
" reference.csv reading.csv" << endl;
194 cerr <<
"Will create 3 vtk files for inspection: ./test_ref.vtk, ./test_data_in.vtk and ./test_data_out.vtk" << endl;
195 cerr << endl <<
"2D Example:" << endl;
196 cerr <<
" " << argv[0] <<
" ../../examples/data/2D_twoBoxes.csv ../../examples/data/2D_oneBox.csv" << endl;
197 cerr << endl <<
"3D Example:" << endl;
198 cerr <<
" " << argv[0] <<
" ../../examples/data/car_cloud400.csv ../../examples/data/car_cloud401.csv" << endl;
std::shared_ptr< Interface > create(const std::string &name, const Parametrizable::Parameters ¶ms=Parametrizable::Parameters()) const
Create an instance.
A factor for subclasses of Interface.
void setLogger(std::shared_ptr< Logger > newLogger)
Set a new logger, protected by a mutex.
PM::DataPoints DataPoints
std::map< std::string, Parameter > Parameters
Parameters stored as a map of string->string.
static const PointMatcher & get()
Return instances.
void validateArgs(int argc, char *argv[], bool &isCSV)
void save(const std::string &fileName, bool binary=false) const
Save a point cloud to a file, determine format from extension.
static DataPoints load(const std::string &fileName)
Load a point cloud from a file, determine format from extension.
Matrix TransformationParameters
A matrix holding the parameters a transformation.
int main(int argc, char *argv[])