How to remove small spurs (branches) from a 'thinned' image?

I've binarized and thinned an image using
bwmorph(image, 'thin', Inf)
However, I'm left with a small spur at the end. The spur forms an intersection (of three branches) which has to be avoided in my case. How to remove it?
Below is the binarized image.
And this is the thinned image. The spur to be removed is mentioned with red mark.

Answers (1)

Tarun Mudgal
Tarun Mudgal on 13 May 2017
Edited: Tarun Mudgal on 13 May 2017
I just added a condition that the distance of the endpoint with the branch should be less than (say) x pixels, then remove it.

Categories

Products

Asked:

on 12 May 2017

Edited:

on 13 May 2017

Community Treasure Hunt

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

Start Hunting!