# Generating 3d body mesh from pointcloud

**URL:** https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545
**Category:** Support
**Created:** [March 20, 2019, 7:38pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545 "2019-03-20T19:38:01Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 20, 2019, 7:38pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/1 "2019-03-20T19:38:01Z")

</div>

I have several pointcloud files consisting of x, y, and z points associated with a human body. What I’d like to do is generate a 3d mesh of this body from the pointcloud. Is this possible, and if so what filters should I use? I tried using SurfaceReconstructionFilter, ContourFilter, and ReverseSense together (as in the SurfaceFromUnorganizedPoints example) but the result looks very blocky.

---

<div class="post-metadata">

### Author: ![marcomusy](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marcomusy/32/95_2.png) [@marcomusy](https://discourse.vtk.org/u/marcomusy)
#### Post date: [March 20, 2019, 7:57pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/2 "2019-03-20T19:57:28Z")

</div>

Check out this example on how to reconstruct a surface from points: [recosuface.py](https://github.com/marcomusy/vtkplotter/blob/master/examples/advanced/recosurface.py)  
In the example:

1. An object is loaded and noise is added to its vertices.
2. the point cloud is smoothened with MLS (see [moving\_least\_squares.py](https://github.com/marcomusy/vtkplotter/blob/master/examples/advanced/moving_least_squares2D.py))
3. `clean()` imposes a minimum distance among mesh points where `tol` is a fraction of the cloud size.
4. a triangular mesh is extracted from this set of sparse points, `bins` is the number of voxels of the subdivision

 ![recosurf](https://discourse.vtk.org/uploads/default/original/1X/a1ed7d7235a0b64056db164c27630dec5e0c59ec.jpeg)

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 20, 2019, 8:09pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/3 "2019-03-20T20:09:39Z")

</div>

The [VTKExamples Project](https://lorensen.github.io/VTKExamples/site/) has three algorithms to generate meshes from point clouds:

[https://lorensen.github.io/VTKExamples/site/Cxx/Points/ExtractSurface/](https://lorensen.github.io/VTKExamples/site/Cxx/Points/ExtractSurface/)

[https://lorensen.github.io/VTKExamples/site/Cxx/Points/PoissonExtractSurface/](https://lorensen.github.io/VTKExamples/site/Cxx/Points/PoissonExtractSurface/)

[https://lorensen.github.io/VTKExamples/site/Cxx/Points/PowercrustExtractSurface/](https://lorensen.github.io/VTKExamples/site/Cxx/Points/PowercrustExtractSurface/)

and this one compares the three techniques:  
[https://lorensen.github.io/VTKExamples/site/Cxx/Points/CompareExtractSurface/](https://lorensen.github.io/VTKExamples/site/Cxx/Points/CompareExtractSurface/)

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 21, 2019, 5:10am UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/4 "2019-03-21T05:10:21Z")

</div>

Can you share the original point cloud?

---

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 21, 2019, 3:07pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/5 "2019-03-21T15:07:24Z")

</div>

I’m not using vtkplotter - I’m using the standard VTK python bindings. I’m not sure how vtkplotter works, but I need to embed this in an application so I’m not sure it’s suitable…

---

<div class="post-metadata">

### Author: ![thully](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@thully](https://discourse.vtk.org/u/thully)
#### Post date: [March 21, 2019, 4:16pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/6 "2019-03-21T16:16:57Z")

</div>

Those use VTK Remote Modules, and I’m using pip to install VTK for use with a Python project. Do I need to build VTK manually to make use of those modules? That wouldn’t be ideal, as this tool is intended to be used by other users.

---

<div class="post-metadata">

### Author: ![marcomusy](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marcomusy/32/95_2.png) [@marcomusy](https://discourse.vtk.org/u/marcomusy)
#### Post date: [March 21, 2019, 4:24pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/7 "2019-03-21T16:24:09Z")

</div>

if you want to avoid dependencies from `vtkplotter` in your application you can grab the python code from [here](https://github.com/marcomusy/vtkplotter/blob/85e2e2ba9a6e40d001ac4145c2787aab8b246fe1/vtkplotter/analysis.py#L1212).  
This is based on the vtkExtractSurface class mentioned in the VTKExamples Project.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 21, 2019, 4:41pm UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/8 "2019-03-21T16:41:21Z")

</div>

One of the generators is in vtk proper.

---

<div class="post-metadata">

### Author: ![michaelhogg](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michaelhogg/32/4613_2.png) [@michaelhogg](https://discourse.vtk.org/u/michaelhogg)
#### Post date: [June 28, 2019, 7:50am UTC](https://discourse.vtk.org/t/generating-3d-body-mesh-from-pointcloud/545/9 "2019-06-28T07:50:39Z")

</div>

Hi,  
Can you tell me if vtkPoissonReconstruction or vtkPowerCrustSurfaceReconstruction exist in the python 3 version of vtk? I get a message saying that they don’t exist in my vtk version (8.1.2 for Python 3.6 and Python 3.7). vtkSurfaceReconstructionFilter and vtkExtractSurface are there.  
Cheers,  
Michael
