Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Movement Analysis Lecture 3: Curve simplification Joachim Gudmundsson.

Similar presentations


Presentation on theme: "Computational Movement Analysis Lecture 3: Curve simplification Joachim Gudmundsson."— Presentation transcript:

1 Computational Movement Analysis Lecture 3: Curve simplification Joachim Gudmundsson

2 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information.

3 Problem Many algorithms handling movement data are slow, e.g. - - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

4 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

5 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

6 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

7 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

8 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

9 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

10 Problem Many algorithms handling movement data are slow, e.g. - similarity O(nm log nm) - approximate clustering O(n 2 +nml) - … Observation: Many trajectories can be simplified without losing much information. Example:

11 Example Generated trajectory: Universe: 400x400 Number of points: 10K Error: 5 units  278 points 10 units  174 points Time: ~15ms Car trajectory: Universe: ~20km  20km Number of points: 85K Error: 5 meter  2601 points 10 meter  1728 points Time: ~200ms

12 Outline Simplifying polygonal curves Ramer–Douglas–Peucker 1973 Driemel, Har-Peled and Wenk, 2010 Imai-Iri 1988 Agarwal, Har-Peled, Mustafa and Wang, 2005 Take time into consideration

13 Ramer-Douglas-Peucker 1972 by Urs Ramer and 1973 by David Douglas and Thomas Peucker The most successful simplification algorithm. Used in GIS, geography, computer vision, pattern recognition… Very easy to implement and works well in practice. p

14 pjpj pipi Ramer-Douglas-Peucker Input polygonal path P =  p 1,…,p n  and threshold  Initially i=1 and j=n Algorithm DP(P,i,j) Find the vertex v f between p i and p j farthest from p i p j. dist := the distance between v f and p i p j. if dist >  then DP(P, v i, v f ) DP(P, v f, v j ) else Output(v i v j )

15 pjpj pipi Ramer-Douglas-Peucker Input polygonal path P =  p 1,…,p n  and threshold  Initially i=1 and j=n Algorithm DP(P,i,j) Find the vertex v f between p i and p j farthest from p i p j. dist := the distance between v f and p i p j. if dist >  then DP(P, v i, v f ) DP(P, v f, v j ) else Output(v i v j ) dist

16       Ramer-Douglas-Peucker             p q

17 p q

18 Time complexity? Testing a shortcut between p i and p j takes O(j-i) time. Worst-case recursion? Algorithm DP(P,i,j) Find the vertex v f farthest from p i p j. dist := the distance between v f and p i p j. if dist >  then DP(P, v i, v f ) DP(P, v f, v j ) else Output(v i v j ) DP(P, v i, v i+1 ) DP(P, v i+1, v j ) Time complexity T(n) = O(n) + T(n-1) = O(n 2 )

19 Summary: Ramer-Douglas-Peucker Worst-case time complexity: O(n 2 ) In most realistic cases: T(n) = T(n 1 ) + T(n 2 ) + O(n) = O(n log n), where n 1 and n 2 are smaller than n/c for some constant c. If the curve is in 2D and it does not self-intersect then the algorithm can be implemented in O(n log* n) time. [Hershberger & Snoeiynk’98] Does not give any bound on the complexity of the simplification!

20 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

21 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

22 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

23 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

24 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

25 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

26 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

27 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’ 

28 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) P’:=  p 1  i:=1 while i  if no such vertex then set i:=n add p i to P’ end return P’

29 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) Property 1: All edges (except the last one) have length at least . Property 2:  F (P,P’)  

30 Driemel et al. Simple simplification(P =  p 1,…,p n ,  ) Property 1: All edges (except the last one) have length at least . Property 2:  F (P,P’)   Definition: A curve P is c-packed, if has finite length, and for any ball b(p,r) it holds |P  b(p,r)| < cr. Property 3: If P is c-packed then P’ is 6c-packed.

31 Driemel et al. Aim: Prove Property 3 If P is c-packed then P’ is 6c-packed. We need the following observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r)

32 PuPu Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u

33 Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  P u must lie inside H u

34 Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  v lvlv rvrv P u must intersect l v and r v  |P u  H v |  |v| |B(p,r)  u| = |v|

35 Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )| v |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  v lvlv rvrv v  B(p,r) |B(p,r)  u| = |v|

36 HvHv Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  v lvlv rvrv v  B(p,r) B(p,r+  ) |B(p,r)  u| = |v|

37 HvHv Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  v lvlv rvrv B(p,r+  ) v  B(p,r)  H v  B(p,r+  ) |B(p,r)  u| = |v|

38 HvHv Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  v lvlv rvrv B(p,r+  ) v  B(p,r)  H v  B(p,r+  )  P u  H v  B(p,r+  ) |B(p,r)  u| = |v|

39 HvHv Driemel et al. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r) Proof: B(p,r) u PuPu HuHu  v lvlv rvrv B(p,r+  ) v  B(p,r)  H v  B(p,r+  )  P u  H v  B(p,r+  )  |P u  B(p,r+  )|  |v| |B(p,r)  u| = |v|

40 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Observation: Let P be a curve and let P’ be an  -simplification of P |P  B(p,r+  )|  |P’  B(p,r)| for any ball B(p,r)

41 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Proof: Proof by contradiction. Assume |P’  B(p,r)|>6cr for some B(p,r) Two cases: r   or r<  Case r   : |P  B(p,2r)|

42 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Proof: Proof by contradiction. Assume |P’  B(p,r)|>6cr for some B(p,r) Two cases: r   or r<  Case r   : |P  B(p,2r)|  |P  B(p,r+  )|

43 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Proof: Proof by contradiction. Assume |P’  B(p,r)|>6cr for some B(p,r) Two cases: r   or r<  Case r   : |P  B(p,2r)|  |P  B(p,r+  )|  |P’  B(p,r)| According to observation

44 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Proof: Proof by contradiction. Assume |P’  B(p,r)|>6cr for some B(p,r) Two cases: r   or r<  Case r   : |P  B(p,2r)|  |P  B(p,r+  )|  |P’  B(p,r)| > 6cr According to observation

45 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Proof: Proof by contradiction. Assume |P’  B(p,r)|>6cr for some B(p,r) Two cases: r   or r<  Case r   : |P  B(p,2r)|  |P  B(p,r+  )|  |P’  B(p,r)| > 6cr |P  B(p,2r)| > 6cr  |P  B(p,r’)| > 3cr’ which contradicts that P is c-packed According to observation

46 Driemel et al. Theorem: If P is c-packed then P’ is 6c-packed. Proof: Proof by contradiction. Assume |P’  B(p,r)|>6cr for some B(p,r) Two cases: r   or r<  Case r   : |P  B(p,2r)|  |P  B(p,r+  )|  |P’  B(p,r)| > 6cr |P  B(p,2r)| > 6cr  |P  B(p,r’)| > 3cr’ which contradicts that P is c-packed Case r <  : Proof is similar. According to observation

47 Summary: Driemel et al. Simple simplification: can be computed in O(n) time Property 1: All edges (except the last one) have length at least . Property 2:  F (P,P’)   Definition: A curve P is c-packed, if has finite length, and for any ball b(p,r) it holds |P  b(p,r)| < cr. Property 3: If P is c-packed then P’ is 6c-packed.

48 Imai-Iri Both previous algorithms are simple and fast but do not give a bound on the complexity of the simplification! Imai-Iri 1988 gave an algorithm that produces a  -simplification with the minimum number of links.

49 Imai-Iri Input polygonal path P =  p 1,…,p n  and threshold  1.Build a graph G containing all valid shortcuts. 2.Find a minimum link path from p 1 to p n in G

50 Imai-Iri Input polygonal path P =  p 1,…,p n  and threshold  1.Build a graph G containing all valid shortcuts. 2.Find a minimum link path from p 1 to p n in G

51 Imai-Iri Find all possible valid shortcuts

52 Imai-Iri Find all possible valid shortcuts   

53 Imai-Iri Find all possible valid shortcuts 

54 Imai-Iri Find all possible valid shortcuts 

55 Imai-Iri Find all possible valid shortcuts 

56 Imai-Iri Find all possible valid shortcuts 

57 Imai-Iri Find all possible valid shortcuts 

58 Imai-Iri Find all possible valid shortcuts 

59 Imai-Iri Find all possible valid shortcuts 

60 Imai-Iri Find all possible valid shortcuts

61 Imai-Iri Find all possible valid shortcuts

62 Imai-Iri Find all possible valid shortcuts

63 Imai-Iri Find all possible valid shortcuts

64 Imai-Iri Find all possible valid shortcuts

65 Imai-Iri Find all possible valid shortcuts

66 Imai-Iri All possible shortcuts!

67 Imai-Iri 1. Build a directed graph of valid shortcuts. 2. Compute a shortest path from p 1 to p n using breadth-first search.

68 Imai-Iri 1. Build a directed graph of valid shortcuts. 2. Compute a shortest path from p 1 to p n using breadth-first search.

69 Imai-Iri Brute force running time: ? #possible shortcuts ?

70 Summary: Imai-Iri Running time: O(n 3 ) O(n 2 ) possible shortcuts O(n) per shortcut  O(n 3 ) to build graph O(n 2 ) BFS in the graph Output: A path with minimum number of edges Improvements: Chan and Chin’92: O(n 2 )

71 Results so far RDP: O(n 2 ) time (simple and fast in practice) Output: A path with no bound on the size of the path SS: O(n) time (simple and fast in practice) Output: A path with no bound on the size of the path Imai-Iri: O(n 2 ) time by Chan and Chin (complicated) Output: A path with minimum number of edges RDP and II use the Hausdorff error measure, SS use Fréchet Can we get something that is simple, fast and has a worst- case bound using the Fréchet error measure?

72 Agarwal et al. Agarwal, Har-Peled, Mustafa and Wang, 2002 Time: Running time O(n log n) Measure: Fréchet distance Output: Path has at most the same complexity as a minimum link (  /2)-simplification

73 Analysis - Agarwal et al. Notation: Let  (p i p j ) denote the Fréchet distance between (p i,p j ) and the subpath  (p i,p j ) of P between p i and p j. Let P =  p 1, p 2,..., p n  be a polygonal curve pipi pmpm pjpj plpl

74 Algorithm - Agarwal et al. Algorithm(P =  p 1,…,p n ,  ) i := 1 P’=  p 1  while i < n do find any j>i such that (  (p i,p j )   and (  (p i,p j+1 ) >  ) or (  (p i,p j )   and j=n) P’= concat(P,  p j  ) i := j end return P’

75 Algorithm - Agarwal et al. p1p1 pjpj P j+1 Algorithm(P =  p 1,…,p n ,  ) i := 1 P’=  p 1  while i < n do find any j>i such that (  (p i,p j )   and (  (p i,p j+1 ) >  ) or (  (p i,p j )   and j=n) P’= concat(P,  p j  ) i := j end return P’

76 Algorithm - Agarwal et al. p1p1 pjpj P j+1 Algorithm(P =  p 1,…,p n ,  ) i := 1 P’=  p 1  while i < n do find any j>i such that (  (p i,p j )   and (  (p i,p j+1 ) >  ) or (  (p i,p j )   and j=n) P’= concat(P,  p j  ) i := j end return P’

77 Algorithm - Agarwal et al. Efficient algorithm? Recall: Computing the Fréchet distance between (p i,p j ) and  (p i,p j ) can be done in O(j-i) time (Lecture 1). pipi pjpj P j+1

78 Algorithm - Agarwal et al. Efficient algorithm? Recall: Computing the Fréchet distance between (p i,p j ) and  (p i,p j ) can be done in O(j-i) time (Lecture 1). Finding the first j such that  (p i,p j )   and  (p i,p j+1 ) >  takes O(n 2 ) time. pipi pjpj P j+1

79 Algorithm - Agarwal et al. How can we speed up the search for p j ? Note that it is enough to find any vertex p j such that  (p i,p j )   and  (p i,p j+1 ) >  Idea: Search for p j using exponential search followed by binary search!

80 Algorithm - Agarwal et al. Exponential search: Test p i+1, p i+2, p i+4, p i+8 … until found p i+2 k, such that  (p i,p i+2 k ) > . Binary search: Search for p j between p i+2 k-1 and p i+2 k s.t.  (p i,p j )   and  (p i,p j+1 ) > . i+2 k-1 i+2 k    > 

81 Algorithm - Agarwal et al.    >  if   then search right Binary search: Search for p j between p i+2 k-1 and p i+2 k s.t.  (p i,p j )   and  (p i,p j+1 ) > . Exponential search: Test p i+1, p i+2, p i+4, p i+8 … until found p i+2 k, such that  (p i,p i+2 k ) > . i+2 k-1 i+2 k

82 Algorithm - Agarwal et al.    >  Binary search: Search for p j between p i+2 k-1 and p i+2 k s.t.  (p i,p j )   and  (p i,p j+1 ) > . Exponential search: Test p i+1, p i+2, p i+4, p i+8 … until found p i+2 k, such that  (p i,p i+2 k ) > . i+2 k-1 i+2 k if >  then search left

83 Algorithm - Agarwal et al.    >  Binary search: Search for p j between p i+2 k-1 and p i+2 k s.t.  (p i,p j )   and  (p i,p j+1 ) > . Exponential search: Test p i+1, p i+2, p i+4, p i+8 … until found p i+2 k, such that  (p i,p i+2 k ) > . i+2 k-1 i+2 k pjpj p j+1  >>

84 Algorithm - Agarwal et al. Binary search: Search for p j between p i+2 k-1 and p i+2 k s.t.  (p i,p j )   and  (p i,p j+1 ) > . Iterations: O(log n) Total time: O(n log n) Exponential search: Test p i+1, p i+2, p i+4, p i+8 … until found p i+2 k, such that  (p i,p i+2 k ) > . Iterations: O(log n)

85 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). pipi pmpm pjpj plpl

86 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). Proof: Fix matching that realises  (p l p m ). Set =  (p l p m ). pipi pmpm pjpj plpl qjqj qiqi

87 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). Proof: Fix matching that realises  (p l p m ). Set =  (p l p m ). 1.  (  (p i p j ),(q i q j )) ≤ pipi pmpm pjpj plpl qjqj qiqi

88 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). Proof: Fix matching that realises  (p l p m ). Set =  (p l p m ). 1.  (  (p i p j ),(q i q j )) ≤ pipi pjpj qjqj qiqi  (p i p j )

89 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). Proof: Fix matching that realises  (p l p m ). Set =  (p l p m ). 1.  (  (p i p j ),(q i q j )) ≤ 2.  ((q i q j ),(p i p j )) ≤ pipi pmpm pjpj plpl qjqj qiqi

90 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). Proof: Fix matching that realises  (p l p m ). Set =  (p l p m ). 1.  (  (p i p j ),(q i q j )) ≤ 2.  ((q i q j ),(p i p j )) ≤ pipi pjpj qjqj qiqi ≤ ≤

91 Analysis - Agarwal et al. Lemma 1: Let P =  p 1, p 2,..., p n  be a polygonal curve. For l ≤ i ≤ j ≤ m,  (p i p j ) ≤ 2·  (p l p m ). Proof: Fix matching that realises  (p l p m ). Set =  (p l p m ). 1.  (  (p i p j ),(q i q j )) ≤ 2.  ((q i q j ),(p i p j )) ≤  (  (p i p j ),p i p j ) ≤ ≤  (  (p i p j ),(q i q j )) +  ((q i q j ),(p i p j )) ≤ 2 pipi pmpm pjpj plpl qjqj qiqi □  (p i p j )

92 Analysis - Agarwal et al. Theorem:  (P,P’)   and |P’|  P opt (  /2) Proof:  (P,P’)   follows by construction.

93 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n  Prove (by induction) that i m  j m,  m  1. p i m-1 pjmpjm pimpim

94 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n  Prove (by induction) that i m  j m,  m  1. Assume i m-1  j m-1 and let i’ = i m +1. p i m-1 pjmpjm pimpim p i’ p j m-1

95 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n  Prove (by induction) that i m  j m,  m  1. Assume i m-1  j m-1 and let i’ = i m +1. By construction we have:  (p i m-1 p i’ ) >  and  (p i m-1 p i’-1 )   p i m-1 pjmpjm pimpim p i’ p j m-1 If i’ > j m then we are done!  >>

96 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n   (p i m-1 p i’ ) >  and  (p i m-1 p i’-1 )   Assume the opposite i.e. i’  j m p i m-1 pjmpjm pimpim p i’ p j m-1

97 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n   (p i m-1 p i’ ) >  and  (p i m-1 p i’-1 )   Assume the opposite i.e. i’  j m Q is an (  /2)-simplification   (p j m-1 p j m )   /2 p i m-1 pjmpjm pimpim p i’ p j m-1

98 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n   (p i m-1 p i’ ) >  and  (p i m-1 p i’-1 )   Assume the opposite i.e. i’  j m Q is an (  /2)-simplification   (p j m-1 p j m )   /2 According to Lemma 1:  (p i m-1 p i’ )  2  (p j m-1 p j m )   p i m-1 pjmpjm pimpim p i’ p j m-1

99 Analysis - Agarwal et al. Theorem: |P’|  P opt (  /2) Proof: Q =  p 1 = p j 1,…, p j l =p n  - optimal (  /2)-simplification P’ =  p 1 = p i 1,…, p i k =p n  According to Lemma 1:  (p i m-1 p i’ )  2  (p j m-1 p j m )   This is a contradiction since  (p j m-1 p j m ) >  by construction.  i’ > j m and we are done! p i m-1 pjmpjm pimpim p i’ p j m-1 □

100 Summary - Agarwal et al. Theorem: Given a polygonal curve P in R d and a parameter   0, an  -simplification of P of size at most P opt (  /2 ) can be constructed in O(n log n) time and O(n) space.

101 Summary Ramer–Douglas–Peucker 1973 Used very often in practice. Easy to implement and fast in practice. Hausdorff error Simple Simplification O(n) time - simple and fast Several nice properties. Fréchet error Imai-Iri 1988 Gives an optimal solution but slow. Hausdorff error Agarwal, Har-Peled, Mustafa and Wang 2005 Fast and easy to implement. Gives a worst-case performance guarantee. Fréchet error

102 Handle time? Compress trajectories s.t. standard database queries are “sound” after compression. The five standard database operations on a trajectory T are: where-at(T,t): location of e at time t. when-at(T,(x,y),L): time at which e is within distance L of (x,y) intersect: nearest-neighbour: spatial-join:

103 where-at(T,t): location of e at time t. time t point (x,y) when-at(T,(x,y),L): time at which e is within distance L of (x,y). Handle time?

104 Soundness Define distance between simplification and original trajectory. Definition: A distance function is sound for a query q, if for each  >0 there exists a  >0, s.t. for every trajectory T and its  -simplification T’ we have ||q(T)-q(T’)||< . [Cao, Wolfson & Trajcevski’06] 

105 Path simplification ? Input pathTraditional path simplification Aim

106 Soundness Trajectory = Polygonal path in 3D (x,y,time) Transform time units into space units (x,y,z), where z = time   and  is the maximum speed along the trajectory. Use the Euclidean distance function. Theorem: Where-at, spatial-join, NN, intersect are sound When-at is NOT sound Where-at(T,t): Spatial error = |pq| = |pr|/sin(  rqp)   2   p q r t

107 Soundness Theorem: Where-at, spatial-join, NN, intersect are sound When-at is approximately sound Apx-When-at(T,(x,y),L): When within distance L from (x,y)? Set-Apx-when-at(T,(x,y),L) Set of time points when T is within distance L from (x, y) Given a query point q=(x, y), let t 1 be the time reported by apx-when-at(T’,(x, y), L+  ). There exists a time point t 2 in set-apx-when-at (T, (x, y), L+2  ) such that |t 1 − t 2 |   /  and |T(t 1 ) − T’(t 2 )|  .

108 Summary Simplifying polygonal curves Ramer–Douglas–Peucker 1973 Driemel, Har-Peled and Wenk 2010 Imai-Iri 1988 Agarwal, Har-Peled, Mustafa and Wang 2005 Take time into consideration Other interesting simplification algorithms Abam, de Berg, Hachenberger, Zarei 2007

109 Constraint FSD Recall the free space diagram (fsd) Consider the fsd of two curves P and Q with respect to a distance r. (q  Q,p  P) in the fsd is in the free space iff dist(q,p)  r. ( q 1,p 1 ) (q m,p n ) P Q Can we use it for other measures? q p

110 Constraint FSD Example: (q  Q,p  P) in the fsd is in the free space iff p can “see” q. q p Can the owner and the dog walk along P and Q such that they always see each other?

111 Constraint FSD Example: (q  Q,p  P) in the fsd is in the free space iff p can “see” q. q p Can the owner and the dog walk along P and Q such that they always see each other? Yes!

112 Constraint FSD Example: The entities must walk with similar speed (similar ~ within a factor of 2?). Can the entities walk along P and Q with similar speed while keeping a distance of at most r? P Q

113 Constraint FSD Example: The entities must walk with similar speed (similar ~ within a factor of 2?). Can the entities walk along P and Q with similar speed while keeping a distance of at most r? P Q

114 Constraint FSD Example: The entities must walk with similar speed (similar ~ within a factor of 2?). Can the entities walk along P and Q with similar speed while keeping a distance of at most r? P Q

115 Constraint FSD Example: The entities must walk with similar speed (similar ~ within a factor of 2?). Can the entities walk along P and Q with similar speed while keeping a distance of at most r? P Q

116 Constraint FSD Example: The entities must walk with similar speed (similar ~ within a factor of 2?). Can the entities walk along P and Q with similar speed while keeping a distance of at most r? No! P Q

117 Open Problem 1.Can we find a subquadtratic algorithm that computed a simplification with a minimal number of edges, or within a constant factor?

118 References A. Driemel, S. Har-Peled and C. Wenk. Approximating the Fréchet Distance for Realistic Curves in Near Linear Time. Discrete & Computational Geometry, H. Cao, O. Wolfson, and G. Trajcevski. Spatio-temporal data reduction with deterministic error bounds. The VLDB Journal, W. S. Chan and F. Chin. Approximation of polygonal curves with minimum number of line segments. In Proceedings of the 3rd International Symposium on Algorithms and Computation, D. H. Douglas and T. K. Peucker. Algorithms for the reduction of the number of points required to represent a digitized line or its caricature. The Canadian Cartographer, J. Gudmundsson, J. Katajainen, D. Merrick, C. Ong and T. Wolle. Compressing spatio- temporal trajectories. Computational Geometry - Theory and Applications, P. K. Agarwal, S. Har-Peled, N. Mustafa, and Y. Wang. Near-linear time approximation algorithms for curve simplication in two and three dimensions. Algorithmica, 2005.


Download ppt "Computational Movement Analysis Lecture 3: Curve simplification Joachim Gudmundsson."

Similar presentations


Ads by Google