I want to get the branching coordinates from a computer-generated image like this one:
After SkeletonTransform and Pruning, I get:
I would like to develop an algorithm that automatically detect and give coordinates of branching points (I could do it manually but really time consuming).
Thanks!
Edit: I already tried MorphologicalBranchPoints with poor results...
Answer
Use MorphologicalBranchPoints.
im = Binarize@Import["https://i.stack.imgur.com/O0AMj.png"]
skel = Pruning[Thinning[im], 20];
HighlightImage[skel, MorphologicalBranchPoints[skel]]
Another possibility is to use
skel1 = Pruning[Thinning[im, Method -> "MedialAxis"], 10];
as a start then smoothen the result using
skel2 = Thinning@Dilation[skel1, 5]
so that MorphologicalBranchPoints would not give false results.
HighlightImage[skel2, MorphologicalBranchPoints[skel2]]




Comments
Post a Comment