/////////////////////////////////////////////////////////////////////////////////////////
| 104 | |
| 105 | ////////////////////////////////////////////////////////////////////////////////////////////// |
| 106 | void |
| 107 | pcl::modeler::NormalEstimationWorker::processImpl(CloudMeshItem* cloud_mesh_item) |
| 108 | { |
| 109 | CloudMesh::PointCloudPtr cloud = cloud_mesh_item->getCloudMesh()->getCloud(); |
| 110 | |
| 111 | // Create the normal estimation class, and pass the input dataset to it |
| 112 | pcl::NormalEstimation<pcl::PointSurfel, pcl::PointNormal> normal_estimator; |
| 113 | normal_estimator.setInputCloud(cloud); |
| 114 | |
| 115 | pcl::IndicesPtr indices(new pcl::Indices()); |
| 116 | pcl::removeNaNFromPointCloud(*cloud, *indices); |
| 117 | normal_estimator.setIndices(indices); |
| 118 | |
| 119 | // Create an empty kdtree representation, and pass it to the normal estimation object. |
| 120 | // Its content will be filled inside the object, based on the given input dataset (as |
| 121 | // no other search surface is given). |
| 122 | pcl::search::KdTree<pcl::PointSurfel>::Ptr tree( |
| 123 | new pcl::search::KdTree<pcl::PointSurfel>()); |
| 124 | normal_estimator.setSearchMethod(tree); |
| 125 | |
| 126 | // Use all neighbors in a sphere of the search radius |
| 127 | normal_estimator.setRadiusSearch(*search_radius_); |
| 128 | |
| 129 | pcl::PointCloud<pcl::PointNormal> normals; |
| 130 | normal_estimator.compute(normals); |
| 131 | |
| 132 | for (std::size_t i = 0, i_end = indices->size(); i < i_end; ++i) { |
| 133 | std::size_t dest = (*indices)[i]; |
| 134 | (*cloud)[dest].normal_x = normals[i].normal_x; |
| 135 | (*cloud)[dest].normal_y = normals[i].normal_y; |
| 136 | (*cloud)[dest].normal_z = normals[i].normal_z; |
| 137 | } |
| 138 | } |
nothing calls this directly
no test coverage detected