sir,what can i do for remove the small branches from the following image and display number of branch point after removing the small branches?

1 view (last 30 days)
</matlabcentral/answers/uploaded_files/10209/skel.jpg> this is my code to plot the branch points :
%W2=is skeleton image using bwmorph
L = bwmorph(W2,'branchpoints'); [row column] = find(L); branchPts = [row column]; endImg=bwmorph(W2,'endpoints'); [row column]=find(endImg); endPts = [row column]; figure, imshow(W2); title('branching points'); hold on; plot(branchPts(:,2),branchPts(:,1),'r.'); %plot(endPts(:,2),endPts(:,1),'go');
se=strel('disk',5,8); dl=imdilate(L,se); %figure; %imshow(dl); %dilation of branches ccbranches=bwconncomp(L,8); nob=ccbranches.NumObjects; vwb=f1; %vessel without branch points vwb(dl)=0; cc=bwconncomp(vwb); Noriginal=ccbranches.NumObjects; disp('Number of branch points:'); disp(Noriginal);
this is the output of above code
I want to remove the smaller branches from this image and branchpoints only diplayed for larger vessel(branch)
I have to use the spur operation in bwmorph.this is not worked.

Answers (1)

zoey yang
zoey yang on 22 Apr 2019
Actually, you can scan your points in your image by looking at their neighbors. If a point has three neighbors that equal to one, this point is the one that you are looking for. Start from this point, find its branches. Let set the threshold as, like 10. That means if the branch length is shorter than 10 nodes, we will remove it.

Tags

Community Treasure Hunt

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

Start Hunting!