I have pictures of networks, like the one below, and my goal is to obtain the network's skeleton from processing those images.

original image

My approach lies in two steps, first I convert grayscale image to binary image using local thresholding or Otsu method, and then a medianfilter (python function medfilt). Result is shown below.

Binary image

Then, I use a thinning algorithm to extract the network's skeleton. Here is the result of my implementation of the Zhang-Suen thinning algorithm.


Considering the quality of the first image, I'm pretty sure it's possible to do a lot better than that. I thus have two questions :

1) Taking the last image, how would you remove all the small lines perpendendicular to the ridges, and the small gaps, that are artefacts ?

2) What algorithm would you actually advise me to use for the above mentionned steps (conversion to binary image and thinning) ?

I'm mainly working in python.

  • $\begingroup$ Is the "network" delineated by the ridges? Is it a line following the top of the ridge that you are trying to extract through skeletonisation? $\endgroup$ – A_A Jul 10 '18 at 8:31
  • $\begingroup$ Yes ! My goal is to extract properly the top of the ridges that you can see in dark in the first image. $\endgroup$ – Liris Jul 10 '18 at 9:04

Your implementation of the ZS algorithm is wrong. The correct output should be: Zhang Suen output

Here you can see the output superimposed on the original binary image: Zhang Suen output with original shadowed

Removing the small branches would require a little more effort and is not exactly off the shelf, but basically you could tag every segment between junction points and end points with its length and prune the ones which are too short. Then you can also take into account the "main" direction and not prune in that direction.

| improve this answer | |

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.