Skip to content

Commit c40590f

Browse files
ADD: docstring documentation and registration parameters now parameters of the methods, not hard-coded
1 parent b3d8648 commit c40590f

File tree

4 files changed

+112
-40
lines changed

4 files changed

+112
-40
lines changed

src/diffCheck.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
#include "diffCheck/geometry/DFMesh.hh"
99
#include "diffCheck/IOManager.hh"
1010
#include "diffCheck/visualizer.hh"
11-
#include "diffCheck/registration/globalregistration.hh"
11+
#include "diffCheck/registration/globalRegistration.hh"

src/diffCheck/registration/globalregistration.cc

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "globalregistration.hh"
1+
#include "globalRegistration.hh"
22

33
namespace diffCheck::registration
44
{
@@ -13,7 +13,16 @@ namespace diffCheck::registration
1313
distances = O3DSourcePointCloud->ComputePointCloudDistance(*O3DTargetPointCloud);
1414
return distances;
1515
}
16-
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DFastGlobalRegistrationFeatureMatching(std::shared_ptr<geometry::DFPointCloud> source, std::shared_ptr<geometry::DFPointCloud> target)
16+
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DFastGlobalRegistrationFeatureMatching(std::shared_ptr<geometry::DFPointCloud> source,
17+
std::shared_ptr<geometry::DFPointCloud> target,
18+
double voxelSize,
19+
double radiusKDTreeSearch,
20+
int maxNeighborKDTreeSearch,
21+
double maxCorrespondenceDistance,
22+
int iterationNumber,
23+
int maxTupleCount)
24+
25+
1726
{
1827
std::shared_ptr<open3d::geometry::PointCloud> sourceO3D = source->Cvt2O3DPointCloud();
1928
std::shared_ptr<open3d::geometry::PointCloud> targetO3D = target->Cvt2O3DPointCloud();
@@ -22,9 +31,9 @@ namespace diffCheck::registration
2231
targetO3D->VoxelDownSample(0.01);
2332

2433
std::shared_ptr<open3d::pipelines::registration::Feature> sourceFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*sourceO3D,
25-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
34+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
2635
std::shared_ptr<open3d::pipelines::registration::Feature> targetFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*targetO3D,
27-
open3d::geometry::KDTreeSearchParamHybrid(0.25, 50));
36+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
2837
std::shared_ptr<open3d::pipelines::registration::FastGlobalRegistrationOption> option = std::make_shared<open3d::pipelines::registration::FastGlobalRegistrationOption>();
2938
option->maximum_correspondence_distance_ = 0.05;
3039
option->iteration_number_ = 100;
@@ -39,7 +48,14 @@ namespace diffCheck::registration
3948
return result;
4049
}
4150

42-
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DFastGlobalRegistrationBasedOnCorrespondence(std::shared_ptr<geometry::DFPointCloud> source, std::shared_ptr<geometry::DFPointCloud> target)
51+
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DFastGlobalRegistrationBasedOnCorrespondence(std::shared_ptr<geometry::DFPointCloud> source,
52+
std::shared_ptr<geometry::DFPointCloud> target,
53+
double voxelSize,
54+
double radiusKDTreeSearch,
55+
int maxNeighborKDTreeSearch,
56+
double maxCorrespondenceDistance,
57+
int iterationNumber,
58+
int maxTupleCount)
4359
{
4460
std::shared_ptr<open3d::geometry::PointCloud> sourceO3D = source->Cvt2O3DPointCloud();
4561
std::shared_ptr<open3d::geometry::PointCloud> targetO3D = target->Cvt2O3DPointCloud();
@@ -53,9 +69,9 @@ namespace diffCheck::registration
5369
option->maximum_tuple_count_ = 500;
5470

5571
std::shared_ptr<open3d::pipelines::registration::Feature> sourceFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*sourceO3D,
56-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
72+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
5773
std::shared_ptr<open3d::pipelines::registration::Feature> targetFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*targetO3D,
58-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
74+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
5975

6076

6177
open3d::pipelines::registration::CorrespondenceSet correspondanceset;
@@ -68,7 +84,13 @@ namespace diffCheck::registration
6884
return result;
6985
}
7086

71-
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DRansacOnCorrespondence(std::shared_ptr<geometry::DFPointCloud> source, std::shared_ptr<geometry::DFPointCloud> target)
87+
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DRansacOnCorrespondence(std::shared_ptr<geometry::DFPointCloud> source,
88+
std::shared_ptr<geometry::DFPointCloud> target,
89+
double voxelSize,
90+
double radiusKDTreeSearch,
91+
int maxNeighborKDTreeSearch,
92+
double maxCorrespondenceDistance,
93+
int correspondenceSetSize)
7294
{
7395
std::shared_ptr<open3d::geometry::PointCloud> sourceO3D = source->Cvt2O3DPointCloud();
7496
std::shared_ptr<open3d::geometry::PointCloud> targetO3D = target->Cvt2O3DPointCloud();
@@ -77,9 +99,9 @@ namespace diffCheck::registration
7799
targetO3D->VoxelDownSample(0.01);
78100

79101
std::shared_ptr<open3d::pipelines::registration::Feature> sourceFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*sourceO3D,
80-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
102+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
81103
std::shared_ptr<open3d::pipelines::registration::Feature> targetFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*targetO3D,
82-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
104+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
83105

84106

85107
open3d::pipelines::registration::CorrespondenceSet correspondanceset;
@@ -88,13 +110,18 @@ namespace diffCheck::registration
88110
auto result = open3d::pipelines::registration::RegistrationRANSACBasedOnCorrespondence(*sourceO3D,
89111
*targetO3D,
90112
correspondanceset,
91-
0.05,
113+
maxCorrespondenceDistance,
92114
open3d::pipelines::registration::TransformationEstimationPointToPoint(),
93-
200);
115+
correspondenceSetSize);
94116
return result;
95117
}
96118

97-
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DRansacOnFeatureMatching(std::shared_ptr<geometry::DFPointCloud> source, std::shared_ptr<geometry::DFPointCloud> target)
119+
open3d::pipelines::registration::RegistrationResult GlobalRegistration::O3DRansacOnFeatureMatching(std::shared_ptr<geometry::DFPointCloud> source,
120+
std::shared_ptr<geometry::DFPointCloud> target,
121+
double voxelSize,
122+
double radiusKDTreeSearch,
123+
int maxNeighborKDTreeSearch,
124+
double maxCorrespondenceDistance)
98125
{
99126
std::shared_ptr<open3d::geometry::PointCloud> sourceO3D = source->Cvt2O3DPointCloud();
100127
std::shared_ptr<open3d::geometry::PointCloud> targetO3D = target->Cvt2O3DPointCloud();
@@ -103,15 +130,15 @@ namespace diffCheck::registration
103130
targetO3D->VoxelDownSample(0.01);
104131

105132
std::shared_ptr<open3d::pipelines::registration::Feature> sourceFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*sourceO3D,
106-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
133+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
107134
std::shared_ptr<open3d::pipelines::registration::Feature> targetFPFHFeatures = open3d::pipelines::registration::ComputeFPFHFeature(*targetO3D,
108-
open3d::geometry::KDTreeSearchParamHybrid(3, 50));
135+
open3d::geometry::KDTreeSearchParamHybrid(radiusKDTreeSearch, maxNeighborKDTreeSearch));
109136
auto result = open3d::pipelines::registration::RegistrationRANSACBasedOnFeatureMatching(*sourceO3D,
110137
*targetO3D,
111138
*sourceFPFHFeatures,
112139
*targetFPFHFeatures,
113140
false,
114-
0.05);
141+
maxCorrespondenceDistance);
115142

116143
return result;
117144
}

0 commit comments

Comments
 (0)