@@ -164,53 +164,59 @@ pcl::registration::FPCSInitialAlignment <PointSource, PointTarget, NormalT, Scal
164
164
pcl::StopWatch timer;
165
165
166
166
#ifdef _OPENMP
167
- #pragma omp parallel for schedule (dynamic) num_threads (nr_threads_)
167
+ #pragma omp parallel num_threads (nr_threads_)
168
168
#endif
169
-
170
- for (int i = 0 ; i < max_iterations_; i++)
171
169
{
172
-
173
170
#ifdef _OPENMP
174
- #pragma omp flush (abort)
171
+ std::srand (static_cast <unsigned int > (std::time (NULL )) ^ omp_get_thread_num ());
172
+ #pragma omp for schedule (dynamic)
175
173
#endif
174
+ for (int i = 0 ; i < max_iterations_; i++)
175
+ {
176
+
177
+ #ifdef _OPENMP
178
+ #pragma omp flush (abort)
179
+ #endif
176
180
177
- MatchingCandidates candidates (1 );
178
- std::vector <int > base_indices (4 );
179
- float ratio[2 ];
180
- all_candidates [i] = candidates;
181
+ MatchingCandidates candidates (1 );
182
+ std::vector <int > base_indices (4 );
183
+ float ratio[2 ];
184
+ all_candidates [i] = candidates;
181
185
182
- if (!abort )
183
- {
184
- // select four coplanar point base
185
- if (selectBase (base_indices, ratio) == 0 )
186
+ if (!abort )
186
187
{
187
- // calculate candidate pair correspondences using diagonal lenghts of base
188
- pcl::Correspondences pairs_a, pairs_b;
189
- if (bruteForceCorrespondences (base_indices[0 ], base_indices[1 ], pairs_a) == 0 &&
190
- bruteForceCorrespondences (base_indices[2 ], base_indices[3 ], pairs_b) == 0 )
188
+ // select four coplanar point base
189
+ if (selectBase (base_indices, ratio) == 0 )
191
190
{
192
- // determine candidate matches by combining pair correspondences based on segment distances
193
- std::vector <std::vector <int > > matches;
194
- if (determineBaseMatches (base_indices, matches, pairs_a, pairs_b, ratio) == 0 )
191
+ // calculate candidate pair correspondences using diagonal lenghts of base
192
+ pcl::Correspondences pairs_a, pairs_b;
193
+ if (bruteForceCorrespondences (base_indices[0 ], base_indices[1 ], pairs_a) == 0 &&
194
+ bruteForceCorrespondences (base_indices[2 ], base_indices[3 ], pairs_b) == 0 )
195
195
{
196
- // check and evaluate candidate matches and store them
197
- handleMatches (base_indices, matches, candidates);
198
- if (candidates.size () != 0 )
199
- all_candidates [i] = candidates;
196
+ // determine candidate matches by combining pair correspondences based on segment distances
197
+ std::vector <std::vector <int > > matches;
198
+ if (determineBaseMatches (base_indices, matches, pairs_a, pairs_b, ratio) == 0 )
199
+ {
200
+ // check and evaluate candidate matches and store them
201
+ handleMatches (base_indices, matches, candidates);
202
+ if (candidates.size () != 0 )
203
+ all_candidates[i] = candidates;
204
+ }
200
205
}
201
206
}
202
- }
203
207
204
- // check terminate early (time or fitness_score threshold reached)
205
- abort = (candidates.size () > 0 ? candidates[0 ].fitness_score < score_threshold_ : abort );
206
- abort = (abort ? abort : timer.getTimeSeconds () > max_runtime_);
208
+ // check terminate early (time or fitness_score threshold reached)
209
+ abort = (candidates.size () > 0 ? candidates[0 ].fitness_score < score_threshold_ : abort );
210
+ abort = (abort ? abort : timer.getTimeSeconds () > max_runtime_);
207
211
208
212
209
- #ifdef _OPENMP
210
- #pragma omp flush (abort)
211
- #endif
213
+ #ifdef _OPENMP
214
+ #pragma omp flush (abort)
215
+ #endif
216
+ }
212
217
}
213
218
}
219
+
214
220
215
221
// determine best match over all trys
216
222
finalCompute (all_candidates);
@@ -301,7 +307,7 @@ pcl::registration::FPCSInitialAlignment <PointSource, PointTarget, NormalT, Scal
301
307
}
302
308
303
309
// set further parameter
304
- if (score_threshold_ < FLT_MAX)
310
+ if (score_threshold_ == FLT_MAX)
305
311
score_threshold_ = 1 .f - approx_overlap_;
306
312
307
313
if (max_iterations_ < 4 )
0 commit comments