1
$\begingroup$

enter image description here

I have several lines that are shown in different colours, do not know which are connected to each other in advance. I want to do path planning only using these lines, i.e., route planning. If I am able to construct a graph using these line segments, I can use graph search techniques, e.g., A*, to find the path between provided two start and target points.

Quation: What could be the optimal way to construct a graph using these line segments? Each such line segment consists of a set of points along the line.

After @Yves Daoust suggestion I got want I want, many tanks

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Optimal in what sense ? $\endgroup$
    – user16034
    Mar 14, 2023 at 12:57

1 Answer 1

3
$\begingroup$

Hint:

Possible first steps are binarization, then thinning.

enter image description here

After that, it is no big deal to find the junctions and to follow the edges between them.


A piece of caution: thinning tends to turn the lane crossings to double junction points instead of a single. These configurations can be a little tricky to handle.

$\endgroup$
1
  • $\begingroup$ Thank youu, I will consider this way :) $\endgroup$
    – GPrathap
    Mar 14, 2023 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.