I'm trying to evaluate a geodesic distance matrix on the TOSCA dataset.
e.g. the following 3d mesh-
I've tried using two python implementations.
The other one is the gdist package, which Unfortunatlly works on the toy example they provide, but does not work on my mesh, which is only 10,000 faces and 5000 vertices.
When using the gdist library I have the following error:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
--------CODE SNIPPET----------
c = sio.loadmat('raw_data/TOSCA/cat0.mat')
c = c['surface'][0][0]
X = c[0]
Y = c[1]
Z = c[2]
TRIV = c[3].astype(np.int32)
vertices = np.array(zip(X, Y, Z)).astype(np.float64)
vertices = np.reshape(vertices, (vertices.shape[0], 3))
src = np.array([1], dtype=np.int32)
trg = np.array([2], dtype=np.int32)
np.random.shuffle(TRIV)
a = gdist.compute_gdist(vertices,TRIV[:5000], source_indices = src, target_indices = trg)
Is there another solution? Am I using gdist or scikit-fmm the wrong way?
Another solution would be to use MeshLib library with python interface. After installation via pip
:
import meshlib.mrmeshpy as mr
Load a mesh from TOSCA dataset in OFF format:
mesh = mr.loadMesh("centaur1.off")
I found the meshes from this dataset here: https://vision.in.tum.de/data/datasets/partial
Then you will be interested in two function as follows.
mr.computeSurfaceDistances(mesh, surfacePoint)
, which returns the distance from given surface point to every vertex in the mesh computed by Fast Marching method. For example, here are computed distances are visualized by color and isolines:mr.computeGeodesicPath(mesh, surfacePoint1, surfacePoint2)
, which computes exact geodesic path between two surface points. The computation starts from a path approximation given by Dijkstra or Fast Marching method and then it is iteratively reduced in length until convergence. Geodesic path example between two points: