I'm looking for a feature/function in either python opencv/ndimage/gdal/etc. or qgis/saga/grass that will help clean up a skeletonized image that I'd like to vectorize into a shapefile of lines/polylines.

my messy skeleton

I spent considerable effort producing this network and I'd like to vectorize it and remove 'jaggies' (short lines to go nowhere) and also take the shortest path through the clumps of webby areas to produce as straight lines as possible.

I realize this is a multi-step process and there may be possibilities in the python space or in gis. I know the steps I would do if I did it from scratch but it would take a while!


The GRASS module v.clean has a tool "rmdangle" to remove short lines that go nowhere. Might help in the first part of your question.

This module works on the vectorized layer; you pass it a threshold value to set what the maximum size of a dangle should be.

  • I realize my question was broader than the title. I'll accept this as the answer to the danglies problem. – user1269942 Sep 5 '14 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.