MATLAB Answers

Number of branches per branch point

2 views (last 30 days)
Hi! I have a skeleton image (the attached one) and i want to compute how many branches there are for each branch point. Eg: there are two branchpoints with four branches, three branchpoints with three branches, etc. Anyone knows how to do this?

Accepted Answer

Matt J
Matt J on 21 Jul 2021
Edited: Matt J on 21 Jul 2021
Perhaps as follows:
k=ones(3); k(5)=0;
neighborCount=conv2(double(BW),k,'same');
neighborCount=neighborCount.*(neighborCount>2);
[row, col, numBranches]=find(neighborCount); %branch point (row,col) coordinates and number of branches.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by