For a project I am working on, I have successfully performed the SFM procedure on road image data, and have been able to generate a .ply file containing point cloud coordinates (X, Y, Z), RGB values, and normals (nx, ny, nz).
Now, I am interested in calculating curvature values for each point from the data I have. I have come across Surface Curvature MATLAB Equivalent in Python, but the implementation is said to work only when X, Y, and Z are 2D arrays.
Is Gaussian and Mean curvatures applicable if the road surface is very rough? Given, the (X,Y,Z) coordinate data of size NX3 and given the (nx,ny,nz) normal data of size NX3, how should I find the curvature? Is there a current implementation in Python?
I'm actually writing a Python library for working with point clouds.
Using the raw point cloud, the only "curvature" concept I'm aware of is the one computed using the eigenvalues obtained from the neighbourhood of each point.
If that is what you mean, here is an example code:
This is the example point cloud inside
Box.ply
:The steps to compute the curvature are:
Get k-neighbors of each point:
Compute the eigenvalues for each point using it's
k
(10 in this case) neighbours:Compute the curvature from those eigenvalues:
Saving the cloud with the new scalar fields:
Here is the point cloud inside
out.ply
colored according to the curvature value assigned to each point (White are higher curvature values):Here is an example on how to filter the point cloud to only keep the points that have a curvature value above the mean:
And the new content of
out.ply
: