Estimating normals of points in a point cloud using PCL works well, but I get strange normal orientation flip at particular piece of the cloud (see screenshot, normals are yellow lines). Ofcourse I can iterate through the array of normals and correct it, but maybe there is a better way to do it directly with PCL, on the fly? Using viewpoint-oriented normals is not an option because the surface is cylinder-like, so the normals are expected to point in all directions around that axis in the end.
Here is the code for the normal estimation. Basically the snippet from official tutorial:
pcl::NormalEstimationOMP<pcl::PointXYZ, pcl::Normal> n;
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>);
tree->setInputCloud(cloud_);
n.setInputCloud(cloud_);
n.setSearchMethod(tree);
n.setKSearch(10);
n.compute(*normals);
