Although Delaunay triangulation algorithm can be implemented mesh surface reconstruction, but its application is mainly split in two-dimensional, three-dimensional space having problems in mesh generation. Because the three-dimensional point cloud surface reconstruction, Delaunay condition is not satisfied, not only on the determination of the maximum and minimum angle of diagonal switching criterion is not established, and the circumscribed circle Delaunay triangulation-based criterion can not guarantee the quality of the mesh.VTKSurfaceReconstructionFilter is to achieve an implicit method for surface reconstruction, i.e. seen as a curved surface contour signed distance function from the inside and outside surfaces of opposite sign worth, and the zero set is also desired curved surface. This method requires meshing point cloud data, and then estimating the direction of a tangent plane for each point and each point to the nearest tangent plane approximate distance from the surface. Thus the volume data to obtain a symbol distance. In this way, we can use VTKContourFilter to extract zero isosurface to obtain the corresponding grid.Face using point cloud data grid face surface reconstruction examples are as follows:
- #include <vtkAutoInit.h>
- VTK_MODULE_INIT(vtkRenderingOpenGL);
- VTK_MODULE_INIT(vtkRenderingFreeType);
- VTK_MODULE_INIT(vtkInteractionStyle);
- #include <vtkSmartPointer.h>
- #include <vtkPolyDataReader.h>
- #include <vtkPolyData.h>
- #include <vtkSurfaceReconstructionFilter.h>
- #include <vtkContourFilter.h>
- #include <vtkVertexGlyphFilter.h>
- #include <vtkPolyDataMapper.h>
- #include <vtkActor.h>
- #include <vtkRenderer.h>
- #include <vtkCamera.h>
- #include <vtkRenderWindow.h>
- #include <vtkRenderWindowInteractor.h>
- #include <vtkProperty.h>
- int main()
- {
- vtkSmartPointer<vtkPolyDataReader> reader =
- vtkSmartPointer<vtkPolyDataReader>::New();
- reader->SetFileName("fran_cut.vtk");
- reader->Update();
- vtkSmartPointer<vtkPolyData> points =
- vtkSmartPointer<vtkPolyData>::New();
- points->SetPoints(reader->GetOutput()->GetPoints()); // get the mesh geometry data: set of points
- vtkSmartPointer<vtkSurfaceReconstructionFilter> surf =
- vtkSmartPointer<vtkSurfaceReconstructionFilter>::New();
- surf->SetInputData(points);
- surf->SetNeighborhoodSize(20);
- surf->SetSampleSpacing(0.005);
- surf->Update();
- vtkSmartPointer<vtkContourFilter> contour =
- vtkSmartPointer<vtkContourFilter>::New();
- contour->SetInputConnection(surf->GetOutputPort());
- contour->SetValue(0, 0.0);
- contour->Update();
- //////////////////////////////////////////////////
- vtkSmartPointer <vtkVertexGlyphFilter> vertexGlyphFilter =
- vtkSmartPointer<vtkVertexGlyphFilter>::New();
- vertexGlyphFilter->AddInputData(points);
- vertexGlyphFilter->Update();
- vtkSmartPointer<vtkPolyDataMapper> pointMapper =
- vtkSmartPointer<vtkPolyDataMapper>::New();
- pointMapper->SetInputData(vertexGlyphFilter->GetOutput());
- pointMapper->ScalarVisibilityOff();
- vtkSmartPointer<vtkActor> pointActor =
- vtkSmartPointer<vtkActor>::New();
- pointActor->SetMapper(pointMapper);
- pointActor->GetProperty()->SetColor(1, 0, 0);
- pointActor->GetProperty()->SetPointSize(4);
- vtkSmartPointer<vtkPolyDataMapper> contourMapper =
- vtkSmartPointer<vtkPolyDataMapper>::New();
- contourMapper->SetInputData(contour->GetOutput());
- vtkSmartPointer<vtkActor> contourActor =
- vtkSmartPointer<vtkActor>::New();
- contourActor->SetMapper(contourMapper);
- ///////////////
- double pointView[4] = { 0, 0, 0.5, 1 };
- double contourView[4] = { 0.5, 0, 1, 1 };
- vtkSmartPointer<vtkRenderer> pointRender =
- vtkSmartPointer<vtkRenderer>::New();
- pointRender->AddActor(pointActor);
- pointRender->SetViewport(pointView);
- pointRender->SetBackground(1, 1, 1);
- vtkSmartPointer<vtkRenderer> contourRender =
- vtkSmartPointer<vtkRenderer>::New();
- contourRender->AddActor(contourActor);
- contourRender->SetViewport(contourView);
- contourRender->SetBackground(0, 1, 0);
- pointRender->GetActiveCamera()->SetPosition(0, -1, 0);
- pointRender->GetActiveCamera()->SetFocalPoint(0, 0, 0);
- pointRender->GetActiveCamera()->SetViewUp(0,0,1);
- pointRender->GetActiveCamera()->Azimuth(30);
- pointRender->GetActiveCamera()->Elevation(30);
- pointRender->ResetCamera();
- contourRender->SetActiveCamera(pointRender->GetActiveCamera());
- vtkSmartPointer<vtkRenderWindow> rw =
- vtkSmartPointer<vtkRenderWindow>::New();
- rw->AddRenderer(pointRender);
- rw->AddRenderer(contourRender);
- rw->SetSize(640, 320);
- rw->SetWindowName("3D Surface Reconstruction ");
- rw->Render();
- vtkSmartPointer<vtkRenderWindowInteractor> rwi =
- vtkSmartPointer<vtkRenderWindowInteractor>::New();
- rwi->SetRenderWindow(rw);
- rwi->Initialize();
- rwi->Start();
- return 0;
- }
When using VTKSurfaceReconstructionFilter, mainly related to two parameters, respectively using the function SetNeighborhoodSize () and SetSampleSpacing () set.SetNeighborhoodSize: Set the number of points in the neighborhood; which is used to estimate the points in the neighborhood of each point of the local cut plane. The default number of points in the neighborhood of 20, capable of handling most of the reconstruction. The more the number of set, the longer the time-consuming calculation. When the cloud point where Uneven distribution, consider increasing the value.
SetSampleSpacing: meshing for setting a denser grid spacing, with a small spacing, grid, generally default value 0.05.
The output of the embodiment as shown below:
1.《C++ primer》
2.《The VTK User’s Guide – 11thEdition》
3. Zhang Xiaodong, Luo fire spirit. VTK graphic image development of advanced [M]. Machinery Industry Press, 2015.
Turn: https: //blog.csdn.net/shenziheng1/article/details/54880915
Some errors are generated when measuring smaller objects. Direct reconstruction will make the surface unsmooth or vulnerable. In order to build a complete model, the surface needs to be smoothed and t...
Point cloud PCL free knowledge planet, speed reading of point cloud papers. Title: Local Implicit Grid Representations for 3D Scenes Author: Chiyu "Max" Jiang1,2 Avneesh Sud Planet ID: parti...
VTK 3D reconstruction Volume rendering Surface rendering Surface cutting Manual cutting Sectional framework MFC, VTK content C++, platform independent I wrote it a few years ago, but I used VTK 5.10 b...
Example 58: Triangular section (surface reconstruction) VTK series directory: 1 VTK basic concept 2 VTK image processing 3 VTK graphics processing 4 VTK body painting...
Surface reconstruction surface reconstruction In many cases, we want to generate dense 3D geometry, Triangle Mesh. However, we can only get non -structured point clouds from multi -view points or deep...
The three -dimensional reconstruction of Dianyun mainly includes: delaunay - MC - Poisson - Stich - Level set The grid is mainly used in computer graphics, including triangle and four -corner grids. M...
I. Surface reconstruction based on polynomial smooth point cloud and normal estimation This section describes normal estimation, point cloud smoothing, and data resampling based on Moving Least Square...
3. Rapid triangulation of disordered point clouds This example describes how to use the greedy projection triangulation algorithm to triangulate a directed point cloud by first projecting a directed p...
background: Sometimes the point cloud data we obtain is obtained from a viewpoint. In order to use the calculation method related to the depth map to improve efficiency, we need to convert the point c...