Branching points detection in processed image

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...

• "I already tried MorphologicalBranchPoints with poor results..." Can you be specific about what you got and what you want instead? – Szabolcs Feb 18 at 14:48
• @ Szabolcs It was more about a careful selection of thinning and skeletonize options. The result with MorphologicalBranchPoints wasn't good then. – Valacar Feb 18 at 15:08
• Added another update. – Szabolcs Feb 18 at 15:09

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]]


• Great ! Thanks a lot. – Valacar Feb 18 at 15:09

I notice there's a faint pink background that seems like a natural boundary. I've highlighted it to showcase this:

We can extract this curve and use it as the original boundary:

im = Import["https://i.stack.imgur.com/7Ck2S.png"];
mask = FillingTransform[Thinning[Binarize[ColorReplace[im, White -> Black, .055], 0]], CornerNeighbors -> True]


And the simply call MorphologicalBranchPoints:

skel = Thinning[mask];
HighlightImage[skel, MorphologicalBranchPoints[skel], 1]


• This is really clean! – Valacar Feb 19 at 9:24
• by the way I think it's Thinning[mask] in this case, isn't it? – Valacar Feb 19 at 12:26
• @Valacar Yes. I made the correction, thank you. – Chip Hurst Feb 19 at 12:36