Reputation: 2741
I would like to find the joints and the segments from a image that looks like a graph after skeletonize it. I need the number of both joint and the length of the segments.
Do you know what are the best approach for it?
Thanks
Here is the image explanation:
Original image:
Upvotes: 5
Views: 1487
Reputation:
If your skeletonization algorithm works well, the joints are pixels surrounded by three or four neighbors, while the edges pixels have only two. Free endpoints have only one.
A possible approach is to scan the image in search of all junctions and endpoints and create graph vertices for each. Label these pixels with the vertex indexes.
Then for every joint/endpoint, follow all the incident edges until you reach another joint/endpoint. Add the corresponding graph edge.
Upvotes: 3