Contour division and simplification using graph.shortest_path?
I have extracted edges/contours in my image, the problem is that the contours either have too many points (think a straight line that has 8 points in the contour when we only need 2 points to accurately describe this contour) or my lines are merged into one big contour when they should be N individual contours (see image to understand this problem better). In the below image gallery link you will see the image I am working with and another image showing my desired objective; each coloured line represents a different contour. Notice the lines are 'intuitively' divided even though they touch. `measure.find_contours()` sees all these contours as one big joined contour and I want to split this big contour into the result above. So I want to know if `graph.shortest_path` or `graph.route_through_array` can be used to achieve something like this? https://imgur.com/a/RVT4QOg So I was thinking; can I use `graph.shortest_path()` or `graph.route_through_array()` to simplify contours (remove redundant points) and/or divide contours into their intuitive line segments? I have consulted the Scikit Image documentation for these functions and created test code that uses these functions but still don't understand if these algorithms could achieve my objectives described above, so having someone more experienced provide advice would be very helpful. *Note: For contour simplification I know I could use `measure.approximate_polygon()` (DouglasPeucker algorithm) however for my usecase this algorithm can simplify the contour too much that it deviates too much from the original contour. I know I can play with the parameters to tweak this but its not viable because for certain contours my chosen parameter works, for others it does not. So I am exploring other contour simplification methods.
participants (1)

samzielkeryner＠gmail.com