## Polyline Averaging

### Remember to vote up questions/answers you find interesting or helpful (requires 15 reputation points)

I'm trying to find a method that can take a collection of polylines, each described by a list of connected points on a plane, and find an "average" path through them. The input lines do not loop.

Essentially, I want to do something similar to that of taking multiple GPS routes which are individually subject to noise and producing a single smoothed average of them.

Are there any existing algorithms which can do this?

-

By polyline I presume you mean a piecewise linear  curve? Or a more general marked curve? And you want a path through what, precisely? – David Roberts May 9 2012 at 8:46
Yes, a piecewise linear curve although not monotonically increasing on either axis.   I'm aware that an "average" line is not well defined but I'm looking for a single path which is representative of the input lines.     At present I have a scheme in place which finds the start and end points for the "average" line and then iteratively bisects the line and fits the mid point to the input lines.  This works well for situations when the lines are straight or 'L' shaped but doesnt work for 'S' type shapes or nything more complex. – Chris May 9 2012 at 9:10

## 1 Answer

One of the most attractive distance measures between two curves is the Fréchet distance, which is the smallest leash length between a dog on one curve and its owner on the other. Algorithms for computing it have been studied since the mid-90's, perhaps starting with this paper:

H. Alt and M. Godau. Computing the Fréchet distance between two polygonal curves. Intl. J. Computational Geometry and Applications, 5:75-91, 1995.

[Image from Wouter Meulemans' web page.]

Once you have committed to this distance measure, it is natural to define a median curve as that which minimizes the maximum Fréchet distance between it and the curves in your collection. And indeed this has just been explored in a recent Ms. thesis:

Benjamin Raichel and Sariel Har-Peled. "The Frechet Distance Revisited and Extended." 2012. (conference paper link).

The exact median curve of $k$ $n$-vertex polygonal chains can be computed in $O(n^k)$ time. But under a natural restriction that the curves are $c$-packed," the exponential time complexity is reduced to $O(n \log n)$ for a $(1+\epsilon)$-approximation. All of this is detailed in Raichel's thesis. I doubt there are existing implementations (because this is so new), but examining this literature should at the least provide you with one natural model of an "average" curve.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 6, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9465939998626709, "perplexity_flag": "middle"}