surface reconstruction - point cloud libraryoutline 1.introduction 2.plane detection problem...
TRANSCRIPT
Surface ReconstructionVincent Rabaud
November 03, 2011
Outline
1. Introduction
2. Plane DetectionProblem definitionPlane estimationHull refinementResults
3. Moving least squaresProblemGistResults
4. TriangulationMeshingResults
5. SmoothingVTK smootherPoisson
6. Conclusion
Vincent Rabaud / PCL :: Surface Reconstruction
Outline
1. Introduction
2. Plane DetectionProblem definitionPlane estimationHull refinementResults
3. Moving least squaresProblemGistResults
4. TriangulationMeshingResults
5. SmoothingVTK smootherPoisson
6. Conclusion
Vincent Rabaud / PCL :: Surface Reconstruction
Introduction
Wanted: surface/mesh from a point cloud Why ?I the world is not sparseI for better graphics/visualizationI for texture mappingI CAD modelsI compression
Vincent Rabaud / PCL :: Surface Reconstruction
Introduction
In robotics:I object detectionI object grasping
Vincent Rabaud / PCL :: Surface Reconstruction
Plane detection
We are given a noisy point cloud and we want to find the bestplane
Vincent Rabaud / PCL :: Surface Reconstruction
Plane detection
1 // Define the RANSAC object2 pcl::SACSegmentation<pcl::PointXYZ> seg;3 // Define its coefficients4 seg.setOptimizeCoefficients (true);5 seg.setMethodType (pcl::SAC_RANSAC);6 // Specify the plane parameters7 seg.setModelType (pcl::SACMODEL_PLANE);8 seg.setDistanceThreshold (0.01);9 // Specify the input
10 seg.setInputCloud (cloud_filtered);11 // Segment12 pcl::ModelCoefficients::Ptr coefficients (new pcl::
ModelCoefficients);13 pcl::PointIndices::Ptr inliers (new pcl::
PointIndices);14 seg.segment (*inliers, *coefficients);
Vincent Rabaud / PCL :: Surface Reconstruction
Hull refinement
1 // Create the projection structure2 pcl::ProjectInliers<pcl::PointXYZ> proj;3 proj.setModelType (pcl::SACMODEL_PLANE);4 proj.setInputCloud (cloud_filtered);5 proj.setModelCoefficients (coefficients);6 // Create the projected point cloud7 pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_projected
(new pcl::PointCloud<pcl::PointXYZ>);8 proj.filter (*cloud_projected);9 // Create a Convex Hull representation of the
projected inliers10 pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_hull (new
pcl::PointCloud<pcl::PointXYZ>);11 pcl::ConvexHull<pcl::PointXYZ> chull;12 chull.setInputCloud (cloud_projected);13 chull.setAlpha (0.1);14 chull.reconstruct (*cloud_hull);
Vincent Rabaud / PCL :: Surface Reconstruction
Plane detection
What a nice convex hull !
Vincent Rabaud / PCL :: Surface Reconstruction
Outline
1. Introduction
2. Plane DetectionProblem definitionPlane estimationHull refinementResults
3. Moving least squaresProblemGistResults
4. TriangulationMeshingResults
5. SmoothingVTK smootherPoisson
6. Conclusion
Vincent Rabaud / PCL :: Surface Reconstruction
Problem
Noisy input cloud, normals are all over the place
Vincent Rabaud / PCL :: Surface Reconstruction
Moving Least squares
Input noisy cloud is named: cloud
1 // Moving least square object2 pcl::MovingLeastSquares<pcl::PointXYZ, pcl::Normal>
mls;3 mls.setInputCloud (cloud);4 mls.setPolynomialFit (true);5 mls.setSearchRadius (0.03);6 // Define the tree to find the neighbors7 pcl::search::KdTree<pcl::PointXYZ>::Ptr tree8 (new pcl::search::KdTree<pcl::PointXYZ>);9 tree->setInputCloud (cloud);
10 mls.setSearchMethod (tree);
Vincent Rabaud / PCL :: Surface Reconstruction
Performing the smoothing
1 // Define the output and the normals2 pcl::PointCloud<pcl::PointXYZ> mls_points;3 pcl::PointCloud<pcl::Normal>::Ptr mls_normals (new4 pcl::PointCloud<pcl::Normal> ());5 mls.setOutputNormals (mls_normals);6 // Compute the smoothed cloud7 mls.reconstruct (mls_points);8 // Extra: merge fields9 pcl::PointCloud<pcl::PointNormal> mls_cloud;
10 pcl::concatenateFields (mls_points, *mls_normals,mls_cloud);
Vincent Rabaud / PCL :: Surface Reconstruction
Result 1
Vincent Rabaud / PCL :: Surface Reconstruction
Result 2
And even more smoothing
Vincent Rabaud / PCL :: Surface Reconstruction
Outline
1. Introduction
2. Plane DetectionProblem definitionPlane estimationHull refinementResults
3. Moving least squaresProblemGistResults
4. TriangulationMeshingResults
5. SmoothingVTK smootherPoisson
6. Conclusion
Vincent Rabaud / PCL :: Surface Reconstruction
Meshing
I method based on growing neighborhoodsI connect neighbors and increase the neighborhoods untill
all points are connectedI works best for smooth regions
Vincent Rabaud / PCL :: Surface Reconstruction
Code
1 // Initialize objects2 pcl::GreedyProjectionTriangulation<pcl::PointNormal>
gp3;3
4 // Set the maximum distance between connected points(maximum edge length)
5 gp3.setSearchRadius (0.025);6
7 // Set typical values for the parameters8 gp3.setMu(2.5);9 gp3.setMaximumNearestNeighbors(100);
10 gp3.setMaximumSurfaceAngle(M_PI/4); // 45 degrees11 gp3.setMinimumAngle(M_PI/18); // 10 degrees12 gp3.setMaximumAngle(2*M_PI/3); // 120 degrees13 gp3.setNormalConsistency(false);
Vincent Rabaud / PCL :: Surface Reconstruction
Code2
1 // Create search tree*2 pcl::search::KdTree<pcl::PointNormal>::Ptr tree2 (
new pcl::search::KdTree<pcl::PointNormal>);3 tree2->setInputCloud (cloud_with_normals);4 // Define inputs to thetriangulation structure5 gp3.setInputCloud (cloud_with_normals);6 gp3.setSearchMethod (tree2);7 // Copute the mesh8 pcl::PolygonMesh triangles;9 gp3.reconstruct (triangles);
Vincent Rabaud / PCL :: Surface Reconstruction
Results
Vincent Rabaud / PCL :: Surface Reconstruction
Outline
1. Introduction
2. Plane DetectionProblem definitionPlane estimationHull refinementResults
3. Moving least squaresProblemGistResults
4. TriangulationMeshingResults
5. SmoothingVTK smootherPoisson
6. Conclusion
Vincent Rabaud / PCL :: Surface Reconstruction
Smooth
Works by subdivding triangles and fitting a polynomial to thenew points.
1 pcl::surface::VTKSmoother vtkSmoother;2 vtkSmoother.convertToVTK(mesh);3 vtkSmoother.smoothMeshWindowedSinc();4 vtkSmoother.convertToPCL(mesh);
Vincent Rabaud / PCL :: Surface Reconstruction
Bunny
Vincent Rabaud / PCL :: Surface Reconstruction
Smooth
Only in trunk right now.
Vincent Rabaud / PCL :: Surface Reconstruction
Conclusion
I faster plane detection code using CUDA: realtime, severalplanes at once.
I Poisson in trunk (GSOC: Greg Long)I marching cubes in trunk (GSOC: Greg Long)I PCL-TOCS with TOYOTA: code sprint for improving mesh
reconstruction.I more techniques (e.g. Poisson reconstruction, marching
cubes).
Vincent Rabaud / PCL :: Surface Reconstruction