@@ -270,45 +270,6 @@ namespace
270
270
}
271
271
}
272
272
273
- template <typename T>
274
- void estimateNormals (const typename pcl::PointCloud<T>::ConstPtr & in, const pcl::PointCloud<pcl::Normal>::Ptr & out, const yarp::os::Searchable & options)
275
- {
276
- auto algorithm = options.check (" estimatorAlgorithm" , yarp::os::Value (" " )).asString ();
277
- auto kSearch = options.check (" estimatorKSearch" , yarp::os::Value (0 )).asInt32 ();
278
- auto radiusSearch = options.check (" estimatorRadiusSearch" , yarp::os::Value (0.0 )).asFloat64 ();
279
-
280
- typename pcl::NormalEstimation<T, pcl::Normal>::Ptr estimator;
281
-
282
- if (algorithm == " NormalEstimationOMP" )
283
- {
284
- auto numberOfThreads = options.check (" estimatorNumberOfThreads" , yarp::os::Value (0 )).asInt32 ();
285
- auto * omp = new pcl::NormalEstimationOMP<T, pcl::Normal>();
286
- omp->setNumberOfThreads (numberOfThreads);
287
- estimator.reset (omp);
288
- }
289
- else if (algorithm == " NormalEstimation" )
290
- {
291
- estimator.reset (new pcl::NormalEstimation<T, pcl::Normal>());
292
- }
293
- else
294
- {
295
- throw std::invalid_argument (" unsupported normal estimation algorithm: " + algorithm);
296
- }
297
-
298
- typename pcl::search::KdTree<T>::Ptr tree (new pcl::search::KdTree<T>());
299
- tree->setInputCloud (in);
300
- estimator->setInputCloud (in);
301
- estimator->setKSearch (kSearch );
302
- estimator->setRadiusSearch (radiusSearch);
303
- estimator->setSearchMethod (tree);
304
- estimator->compute (*out);
305
-
306
- if (out->empty ())
307
- {
308
- throw std::runtime_error (" got empty cloud after normal estimation step" );
309
- }
310
- }
311
-
312
273
template <typename T>
313
274
void reconstructHull (const typename pcl::PointCloud<T>::ConstPtr & in, const pcl::PolygonMesh::Ptr & out, const yarp::os::Searchable & options)
314
275
{
@@ -400,6 +361,45 @@ namespace
400
361
organized.reconstruct (*out);
401
362
}
402
363
364
+ template <typename T>
365
+ void estimateNormals (const typename pcl::PointCloud<T>::ConstPtr & in, const pcl::PointCloud<pcl::Normal>::Ptr & out, const yarp::os::Searchable & options)
366
+ {
367
+ auto algorithm = options.check (" estimatorAlgorithm" , yarp::os::Value (" " )).asString ();
368
+ auto kSearch = options.check (" estimatorKSearch" , yarp::os::Value (0 )).asInt32 ();
369
+ auto radiusSearch = options.check (" estimatorRadiusSearch" , yarp::os::Value (0.0 )).asFloat64 ();
370
+
371
+ typename pcl::NormalEstimation<T, pcl::Normal>::Ptr estimator;
372
+
373
+ if (algorithm == " NormalEstimation" )
374
+ {
375
+ estimator.reset (new pcl::NormalEstimation<T, pcl::Normal>());
376
+ }
377
+ else if (algorithm == " NormalEstimationOMP" )
378
+ {
379
+ auto numberOfThreads = options.check (" estimatorNumberOfThreads" , yarp::os::Value (0 )).asInt32 ();
380
+ auto * omp = new pcl::NormalEstimationOMP<T, pcl::Normal>();
381
+ omp->setNumberOfThreads (numberOfThreads);
382
+ estimator.reset (omp);
383
+ }
384
+ else
385
+ {
386
+ throw std::invalid_argument (" unsupported normal estimation algorithm: " + algorithm);
387
+ }
388
+
389
+ typename pcl::search::KdTree<T>::Ptr tree (new pcl::search::KdTree<T>());
390
+ tree->setInputCloud (in);
391
+ estimator->setInputCloud (in);
392
+ estimator->setKSearch (kSearch );
393
+ estimator->setRadiusSearch (radiusSearch);
394
+ estimator->setSearchMethod (tree);
395
+ estimator->compute (*out);
396
+
397
+ if (out->empty ())
398
+ {
399
+ throw std::runtime_error (" got empty cloud after normal estimation step" );
400
+ }
401
+ }
402
+
403
403
template <typename T>
404
404
void reconstructNormal (const typename pcl::PointCloud<T>::ConstPtr & in, const pcl::PolygonMesh::Ptr & out, const yarp::os::Searchable & options)
405
405
{
0 commit comments