0

I have a black and white image which was preprocessed using python library function skimage.morphology.skeletonize. But image which I am getting is not connected (means lines are broken in between).

Image to be processed. Image before skeletonize function Initial Image 1. Any suggestion on how I can connect them? Not the bigger lines but the small dots in respective lines. 2. I want to smooth these lines(one by one)for further processing. How can I perform both steps or some direct method to do later one without the first one?
3. My target is to get smooth lines from the initial image.

Thank you.

  • Hello, welcome to SO, would you please provide us the sample of the code you're running that is not working ? Please use [this](https://stackoverflow.com/help/minimal-reproducible-example) – Nqsir May 24 '19 at 10:05
  • Is it possible that the previous step in your processing which produced these images is at fault? Maybe you could provide the image you started the previous step with and also your code. – Mark Setchell May 24 '19 at 10:15
  • I don't know that library but skeleton of a continuous element should be continuous. That means if the skeletonize works correctly, some parameters of your original image are wrong. Make sure you supply a correct image to skeletonize - if it works on black&white (binary colours) and you supply a grayscale, it may result in such broken lines. And check thresholds - both if skeletonize gets grayscale and when you create your own black&white image before passing it. (If you make your own binary-coloured image, you can check it manually to see whether its still continuous.) – h4z3 May 24 '19 at 10:27
  • @h4z3 I provided images from previous steps. When you look into the library of this skeleton function they are also getting similar kind of image. If you can suggest me another way to skeletonize or directly getting smooth lines without skeleton that will work for me. I am open to switch to anything to get my work done. – Ashutosh Rana May 25 '19 at 09:33
  • 1
    Zoom in to the displayed image to make sure it is not subsampling in the display that causes this. If it’s not, find a better skeletonization algorithm. It is supposed to be continuous. Trying to fix it after the fact is very hard and would be a waste of time to try. – Cris Luengo May 25 '19 at 13:49
  • Yeah, looks like a bad algorithm. I don't know any libraries (I'm new to python and I'm not doing image processing) but KMM is easy to implement, K3M is harder but still pretty easy... Oh, KMM seems to be in Polish only. K3M and modified K3M are both searchable on Google Scholar - search for Saeed and thinning/skeletonization. – h4z3 May 27 '19 at 07:56
  • solved it! problem was due to the enlargement of the skeleton image. When I reduced the size by scaling, image became continuous. Although some points are still disconnected, that makes comparing with the original Image. Thank you for your comments. – Ashutosh Rana Jun 03 '19 at 07:59
  • To connect broken lines/edges based on contour extremities have a look at this https://stackoverflow.com/questions/71811385/connecting-disjointed-lines-or-edges-in-binary-images/71816288#71816288 – Jeru Luke Apr 23 '22 at 16:22

0 Answers0