Currently, I use skimage in python to extract the skeleton of open space from some a binarized map as following pictures,
With following python codes:
from skimage.morphology import skeletonize
from skimage import draw
from skimage.io import imread, imshow
from skimage.color import rgb2gray
# load image from file
img_fname=os.path.join('images','mall1_2F_schema.png')
image=imread(img_fname)
# Change RGB color to gray
image=rgb2gray(image)
# Change gray image to binary
image=np.where(image>np.mean(image),1.0,0.0)
# perform skeletonization
skeleton = skeletonize(image)
Now I would like to extract the end points and cross points from the skeleton as nodes for Networkx graph object while calculating the distance between the neighboring nodes as edges for Networkx Graph object. Currently, I have to manually get the point coordinates and input to NetworkX object initialization process, do we have any smarter way to do everything automatically?
By the way, I found yaron kahanovitch's answer to the question on stackoverflow proposes similar approaches. However, no more realization suggestions was given, and I think NetworkX could be one approach.
Any suggestions from you are greatly appreciated.