SCALED PATTERN MATCHING - PowerPoint PPT Presentation

About This Presentation
Title:

SCALED PATTERN MATCHING

Description:

In fact, can there be two different scaled patterns of P of size k k? 5 5. Example: ... Space and Time Analysis. m m, (m 1) (m 1), ... , n. n Dictionary size O ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 64
Provided by: uCsB7
Category:

less

Transcript and Presenter's Notes

Title: SCALED PATTERN MATCHING


1
SCALED PATTERN MATCHING
  • A.Amir Bar-Ilan Univ. Georgia Tech
  • A.Butman Holon College
  • M.Lewenstein Bar-Ilan Univ.
  • E.Porat Bar-Ilan Univ.

2
SEARCHING FOR TEMPLATES IN AERIAL PHOTOGRAPHS
INPUT
TASK Search for all locations where the
template appears in the image.
3
Theoretically, need to consider
  • Noise
  • Occlusion
  • Scaling (size)
  • Rotation (orientation)

We are interested in asymptotically efficient
algorithms in pixel space.
4
MODEL
  • Low Level (pixel level) avoid costly
    preprocessing
  • Asymptotically efficient solutions.
  • Serial, exact algorithms.

5
TYPES OF APPROXIMATIONS
Local Errors Level of detail Occlusion Nois
e
6
TYPES OF APPROXIMATIONS
Orientation
7
EVEN WITHOUT ERRORS AND ROTATIONS
  • DIGITIZING NEWSPAPER STORIES
  • IDEA Keep dictionary of fonts
  • Search for appearances in all size.

8
PROBLEM
  • INHERENTLY INEXACT
  • What if appearance is 1½ times bigger ?
  • What is ½ a pixel ?

SOLUTIONS UNTIL NOW NATURAL SCALES Consider
only discrete scales
9
  • How does one model for
  • real scales?

10
Step 1 Define grid pixel centers.
Example Unit pixel array for a 7?7 array.
11
Step 2 Define scaling. Example 3?3 array.
Scaled To 1?
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
Scaled To 1?
17
Remark
  • We only scale up
  • Reasons
  • Avoid conceptual problems of loss of resolution.
  • From far enough away everything looks the same.

18
Let P be a m?m pattern and T an n?n text.
How many different scaled patterns of P are
there?
19
In fact, can there be two different scaled
patterns of P of size k?k?
20
Example





55
21
4 x 1.1 4.4
Scaled by 1.1 to 6x6
22
4 x 1.125 4.5
Scaled by 1.125 to 6x6
23
3 x 1.17 3.51
Scaled by 1.17 to 6x6
24
2 x 1.25 2.5
Scaled by 1.25 to 6x6
25
Let P be a m?m pattern and T an n?n text.
How many different scaled patterns of P are
there?
26
Claim
  • There are nm different scaled patterns
    representing all the occurrences of P.

27
Proof
Each one has at most m possible matrices
representing it
m?m, (m1)?(m1), , n?n
n-m different possible sizes
28
Proof
Each one has at most m possible matrices
representing it
Why?
29
Distance 1
30
Pattern P scaled to size kk,
31
(No Transcript)
32
Therefore
  • There are nm different scaled patterns
    representing all the occurrences of P.

33
Algorithm outline for 2-D scaled matching
34
Straightforward Idea
  • Construct dictionary of O(nm) possible scaled
    occurrences of P.
  • Use 2-dimensional dictionary matching algorithm
    to scan the text in linear time and find all
    occurrences.

35
Space and Time Analysis
Each one has at most m possible matrices
representing it
m?m, (m1)?(m1), , n?n
Dictionary size O(n3m)
36
Solution
  • Our idea is to keep the dictionary in compressed
    form.
  • The compression we use is run-length of the rows.

37
Run-length
aabcccbb
a2b1c3b2
38
The compressed dictionary
C C B B B A A
C C B B B A A
F F E E E D D
F F E E E D D
F F E E E D D
I I H H H G G
I I H H H G G
C B A
F E D
I H G
Scaled To 2?
39
C C B B B A A
C C B B B A A
F F E E E D D
F F E E E D D
F F E E E D D
I I H H H G G
I I H H H G G
2 C2 B3 A2
3 F2 E3 D2
2 I2 H3 G2
Compressed form
40
2 C2 B3 A2
3 F2 E3 D2
2 I2 H3 G2
Size of Array mxm
of diff. scaled patterns (n-m) x m
Dictionary size O(nm3)
41
The Idea behind the text searching
  • For every text location i,j, we assume that
    there is a pattern scaled occurrence beginning at
    that location.
  • Subsequently, we establish the number of times
    this row repeats in the text.
  • This allows us to an appropriately scaled pattern
    row from the dictionary.

42
Example for text searching
43

c150
b
a10
1
aaaaaaaaaa
44
Look in the text location 1,10
45
(No Transcript)
46

c150
b
a10
1
47

c150
b
a10
1
aaaaaaaaaab
48

c150
b
a10
1
Look in the text location 1,10
aaaaaaaaaabccccccccccccccc
49
(No Transcript)
50
A scale range of 1,1¼)
51
Last symbol may repeat in the text more time
than the scaled pattern need.
52
What about the number of times the first subrow
repeats?
53
The range of 1,1¼) is valid since
?102?1¼?128lt132.
54
Look in the text location 1,9
55
(No Transcript)
56
A scale range of 1¼,1¾)
57
Too large, it requires the c to repeat 175 times.

58
(No Transcript)
59
(No Transcript)
60
The maximum scale valid for both horizontal and
vertical scales produces the pattern whose first
row is a2bc129 and which repeats 132 times.
61
(No Transcript)
62
OPEN PROBLEM
  • Give algorithm linear in run-length compressed
    text and pattern.

63
END
Write a Comment
User Comments (0)
About PowerShow.com