Approximate Matching of Polygonal Shapes*

0 downloads 0 Views 549KB Size Report
match between. P and an image. I(Q) of Q the distance between the cen- troids .... A linear time algorithm for it in the case of convex polygons has been given by ... cell of a vertex from the cell of an edge). Vor(P) has O(p) edges and vertices .... i.e. if the corresponding endpoint of 1A(e) is contained in C !a,c(J) is defined.
Approximate

Matching

of Polygonal

(Extended

Helmut Bernd Johannes Institut

fiir

Alt

Behrends Blomer

Informatik, Fachbereieh Mathematik, Freie Universit5t Arnimallee 2-6, W-1OOO Berlin 33, Germany

Abstract

Given

two objects

resemble For

two

given

determine match

simple

a rigid

between

distance

cases, namely

that

to translations out that that

P

only

timal

in

determining

differ

from

more In

fact

P and an image troids

ejjiciently

multiple

and I(Q).

It is also shown two

O(n log n],

a constant

polygons

turns factor

determining

op-

case the algorithm

hulls

between

between

the cen-

of P and I(Q]

that

n is the total

P

the Hausdorff-distance number

in time

of this

tern

paper

recognition

which

is to present solving

methods

standard

from

problems

can be intuitively

plane.

formulated

similar

to P.

Q are simple the

P Here

polygons

problem

above

in

can be

P and

1(Q)

minimal

distance).

Here

in the plane (see [M])

I such

is minimized

which

that

(and

an isometry preserves

any isometry

the

distance

determine

that

is an affine

map-

distances.

As is well

1 can be represented

I=ropot

or

I=

as

pot,

where

r is the

about

the

we will

reflexion

origion

wlog.

and

mean

(also

at

by isometry

called

rigid

can easily the better

sense,

x —axis, only

motions

p a rot at ion this

isometrics

by first

P and r(Q)

of the two

any isometry

In

or even

be included

P and Q and then

taking

the

t a translation.

article without

isometrics). matching

by rigid

op-

motions

matches.

1 is of the form

I(z)=

(1)

M.z+t

as

research was support ed by the Deutsche Forschungsgemeinschaft under graut Al 253/1–3, Schwerpunktprogramm “Dat enstrukt~en und effiziente Algorithmen” Permission to copy without fee all or part of this material is granted prowded that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of lhe publication and Its date appear, and notice is given that copying is by permmsion of the To copy otherwise, or to Association for Computing Machine~. republish, requires a fee and/or specific permission.

M

$1.50

(

Cos p

sin p

— sin 9

Cos p

and

t E R2 is some fixed a

use

the

fined ~H(X, Y.

distance

Y)

measure

so-called

by 6H(A,

B)

= ~~

that

=

~~

is always 1 shows 6H(P,

for

translation

P

two I(Q))

and 6H

B), ~H(l?,

y), is the

distance defined

p

E [0, 2m[

vector.

between

max(~H(A, d(z,

some

)

Hausdorff-metric

d is the Euclidean

8H (A, B) such

186

=

As

Figure 86

is most

and

recognition)

of a set of samples

Com-

“This

0-89791-426-0/91/0006/01

character

an isometry

between

where

ACM

do they

up to some

as follows:

P, Q, find

known

identical

Q out

So geometrically

formulated Given

that

in pat-

follows:

@ 1991

that which

and

Geometry

(e.g.

and

assume

In this aim

input

P

the

they

?)

we will

reflexions

of vertices.

Introduction

The

P and Q, how much Are

has to be determined

timally

putational

(or:

applications

be the

Reflexions

1

(shapes)

is

between

can be determined

6>0

In many

ping

match

of the Hausdorff-distance

simple where

It

i.e. ones

possible

of the edges of the convex

between

direction.

of Q the distance

a constant

or even

is based on the quite sur-

the optimal

I(Q)

as

special

solutions, than

general

solution

that for

for

Berlin,

each other?

tolerance will

algorithms

to translations

by just

the most

the pseudo-optimal

prising

Faster

one specified

optimum

the Hausdorff-

are obtained

pseudo-optimal

the

solutions.

I(Q).

problem

is to

the best possible

minimizing

I is restricted

can be done much for

and

the general

P, Q the problem

I of Q giving

P and Q, i.e.

between

the one for

polygons

motion

Shapes*

Abstract)

distance

in the plane.

I(Q)

that A)), from

we

is

de-

where X

Notice

to

that

if A, B C R2 are bounded.

polygons

P, Q and an isometry

is minimized.

1

~H (P, I(Q))

Figure

(Note

that

polygon

this

paper,

P as a set, we always

throughout

mean

the edges of P, not some

special

above

which

the

POby P2:

problem

then

Only

a on

There

problem

interest.

we define

are

P2,

are allowed,

i.e. in(1)

Al

Pl,

is the

allowed,

i.e. A4 = Id

one fixed

and

direction

isometrics

(~=

~d,t

except =

(~)),

i.e. the

the Hausdorff-distance A standard Pl)

example

is again

a very

for it in the Atallah

of polygons and more lated

7 and

9.

efficient

more,

that

Similar

isometry,

to the

ones

measure

imation

algorithms

rithm

[AKMSW]

and

here

with

have been in this

point [HK].

respect considered

context

to

given

2

of

for PO, where

an O((p

algorithm

of the

edges

a constant

is based between

of the

on the

P and distance

convex

the best

opti-

Hausdorff-

by

the

This

the

an be-

hulls

possible

of

match

17t.

two

the polygons

Hausdorff-distance (Problem

PO)

sets instead and [S],

Problems

Let

re-

an alternative in [G].

have been

P, Q be In

tively.

Approxdeveloped

+ q) log(p

p and q are the numbers

+ q))

Hausdorff-distance

the

Voronoi-diagram Vor(P)

algo-

of vertices

187

two

order

the

Voronoi-cell, give

only

distance

of Q giving

5 algorithms

resulting

of Q is ~ then

Determining

by

[G].

2 we will

1(Q)

copy

the

P3 the

very

compute

optimum

minimum

centroids

of the

where

are

is not

as an alternative.

necessarily

the

problem

image

the

one

from

if the

is at most

algorithm

in [AMWW] and

For

P and

but

differs

that

do not

P3 al-

of course,

time

has been

for

have been investigated

distance

In section

questions

they

and

runtimes that

in section

solutions

algo-

comput-

to DavenportP2

Since

we present

means

tween

Q.

PO is,

any

pseudo-optimal

isometric

of P2 (or even

A linear polygons

allowed

related

of degree

giving

for

problems

polynomials

factor.

is to measure

Pand

recognition.

case of convex

are

problem

application

problem.

recently,

in [ABGWl

the

character

[At 1].

identity

between

for

fundamental

the

for

approximate

distance

tO are

t c {A .tol~E R}

for

of functions Next

log(pq))

techniques

whose

fact PO: No

will

an 0( A66(pq)

using

be given

mal along

envelopes

gorithms

matrixld translations

Then

be presented

Schinzel-sequences.

P3 denote

problems

will

ing upper

formulated Let

of P, Q, respectively. rithm

restrictions:

translations

identity PI:

general

are of independent

the following Only

when

the ones in the interior.)

cases of the

general

considering

the set of points

1:

assigns i.e.

polygons to

solve

p, q vertices, PO, P

between of

set

to this

element

any

one (see Figure

respec-

i, e. determine Q we consider

and

P, Vor(P).

to each edge and each vertex the

are closer other

with problem

of points (i.e. 2).

in

the

edge or vertex) The

edges

of P its

plane

which than

c)f Vor(P)

to are

Figure2:

either

line

edges

or

they

segments two

separate

edge).

the

Vor(P) a finite consider

with

Q (see Figure

As easily first

decreases

and

than

that

or

at

the

edge bounding It

that

the

mono-

i.e. (or

of a point with

some

distance

&

monotonically to the elements

edge is a bitonic

(Q, P)

of P.

whose

function

cells

is

must

sumed

1

e of P the

point the

intersection

distance

at some

of Q with smallest points

of Q

vertex some

to P,

~H(Q,

Voronoi-edge

largest

z—coordinate

of Q with

e (see Figure

or

that

is we have the

by the

possibly

In order

to obtain

only

with left

there

and

we

their $H(Q,

distance P).

the the

neighcells

of

elements

points.

across edges

the arrangement of Vor(P)

and

intersection

delete

e from

Q.

points the

data

as the first

intersection

found.

Two

such

sweeps,

one from

right

to left

are neces-

points

we obtain

are O(p

+ q) event

an O((P + g) log(p + q))-algorithm candidates in the sense of Lemma

if we

It remains

as soon

Q has been

Since

split

the that

nearest

of Q and

intersection

at

Notice

to determine

sweep

e of Vor(P),

to right

and their

hav-

pieces

occurs.)

the extreme

2-3-tree)

segments

two

1 is O(p+q).

vertices

obtained

of an dis-

in Lemma

by a plane

(e.g.

into

tangent

to the critical

edge

parabolic

cut

these points

containing

of each

that

are

vertical

of points

We do this

to P and Analogously,

taking $H(P,

their Q)

one

for determining all 1. By determining maximum and

thus

we get C$H(P, Q)

can be determined.

by this Summa-

P)

of Q or at some

the

on P,

Vor(P)

An

3

The

either

where

sarY.

as-

we assume tangent

the number

point

be

F’

to show how to find

from

we have

Lemma

point

of the

point

before.

a vertical

structure

Voronoi-

are separated

as described

the lemma

of Q on

Furthermore

on a Voronoi-edge

(In

of P closest

decreasing).

at the endpoints

point

Polygon

ing

C.

monotonically

distance

a Voronoi-edge

tance

ezther

C

function,

monotone

ofa

bors

Voronoi-cell

of Q or an intersection

move

tion

to

to the corresponding

be assumed

at a vertex

edge of Q with

rizing

can be

In order

cell C’.

follows

sumed

of an

we move

this

or just

intersection

(if

Voronoi-cell

C is a bit onic

the maximal

edge to P must

cell and

,[F]).

that

increases

increasing

of two

the following:

of Q within cell

the

of a fixed

Suppose

cells

Diagram

segments

vertices

can be seen the distance

monotone

edge

and

(see[Y]

the intersection 3).

the

from

we observe

of P defining

It follows this

edges

O(p logp)

on an edge

element

separate or parabolic

of a vertex

problem

First

just

cell

in time

tonically

they

of P)

has O(p)

constructed obtain

(if

vertices

Voronoi

is as-

intersec-

among

For problem of the

e of P having the

3).

allowed

for

PI

P 1 we can assume translations

wlog.

is parallel

translation vectors are of the form ~ c R and an egde e of Q we denote of

188

algorithm

e.

that

the direction

to the x-axis,

i.e.

(A, O), A E R. For by 1A(e) the image

# : : ..* %. %. %.*

●✎✌ ✞✚✎ ‘. .

. . . . . . . . . . . . . . . ...*.-

.’ .“

.’ ~“

: : : : : : :“

Figure Vor(P)

3:

● - extreme

and Q

intersection

ure

. .. .. . . . . . .. .. .. . . . . . .. . . . . . .. .. / . . .. ... .. .. . . .. ..

4).

points.

For

~ E ~j denote

intersection

point.

signs

to A E lj

edge

A

- each

of P

pair

6H of the image

the maximum that

algebraic

functions

of these

consists

4:

O (~66 (pq) the

Iog(pq)), distance

A. By merging it is easily

three incide) an

intervals

over,

11,12,13

such that

intersection while

seen that

bounding, for point

~ moves

the intersection

point

for e an edge of Q and e’ an say, cell C there

(that

any

may

overlap

exist

and even co-

A c 13, j“ = 1, 2, 3, there

between continuously

moves

1A(e)

and

through

continuously

at most

e’ and,

the

exists more-

Ii, j = 1,2, 3, on e’ (see Fig-

189

cf.

[At2].

from

P

pieces

the two functions

~ in time

pression

for

bounded

by O (pq log(pq)

this

upper of the

graphs

of

in time

we can deter-

we can determine

is known log* (pq))

theory

envelop e

as a function

O (A66 (pq) log(pq)). function

the

be computed lA(Q)

of any

64 points.

from

Likewise, to

are pieces

at most

t heir

can

A to P it can be

8. Therefore

terminology

it

Hausdorff-

position

above

in

to the site

Now

at most

~~~(pq) and

optimal

in C

point 1 the

defined

sequences,

functions

is contained

of this

intersect

using of at most

single

mine Now

functions

i.e. if

functions.

of degree

edge

fa,c,

to Lemma

these

or for

of some

of Q at some

the functions

of Davenport-Schinzel j

edge of Vor(P)

of all

observed

Consequently,

Figure

According

as-

vertex

we define

the function of 1A(e)

that

to the

Likewise

as the distance

~ell C.

the

C’.

endpoint

is defined

corresponding

a is an endpoint

defining

two a

where

distance is

................. .................... .......L ......

cell

of ej (~)

C a cell of Vor(P),

corresponding

!a,c(J)

the

~~~, (A) is the function

distance

defining

(a, C),

e of Q and the

Now the

by ej (~)

No explicit but

it

certainly

(see e.g. [ASS]).

of the ex-

is

4

Algorithms

We

will

only

P2

and

P3,

for

briefly

two P2

and

6 :=

that

We

between

a and

between

such the

pair

Here, the

that of P

dist ante

and

the

6

vector

d is the shortest

Lemma

2 Either

there

the corresponding

there

are at least

The

proof

ering

three

of Lemma

the different

pairs.

This

stract.

We just

of Q is not

critical

2 is done

will

there

or

segment. specify

be only

constantly

above

5, why

are only

d(as,

7-3)

ab-

O ((pq)3)

tion

for

for

some

time cient

have

possible

for

PI

from

8H-value give

has

sec-

among optimal

a runtime

of

that

such

P3

solution,

but

checks 6H

be solved

in

more effito our so-

Davenport-Schinzel about

methods

which

not

in [EPSS]).

still

Instead,

in the next

would

not

we present

an

section.

solutions

we will

and

So P3 can

algorithms.

(except

determining

cases are treated

Pseudo-optimal section

each time 2.

pairs

algorithm

e functions,

yet (special

efficient

P2

4 critical So the

considering

multivariat

ah ernat ive approach

mal

algorithm

+ q) log(p + g)). Probably can be found analogously

we believe

really

lems

the equa-

checked

at least cases).

problem

However,

In this

pawill

we deter-

algorithm

of section

is known

5

are

two

1, there

of them

minimal

isometrics,

algorithm

for

give

the

if ri

such that

each

with

which

degenerate

structures much

For

and

ri,

+ q) log(p + q)). Problem P3 can be solved Analogously to Lemma 2 any optimal solu-

O ((pq)4(p algorithms

lution

P2 only

isometrics

So the

in

(translation)

by applying

P3 must

by the

pairs.

many

many

point

in problem

satisfied.

P2.

if r-i is a point

ai to any

Since

isometrics

to

O ((pq)4)

the placement critical

the

distance

from

the isometry

6H (P, 1(Q)) 2. Those

O ((Pq)3(P similarly.

2 critical

extended

two

d(a~, TZ)

=

are

tion

solutions

consid-

are only

in this

in Figure

if there

such that

by contradiction

be omitted

illustrate

optimal,

pairs

u, v, u = –v,

pairs.

cases, where

proof

critical

vectors

=

r~)

Euclidean

rameters tions

We claim:

are two

critical

m)

d(a~,

distance

is a line

mine

for

d(al,

that

a, b be points

which

vector.

present

for problem

(translation) Let

equations

problems

Suppose

as an instance

(a, b) a critical

b a critical

for we will

approach.

is minimal.

call

two

section

efficient

respectively,

occurs.

P3

algorithms

next

1 is an isometry 1(Q))

1(Q),

the

P, Q are given

6H(P,

and

in

more

polygons

and

describe

since

an alternative,

P2

give efficient

which

not

algorithms

necessarily

a pseudo-optimal

for prob-

find

the

opti-

one in the following

sense: Definition

t

3 An

pseudo-optimal is a constant Figure

5: Nonoptimal

vector

t will

placement

decrease

the

of Q, a translation

finds

by

c >0

a translation

where

Hausdorff-distance.

Our

algorithm

possibilities

for

P, Q containing scribe

three three

cases can be solved (al,

runtime. rl),

vertices

pairs.

critical

vertices with

So the

(az, rz),

on Lemma

(i.e.

critical

the case here where

(a~, b~) involve same

P2 based

of elements

edges)

will

only

We

pairs

(al,

bl),

al, az, as of P.

similar where

ai

is

all

a vertex

For a polygon

other

Let

and

ri

is

a vertex

i = 1, 2, 3. Clearly, a given between

triple, ai

and

there

or

edge

i =

the

are O ((pq)3)

if we demand ri,

of

that

the

1, 2, 3 are the

other such

or

polygon, triples.

three

distances we obtain

produce iff

a

there

P, Q the algorithm 6H(P,

I(Q))

Hausdorff-distance

solution

length

P let rp

< c6,

determined

for

P2

can

be found

where

zp(yp

very

I(Q))

is minimal.

rp,

its

if

difference

at most

~

6H(P,

190

:= (ZP, yp) (y-coordinate)

) is the

of any point

in P

6).

‘1’herefore,

o b.

onto

For

same

I with

P, Q be two polygons

6 := 6H(P, W

Q

on input

z-coordinate

(see Figure

the P

such that (isometry)

to

P2 (P3),

solution.

pseudo-optimal

smallest

triples of

said

problem

easily:

de-

within

considers

A of

(az, bz),

The

techniques

algorithm

(a~, ra)

2 considers and

is

for

6 is the minimal

by the optimal

all

algorithm

solution

.6.

r

and

I a solution

Obviously

d(rp,

to P2, i.e. rI(Q))

is the translation mapping to the optimal one is a vector

Hence,

T(Q))

< (1+

fi)ti

< rQ

of

For

:

proving

parametrized

: : :.

4 First

tance

measure

called

“Fr6chet-distance”,

Definition

8C(CI,

for

a ranges

over

be determined

in time

if we

also

apply

the algorithm

want

+ 9) M(P course,

problem

Sohlt ion.

the

value for

+ d) the

O(p + q), the

r-p is not

ary of the convex

compute

hull

An

always

mappings

a : [a, b] ~

R2,

val, such that

the image

In particular,

we will

consider a : [0, LF] total

length

~

show

minimizing

wlog. now

that

that

1(Q)

parametrization

his dog, 8C(C1,

the man C2)

the origin,

walk-

is the min-

is possible.

pair

of

of Cl

d (ncl(t),

convex

Cz),

ciosed

in fact

curves

to any natural

there

exists

a(t))

< 6H(C1,

can be shown

a)

Let

Lcl,

Cl

Lc,

and

their

Cz). Then

a parametrizaC2) for

by elementary

C2

be

ali

geo-

convex

circumferences

ILc1

– Lc,

where

inter= a(b).

from

LF

@

be polygons,

then

< 6H(P,

closed

and

6

=

I < 27rti

we can sketch

the proof

Let

R

:=

:=

~,

T

such

a(0)

that d (cr(t),

~(t))

of

1~)

of R,

according

for

the

convex

(=

and

Lemma I(Q)),

~

4: rx

a

natural

a parametrization

to Lemma

of T

6