24
Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Embed Size (px)

Citation preview

Page 1: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Efficient algorithms for

polygonal approximation

DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND

Alexander Kolesnikov

Page 2: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Polygonal approximation of discrete curves

qr+1qr

Given the N-vertex polygonal curve P.

a) Min-e problem: Given the number of line segments M,

approximate

the curve P by polygonal curve Q with minimum error E(P).

b) Min-# problem: given bound on approximation error,

approximate curve P by polygonal curve Q with minimum number of line segments.

q1 qM

P

Q

Page 3: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Examples of polygonal approximation

Vectorization Image analysis

Digital cartography 3-D paths

Page 4: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Optimal vs. Heuristic algorithmsHeuristic approaches

1) Sequential tracing approach 2) Split method 3) Merge method 4) Split-and-Merge method 5) Dominant point detection 6) Relaxation labeling 7) K-means method 8) Genetic algorithm 9) Ant colony optimization method 10) Tabu search 11) Discrete particle swarm

algorithm 12) Vertex adjustment method

Optimal methods

1) Min-# problem: Shortest path in graph

2) Min- problem: K-link shortest path in graph

Page 5: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Min- problem: Optimal vs. Heuristic

Heuristic algorithms Non-optimal: F<100% Fast: O(N)O(N2)

(seconds and less)

Optimal algorithm Optimal: F=100% Slow: O(N2)O(N3) (minutes and more)

Page 6: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Heuristic Efficient Optimal

Heuristic algorithms Non-optimal: F<100% Fast: O(N)O(N2)

(seconds and less)

Efficent algorithm Fast: O(N)O(N2) Close to optimal: F100%

Optimal algorithm Optimal: F=100% Slow: O(N2)O(N3) (minutes and more)

Page 7: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Contents

A) Min- problem for open curves

B) Min- problem for closed curves

C) Min- problem for multiple-objects

Page 8: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

A) Min- problem for open curve

qr+1qr

)1

,(2

2}{

2min)(

r

qrq

M

rrq

ePE )1

,(2

2}{

2min)(

r

qrq

M

rrq

ePE

Approximate the given open N-vertex polygonal curve P by

another one Q consisting of at most M line segments with

minimum error E(P):

q1 qM

Page 9: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

A) L2-approximation error for a segment

Approximation error for curve segment (pi,...,pj) :

1

1)21/(2)(),(2

j

ikabkxakyj

pipe ijijij

1

1)21/(2)(),(2

j

ikabkxakyj

pipe ijijij

Page 10: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

A) Full search in state space

M

N11

b

n

m

j

State space

D(n,m)

D(j,m-1)

D(N,M)

Start state

e2(j,n)

Goal state:

Complexity: O(MN2)

;,...,1;,1,min, 2

1MmppemjDmnD nj

njm

;,...,1;,1,min, 2

1MmppemjDmnD nj

njm

Page 11: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

A) Reduced search in state space

The reference solution.

The bounding corridor.

Page 12: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

A) Iterative reduced search DP algorithm

M=300

W=10

Time complexity: O(W2N2/M)

Spce complexity: O(WN)

Page 13: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

A) Iterative reduced search DP algorithm

M=300

W=10

a) Fidelity: F 100%b) Complexity: O(W2N2/M) =O(N)-O(N2)c) Time reducing: (W/M)2

The trade-off between the run time and optimality is

regulated by the corridor width and the number of iterations.

The trade-off between the run time and optimality is

regulated by the corridor width and the number of iterations.

Page 14: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

B) Min- problem for closed curve

Approximate the given closed N-vertex polygonal curve P by another

one Q consisting of at most M line segments with minimum error E(P).

Full search DP algorithm complexity: O(MN3)

)1

,(1

1}{

2min)(

r

qrq

M

rrq

ePE )1

,(1

1}{

2min)(

r

qrq

M

rrq

ePE

p1=pN

Page 15: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

B) State space for wrapped DP search

1

2

3

4

51

2

3

6

7

4

8

5

Page 16: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

B) Closed curves: Analysis of state space

Conjugate states: HG(m-M) = HG(m) – (N-1);

nstart=arg min {D(HG(m),m) D(HG(m-M), m-M)} –(N-1); Mm2M

Conjugate states: HG(m-M) = HG(m) – (N-1);

nstart=arg min {D(HG(m),m) D(HG(m-M), m-M)} –(N-1); Mm2M

HG(m) - optimal path for G

G

Page 17: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

B) Min- path with conjugate states

is old start point

is new start point

Page 18: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

B) Closed curves: Results

Heuristic algorithm: Fidelity F=88-100%T=100 s

Proposed algorithm: Fidelity F=100%T=10.4 s.

Page 19: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

C) Multi-object min- problem

Given K polygonal curves P1, P2, …,PK, approximate it

by set of K another polygonal curves Q1, Q2 ,…, QK with a given total number of segments M.

Page 20: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

C) Multi-object min- problem (cont’d)

Given K polygonal curves P1, P2, …,PK, approximate it

by set of K another polygonal curves Q1, Q2 ,…, QK with

a given total number of segments M so that the total

approximation error with measure L2 is minimized.

subject to:

MMK

kk

1

MMK

kk

1

K

k

M

mmkmkK

k

mk

qqeMPPEqM 1

1

11,,

21 ,minmin),,...,(

}{}{

K

k

M

mmkmkK

k

mk

qqeMPPEqM 1

1

11,,

21 ,minmin),,...,(

}{}{

Page 21: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

C) Full-search DP algorithm

Step 1: Solve optimal approximation problem for every object by DP to obtain the Rate-Distortion functions {gk(m)};

Step 2: Solve problem of the optimal allocation of the number of segments among objects by DP using the Rate-

Distortion functions {gk(m)};

Step 3: Re-solve the optimal approximation problem of

every object using the found optimal number of segments.

Time complexity: O(N3) Space complexity:O(N2)

Vector map: N = 10,000-100,000

Page 22: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Iterative reduced search for multi-object min- problem

Step 1: Find preliminary approximation of every object for an initial number of segments.

Step 2: Iterate the following:

a) Apply multiple-goal reduced search DP to define the Rate-Distortion functions.

b) Solve the optimal allocation of the found number of the segments among the objects

using the Rate-Distortion functions.

Page 23: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Reduced Full Search

Fidelity F 100% 100% Time complexity O(N)-O(N2) O(N3) Space complexity O(NW) O(N2)

C) Full vs. Iterative reduced DP search

The trade-off between the run time and optimality is

regulated by the corridor width W and the number of

iterations.

The trade-off between the run time and optimality is

regulated by the corridor width W and the number of

iterations.

Page 24: Efficient algorithms for polygonal approximation DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF JOENSUU JOENSUU, FINLAND Alexander Kolesnikov

Summary

A) Iterative Reduced search DP algorithm for min-

problem open curve

B) DP algorithm for min- problem for closed curve

C) DP algorithm for min- problem fom multiple-objects