I would like to generate a skeleton out of an image. The resulting output of the skeleton image has disconnected edges. import skimage from skimage import data,io,filters import numpy as np import cv2 import matplotlib.pyplot as plt from skimage.filters import threshold_adaptive,threshold_mean from skimage.morphology import binary_dilation from skimage import feature from skimage.morphology import skeletonize_3d imgfile = "Bagah.jpeg" im = cv2.imread(imgfile) image = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) thresh = threshold_mean(image) thresh = threshold_mean(thresh) binary = image > thresh #dilate = skimage.morphology.binary_dilation(binary) gaussian = skimage.filters.gaussian(binary) edges = filters.sobel(gaussian) #dilate = feature.canny(edges)#binary,sigma=0) skeleton = skeletonize_3d(gaussian)#binary) fig, axes = plt.subplots(nrows=2,ncols=2, figsize=(8, 2)) ax = axes.ravel() ax[0].imshow(gaussian, cmap=plt.cm.gray) ax[0].set_title('gaussian') ax[1].imshow(skeleton, cmap=plt.cm.gray) ax[1].set_title('skeleton') for a in ax: a.axis('off') plt.show() Please find the attachments of my input and output files. I would like to translate this skeleton into a graph with nodes and edges. Could someone suggest how to obtain a skeleton with connected edges? <https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=4a1c8db3-b2fd-4efa-85ef-887e08f50a6b> I’m protected online with Avast Free Antivirus. Get it here — it’s free forever. <https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=4a1c8db3-b2fd-4efa-85ef-887e08f50a6b> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>