jni / skan

Python module to analyse skeleton (thin object) images
https://skeleton-analysis.org
BSD 3-Clause "New" or "Revised" License
118 stars 40 forks source link

How to make the path smooth? #77

Open qiang-zhang-neu opened 4 years ago

qiang-zhang-neu commented 4 years ago

skan is a very good project. However, I wonder whether there is a method to make the path smooth? I need to calculate the resliced image along the skeleton, and the path (skel.path_coordinates) is not smooth. How can I make the path more smooth? Thank you very much!

jni commented 4 years ago

@qiang-zhang-neu right now, we don't have any tools for that in skan. I suspect that adding them would require something like object.simplify from Shapely. You can find the docs here:

https://shapely.readthedocs.io/en/stable/manual.html#object.simplify

Including the reference for the algorithm, reproduced below for convenience. Shapely is 2D-only, though. I would definitely welcome a contribution to skan implementing this algorithm in nD, but I myself don't have time to work on this at the moment...

David H. Douglas and Thomas K. Peucker, “Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or its Caricature,” Cartographica: The International Journal for Geographic Information and Geovisualization, vol. 10, Dec. 1973, pp. 112-122.