Surface Reconstruction Based on B-Spline Curve in PCL
This code run a B-spline fiting algorithm on a point cloud Q to obtain a smooth, parametric surfacere presentation.
Steps:
The B-spline surface is initialized using principal component analysis (PCA). This assumes that the poircloud has two main directions, i.e. it is roughly planar.
Refinement and fitting of B-spline surfaces
Cyclic initialization of the B-spline curve. Here, we assume that the point cloud is compact. i.e. there areno separate galaxy clusters.
Fitting of B-spline curves.
Triangulation of trimmed B-spline surfaces.
#include <iostream>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <vector>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/surface/on_nurbs/fitting_surface_tdm.h>
#include <pcl/surface/on_nurbs/fitting_curve_2d_asdm.h>
#include <pcl/surface/on_nurbs/triangulation.h>
#include <pcl/console/parse.h>
using namespace pcl::console;
void PointCloud2Vector3d (pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::on_nurbs::vector_vec3d &data);
void visualizeCurve (ON_NurbsCurve &curve,
ON_NurbsSurface &surface,
pcl::visualization::PCLVisualizer &viewer);
int main (int argc, char *argv[])
{
pcl::visualization::PCLVisualizer viewer ("PCL");
viewer.setBackgroundColor(255,255,255);
//--------------加载点云…