How to determine path from noisy X, Y data

后端 未结 10 1990
星月不相逢
星月不相逢 2021-02-08 21:54

I have an unsorted list of noisy X, Y points. They do, however, form a path through the world. I would like an algorithm to draw an approximation of this data using line segment

10条回答
  •  一个人的身影
    2021-02-08 22:22

    A completely different approach, that does not require another constraint, but details may depend on your application. It sghould work best if you have a "dense cloud of points" around the path.

    Use a "cost" function that defines the difference between the curve and the cloud of points. Use a parametrized curve, and a standard optimization algorithm. - OR - Start with a straight curve from start to end, then use a genetic algorithm to modify it.

    The typical cost function would be to take the smallest distance between each point and the curve, and sum the squares.

    I have not enough experience to suggest an optimization or genetic algorithm but I am sure it can be done :)

    I could imagine a genetic algorithm as follows: The path will be built from Waypoints. Start with putting N waypoints in a straigt line from start to end. (N can be chosen depending on the problem). Mutations could be:

    1. For each segment, if rnd() < x, a new waypoint is introduced in the middle.
    2. For each waypoint, the X and Y coordinate are varied slightly.

    You will need to include the total length in the cost function. Splitting might not be needed, or maybe x (the "split chance") might need to decrease as more waypoints are introduced. You may or may not want to apply (2) to the start- and endpoint.

    Would be fun to try that...

提交回复
热议问题