9
9
10
10
# Basic registation example with numpy arrays
11
11
def example_numpy1 (target_raw_numpy : numpy .ndarray , source_raw_numpy : numpy .ndarray ):
12
+ print ('*** example_numpy1 ***' )
13
+
12
14
# Example A : Perform registration with numpy arrays
13
15
# Arguments
14
16
# - target_points : Nx4 or Nx3 numpy array of the target point cloud
@@ -22,10 +24,15 @@ def example_numpy1(target_raw_numpy : numpy.ndarray, source_raw_numpy : numpy.nd
22
24
# - num_threads : Number of threads
23
25
result = small_gicp .align (target_raw_numpy , source_raw_numpy , downsampling_resolution = 0.25 )
24
26
27
+ print ('--- registration result ---' )
28
+ print (result )
29
+
25
30
return result .T_target_source
26
31
27
32
# Example to perform preprocessing and registration separately
28
33
def example_numpy2 (target_raw_numpy : numpy .ndarray , source_raw_numpy : numpy .ndarray ):
34
+ print ('*** example_numpy2 ***' )
35
+
29
36
# Example B : Perform preprocessing and registration separately
30
37
31
38
# Preprocess point clouds
@@ -38,6 +45,9 @@ def example_numpy2(target_raw_numpy : numpy.ndarray, source_raw_numpy : numpy.nd
38
45
target , target_tree = small_gicp .preprocess_points (target_raw_numpy , downsampling_resolution = 0.25 )
39
46
source , source_tree = small_gicp .preprocess_points (source_raw_numpy , downsampling_resolution = 0.25 )
40
47
48
+ print ('preprocessed target=' , target )
49
+ print ('preprocessed source=' , source )
50
+
41
51
# Align point clouds
42
52
# Arguments
43
53
# - target : Target point cloud (small_gicp.PointCloud)
@@ -48,26 +58,39 @@ def example_numpy2(target_raw_numpy : numpy.ndarray, source_raw_numpy : numpy.nd
48
58
# - max_correspondence_distance : Maximum correspondence distance
49
59
# - num_threads : Number of threads
50
60
result = small_gicp .align (target , source , target_tree )
51
-
61
+
62
+ print ('--- registration result ---' )
63
+ print (result )
64
+
52
65
return result .T_target_source
53
66
54
67
55
68
# Basic registation example with small_gicp.PointCloud
56
69
def example_small1 (target_raw_numpy : numpy .ndarray , source_raw_numpy : numpy .ndarray ):
70
+ print ('*** example_small1 ***' )
71
+
57
72
# Convert numpy arrays (Nx3 or Nx4) to small_gicp.PointCloud
58
73
target_raw = small_gicp .PointCloud (target_raw_numpy )
59
74
source_raw = small_gicp .PointCloud (source_raw_numpy )
60
75
61
76
# Preprocess point clouds
62
77
target , target_tree = small_gicp .preprocess_points (target_raw , downsampling_resolution = 0.25 )
63
78
source , source_tree = small_gicp .preprocess_points (source_raw , downsampling_resolution = 0.25 )
64
-
79
+
80
+ print ('preprocessed target=' , target )
81
+ print ('preprocessed source=' , source )
82
+
65
83
result = small_gicp .align (target , source , target_tree )
84
+
85
+ print ('--- registration result ---' )
86
+ print (result )
66
87
67
88
return result .T_target_source
68
89
69
90
# Example to perform each preprocessing and registration separately
70
91
def example_small2 (target_raw_numpy : numpy .ndarray , source_raw_numpy : numpy .ndarray ):
92
+ print ('*** example_small2 ***' )
93
+
71
94
# Convert numpy arrays (Nx3 or Nx4) to small_gicp.PointCloud
72
95
target_raw = small_gicp .PointCloud (target_raw_numpy )
73
96
source_raw = small_gicp .PointCloud (source_raw_numpy )
@@ -79,13 +102,19 @@ def example_small2(target_raw_numpy : numpy.ndarray, source_raw_numpy : numpy.nd
79
102
# KdTree construction
80
103
target_tree = small_gicp .KdTree (target )
81
104
source_tree = small_gicp .KdTree (source )
82
-
105
+
83
106
# Estimate covariances
84
107
small_gicp .estimate_covariances (target , target_tree )
85
108
small_gicp .estimate_covariances (source , source_tree )
86
109
110
+ print ('preprocessed target=' , target )
111
+ print ('preprocessed source=' , source )
112
+
87
113
# Align point clouds
88
114
result = small_gicp .align (target , source , target_tree )
115
+
116
+ print ('--- registration result ---' )
117
+ print (result )
89
118
90
119
return result .T_target_source
91
120
0 commit comments