I'm currently trying to represent an image like the one below as a point defined path. Every "trace" should be a separate path. See picture below
The thing I'm trying to do right now is using scikit-image and scipy in python to fill up and skeletonize the image. See picture below
import os
from skimage import io, img_as_bool
from scipy import ndimage
from skimage.morphology import skeletonize
from skimage.util import invert
from matplotlib import pyplot as plt
filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'traces.png')
traces = io.imread(filename, True)
inverted = invert(traces)
boolimage = img_as_bool(inverted)
image = ndimage.binary_fill_holes(boolimage)
skeleton = skeletonize(image, method='lee')
plt.imshow(skeleton, cmap=plt.cm.gray)
plt.axis('off')
plt.show()
The skeleton however has many curving lines and I currently do not know how to proceed into cleaning it up into straight lines and angles so the lines endpoint can be used to record the paths. I have tried probabilistic Hough transform from scikit to obtain lines but these struggles with the bending nature of the lee skeleton and complete leaves out geometry.
Any help would greatly be appreciated, if you have any completely different ideas or some algorithm names those are also very much welcome!