简体   繁体   中英

geodesic distance on 3d triangular mesh using scikit-fmm or gdist

I'm trying to evaluate a geodesic distance matrix on the TOSCA dataset. eg the following 3d mesh-
在此处输入图像描述

I've tried using two python implementations.

  1. The first one is the scikit-fmm , which does not seems to work on 3d structures at all (am I right?) hence not suitable to the task.
  2. 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").value()

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.

  1. 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:

在 MeshLib 中计算的距离等值线

  1. 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:

MeshLib 中的测地线路径

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM