9 from pypointmatcher
import pointmatcher
as pm, pointmatchersupport
as pms
13 Parameters = pms.Parametrizable.Parameters
18 output_base_directory =
"tests/icp_customized/" 21 output_base_file =
"test" 28 ref =
DP(DP.load(
'../data/car_cloud400.csv'))
29 data =
DP(DP.load(
'../data/car_cloud401.csv'))
33 ref =
DP(DP.load(
'../data/2D_twoBoxes.csv'))
34 data =
DP(DP.load(
'../data/2D_oneBox.csv'))
45 name =
"MinDistDataPointsFilter" 46 params[
"minDist"] =
"1.0" 47 minDist_read = PM.get().DataPointsFilterRegistrar.create(name, params)
50 name =
"RandomSamplingDataPointsFilter" 51 params[
"prob"] =
"0.05" 52 rand_read = PM.get().DataPointsFilterRegistrar.create(name, params)
56 name =
"MinDistDataPointsFilter" 57 params[
"minDist"] =
"1.0" 58 minDist_ref = PM.get().DataPointsFilterRegistrar.create(name, params)
61 name =
"RandomSamplingDataPointsFilter" 62 params[
"prob"] =
"0.05" 63 rand_ref = PM.get().DataPointsFilterRegistrar.create(name, params)
67 name =
"KDTreeMatcher" 69 params[
"epsilon"] =
"3.16" 70 kdtree = PM.get().MatcherRegistrar.create(name, params)
74 name =
"TrimmedDistOutlierFilter" 75 params[
"ratio"] =
"0.75" 76 trim = PM.get().OutlierFilterRegistrar.create(name, params)
80 name =
"PointToPointErrorMinimizer" 81 pointToPoint = PM.get().ErrorMinimizerRegistrar.create(name)
85 name =
"CounterTransformationChecker" 86 params[
"maxIterationCount"] =
"150" 87 maxIter = PM.get().TransformationCheckerRegistrar.create(name, params)
90 name =
"DifferentialTransformationChecker" 91 params[
"minDiffRotErr"] =
"0.001" 92 params[
"minDiffTransErr"] =
"0.01" 93 params[
"smoothLength"] =
"4" 94 diff = PM.get().TransformationCheckerRegistrar.create(name, params)
99 name =
"NullInspector" 100 nullInspect = PM.get().InspectorRegistrar.create(name)
111 name =
"RigidTransformation" 112 rigid_trans = PM.get().TransformationRegistrar.create(name)
115 icp.readingDataPointsFilters.append(minDist_read)
116 icp.readingDataPointsFilters.append(rand_read)
118 icp.referenceDataPointsFilters.append(minDist_ref)
119 icp.referenceDataPointsFilters.append(rand_ref)
123 icp.outlierFilters.append(trim)
125 icp.errorMinimizer = pointToPoint
127 icp.transformationCheckers.append(maxIter)
128 icp.transformationCheckers.append(diff)
131 icp.inspector = nullInspect
134 icp.transformations.append(rigid_trans)
142 icp.transformations.apply(data_out, T)
145 ref.save(f
"{output_base_directory + test_base}_{output_base_file}_ref.vtk")
146 data.save(f
"{output_base_directory + test_base}_{output_base_file}_data_in.vtk")
147 data_out.save(f
"{output_base_directory + test_base}_{output_base_file}_data_out.vtk")
149 print(f
"{test_base} ICP transformation:\n{T}".replace(
"[",
" ").replace(
"]",
" "))
void setLogger(std::shared_ptr< Logger > newLogger)
Set a new logger, protected by a mutex.