How to connect lines in a skeletonized image with arcs

Hi,
I'm trying to find a way to have MATLAB connect the lines of the tripods in the first image (i.e., vertex_tripods.bmp) with arcs so that it looks something like the second image (i.e., vertex_tripods_connected.bmp). I would also like to have MATLAB calculate the angles of the tripods in the first image (with respect to the vertical axis). Thanks in advance for your help!

Antworten (2)

darova
darova am 12 Jun. 2019

0 Stimmen

Use bwmorph() to find branch points. I sorted them in counter clock-wise order:
img.png
Find distance and center between neighbor points:
img1.png
Assume arc radius is 1000 pixels. Draw perpendicular vector (length L) from center of a segment - get arc center p0
img2.pngimg3.png
Rotate radius vector using angle and rotation matrix to get points on arc
img4.png

4 Kommentare

Thanks for your input--looks great. It's just that the arcs need to be fit to the legs of the tripods. Think of the legs of the tripods as direction vectors or 'directors' for the arcs, which give the slopes of the arcs at or near the endpoints of the tripod legs. With this, each arc will have its own unique radius depending on the tripod directors and the distance between branchoints.
Steve
Steve am 12 Jun. 2019
Bearbeitet: Steve am 12 Jun. 2019
The code also needs to work for larger numbers of tripods (see attached image: vertex_tripods2).
can you show how this should looks like?
are those connections can be just straight lines?

Melden Sie sich an, um zu kommentieren.

Steve
Steve am 12 Jun. 2019

0 Stimmen

It should look like the second attached image (vertex_tripods_connected.bmp). In theory, the connections cannot be straight lines, but they can be arcs with very large radii.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018b

Gefragt:

am 11 Jun. 2019

Beantwortet:

am 12 Jun. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by