daavoo / daavoo/pyntcloud

Convex hull not fitting well to my data

Open
#290 2 comments 0 reactions 0 assignees View on GitHub
Question
Dominant language
Python
Stars
1.5k
Forks
229
PR merge metrics
No merged PRs in 30d

Description

Greetings!

I think my issue is not a bug or a feature request; I am looking for help with a problem for my specific data set and how I am setting up the problem.

I have a point cloud in CSV format (I uploaded it as .xlsx because Github wouldn't let me upload a .csv):

[deposit.xlsx](https://github.com/daavoo/pyntcloud/files/5324170/deposit.xlsx)

This is (X,Y,Z) data from a scanner that describes a surface of an object.

I can plot it with this code:

```python
import matplotlib.pyplot as plt
import pandas as pd
df=data
df.columns=["X","Y","Z"]
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_trisurf(df['Y'], df['X'], df['Z'], cmap=plt.cm.viridis, linewidth=0.01)
plt.show()
```

The plot looks like this:
![image](https://user-images.githubusercontent.com/37059819/95025334-ed1d3300-0656-11eb-8fab-2b191a0a0b44.png)

As you can see, it is mostly a cone, but there is some rough area near the base. Also, there are small features away from the cone. What I want is the volume of everything that is above the z=0 plane.

I downloaded Pyntcloud after I saw this stack overflow post: https://stackoverflow.com/questions/44997054/point-cloud-to-volume I am following the same procedure.

I use the following code:

```python
from pyntcloud import PyntCloud

deposit = PyntCloud.from_file("deposit.csv")
convex_hull_id = deposit.add_structure("convex_hull")
convex_hull = deposit.structures[convex_hull_id]
deposit.mesh = convex_hull.get_mesh()
deposit.to_file("deposit.ply", also_save=["mesh"])
volume = convex_hull.volume
```

However, when I do this, I am not getting a mesh of my object. Instead, the system creates a pyramid, with the max height of my object as the vertex. The mesh looks like this:
![image](https://user-images.githubusercontent.com/37059819/95025445-d1665c80-0657-11eb-8660-7f3f611ec11b.png)

By the way, I know the answer to what the volume should be. It should be about 22. Does anyone see what I've overlooked? Do I need a finer mesh to capture the features of my surface?

Thanks,

Eric

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.