How to transform a broken line into a simple line with the same length?

Just as the question title shows, I want to convert a broken line into a line with same length.The example image is here.
The image is skel of a object and is obtained by using the function bwmorph(, 'skel', Inf).The red star points in the image are the branch points. The yellow points denote the endpoints of the branches.
What should I do to turn the spine which has the red star points into line with same length and keep the relative position of the yellow points?
Any suggestion or clue?

Answers (1)

Have you tried the "spur" option in bwmorph()?

5 Comments

Yes, I have . But it does not work.After all, the spur is not branch.
How are you defining spur and branch?
Alternate method is to look for crossing points and endpoints and keep line segments with two end points.
Yes, I have find the branch points and end points.And it is not hard to line the segments with two points.
In fact, my question is how to transform the broken line in to line. As the example shows, all the branch points are in the main spine of the object and the spine is a broken line. I indeed need this transformation.
Upload a photo without annotation if you need me to show you.
A big thanks in advance. As the original image are fits format which is only used widely in the solar image processing, I upload the .mat file rather than the original image at http://pan.baidu.com/share/link?shareid=1990596554&uk=2854878658. The password of extracting this .mat file is wb0h.
Look forward to your suggestion.

Sign in to comment.

Asked:

on 14 Sep 2013

Community Treasure Hunt

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

Start Hunting!