skeletor icon indicating copy to clipboard operation
skeletor copied to clipboard

Thinning-based skeletonization

Open schlegelp opened this issue 2 years ago • 2 comments

Look into implementing a thinning-based skeletonization. See e.g. this one based on skimage.

For this, we would need to first voxelize the mesh which is straight forward with Trimesh.

See also this function to extract a graph from pixel neighbourhood.

schlegelp avatar Aug 02 '21 08:08 schlegelp

Hi @schlegelp! I am trying to implement the skimage based thinning algorithm for my research work. However, I am confused as to how to generate the mesh_map data that is available in skeletor. Since we generate the skeleton on the voxelized mesh of the input trimesh object, I was wondering how mesh_map would work in this case.

Any input would be very helpful.

Thanks!

venugovh avatar Dec 28 '21 22:12 venugovh

I guess it depends on your implementation but in general you would need to combine two maps:

  1. Vertex to voxel
  2. Voxel to pixel in the thinned image

The first one is straight forward, the second one is more tricky. AFAIK skimage's thinning won't give you a voxel -> pixel correspondence, so that would need to be calculated afterwards. You could just snap the vertices to the closest pixel using the Euclidean distance but that will give you wrong mappings in some cases. The correct approach would be to find the closest pixel using geodesic distance through the voxels graph but I have a feeling that this will be very expensive for larger meshes.

schlegelp avatar Dec 29 '21 10:12 schlegelp