s c a l e d pattern matching
DESCRIPTION
S C A L E D PATTERN MATCHING. A.Amir Bar-Ilan Univ. & Georgia Tech A.Butman Holon College M.Lewenstein Bar-Ilan Univ. E.Porat Bar-Ilan Univ. . TEMPLATE. AERIAL PHOTO. SEARCHING FOR TEMPLATES IN AERIAL PHOTOGRAPHS. INPUT. TASK: Search for all locations where the template - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/1.jpg)
SCALED PATTERN MATCHING
A.Amir Bar-Ilan Univ. & Georgia TechA.Butman Holon CollegeM.Lewenstein Bar-Ilan Univ. E.Porat Bar-Ilan Univ.
![Page 2: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/2.jpg)
SEARCHING FOR TEMPLATES IN AERIAL PHOTOGRAPHS
TEMPLATE
INPUT
TASK: Search for all locations where the templateappears in the image.
AERIAL PHOTO
![Page 3: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/3.jpg)
Theoretically, need to consider: Noise Occlusion Scaling (size) Rotation (orientation)
We are interested inasymptotically efficient algorithms
in pixel space.
local errors
![Page 4: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/4.jpg)
MODEL Low Level (pixel level) avoid costly
preprocessing
Asymptotically efficient solutions.
Serial, exact algorithms.
![Page 5: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/5.jpg)
TYPES OF APPROXIMATIONS
Local Errors: Level of detailOcclusionNoise
Results:
)log( 2 mnO mismatches
)( 22knO edit distance, k errors,rectangular patterns
)loglog( 2 kkmmknO edit distance, k errors,half-rectangular patterns
AL-88
AF-95
![Page 6: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/6.jpg)
TYPES OF APPROXIMATIONS
Orientation
Results:
)( 52mnO
)( 32mnO
FU-98
ACL-98
![Page 7: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/7.jpg)
EVEN WITHOUT ERRORS AND ROTATIONS…
DIGITIZING NEWSPAPER STORIESIDEA: Keep dictionary of fonts
Search for appearances in all size.
![Page 8: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/8.jpg)
PROBLEM
INHERENTLY INEXACTWhat if appearance is 1½ times
bigger ?What is ½ a pixel ?SOLUTIONS UNTIL NOW:
NATURAL SCALES
Consider only discrete scales
![Page 9: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/9.jpg)
How does one model for real scales?
![Page 10: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/10.jpg)
T[7,7]
T[5,4]
T[3,3]T[3,2]T[3,1]
T[2,3]T[2,2]T[2,1]
T[1,3]T[1,2]T[1,1]1
2
3
4
5
6
7
1 2 3 4 5 6 7
Step 1: Define grid & pixel centers.
Example: Unit pixel array for a 77array.
![Page 11: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/11.jpg)
Scaled
To 1⅓
Step 2: Define scaling. Example: 33 array.
![Page 12: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/12.jpg)
![Page 13: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/13.jpg)
![Page 14: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/14.jpg)
![Page 15: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/15.jpg)
![Page 16: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/16.jpg)
ScaledTo 1⅓
![Page 17: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/17.jpg)
Remark: We only scale “up”
Reasons: Avoid conceptual problems of loss
of resolution. From “far enough” away
everything looks the same.
![Page 18: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/18.jpg)
Let P be a mm pattern and T an nn text.
How many different scaled patterns of P are there?
![Page 19: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/19.jpg)
In fact, can there be two different scaled patterns of P of size kk?
![Page 20: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/20.jpg)
5×5
Example :
![Page 21: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/21.jpg)
Scaled
by 1.1 to 6x6
4 x 1.1 = 4.4
![Page 22: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/22.jpg)
4 x 1.125 = 4.5
Scaled
by 1.125 to 6x6
![Page 23: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/23.jpg)
3 x 1.17 = 3.51
Scaled
by 1.17 to 6x6
![Page 24: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/24.jpg)
2 x 1.25 = 2.5
Scaled
by 1.25 to 6x6
![Page 25: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/25.jpg)
Let P be a mm pattern and T an nn text.
How many different scaled patterns of P are there?
![Page 26: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/26.jpg)
Claim
There are ≤ nm different scaled patterns representing all the occurrences of P.
![Page 27: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/27.jpg)
mm, (m+1)(m+1), … , nn
n-m different possible sizes
…
Each one has at most m possible matrices representing it
Proof:
![Page 28: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/28.jpg)
Each one has at most m possible matrices representing it
Proof:
Why?
![Page 29: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/29.jpg)
Distance = 1
![Page 30: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/30.jpg)
…
…
… …
Pattern P scaled to size k×k,
…
…
… …
)k)×(½-k(½-
…
…… …
)k)×(½+k(½+
![Page 31: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/31.jpg)
1
![Page 32: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/32.jpg)
Therefore
There are ≤ nm different scaled patterns representing all the occurrences of P.
![Page 33: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/33.jpg)
Algorithm outline for 2-D scaled matching
![Page 34: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/34.jpg)
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.
![Page 35: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/35.jpg)
Space and Time Analysis
mm, (m+1)(m+1), … , nn
Dictionary size O(n3m)
…
Each one has at most m possible matrices representing it
![Page 36: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/36.jpg)
Solution
Our idea is to keep the dictionary in compressed form.
The compression we use is run-length of the rows.
![Page 37: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/37.jpg)
Run-length
aabcccbba2b1c3b2
![Page 38: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/38.jpg)
ABC
DEF
GHI
AABBBCC
AABBBCC
DDEEEFF
DDEEEFF
DDEEEFF
GGHHHII
GGHHHII
ScaledTo 2⅓
The compressed dictionary
![Page 39: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/39.jpg)
AABBBCC
AABBBCC
DDEEEFF
DDEEEFF
DDEEEFF
GGHHHII
GGHHHII
Compressedform
A2B3C22
D2E3F23
G2H3I22
#of repetitions of row
![Page 40: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/40.jpg)
A2B3C22
D2E3F23
G2H3I22
#of repetitions of row
Size of Array: mxm# of diff. scaled patterns: (n-m) x m
Dictionary size: O(nm3)
![Page 41: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/41.jpg)
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.
![Page 42: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/42.jpg)
Example for text searching
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
![Page 43: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/43.jpg)
…c150ba101
aaaaaaaaaa
![Page 44: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/44.jpg)
Look in the text location [1,10]
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
![Page 45: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/45.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
![Page 46: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/46.jpg)
…c150ba101
![Page 47: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/47.jpg)
…c150ba101
aaaaaaaaaab
![Page 48: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/48.jpg)
…c150ba101
aaaaaaaaaabccccccccccccccc…
Look in the text location [1,10]
![Page 49: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/49.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
22
2½2½
![Page 50: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/50.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
A scale
range of
[ 1,1¼(
![Page 51: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/51.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:Last symbol may repeat in the text more time than the scaled pattern need.
![Page 52: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/52.jpg)
What about the number of times the first subrow repeats?
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
![Page 53: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/53.jpg)
The range of [1,1¼) is valid since 102ⅹ1¼=128<132.
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
![Page 54: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/54.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
Look in the text location [1,9]
![Page 55: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/55.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
2½2½
3½3½
![Page 56: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/56.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
A scale
range of
[ 1,¼1¾(
![Page 57: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/57.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
1¾
Too large,it requires the c
to repeat 175 times.c
c150
![Page 58: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/58.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:The range is reduced to
[1,¼1 ( 204101
![Page 59: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/59.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
152
[1,¼1( This is still to large for the vertical scale.
204101
![Page 60: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/60.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:
The maximum scale valid for both horizontal and vertical scales produces the pattern whose first row is a2bc129 and which repeats 132 times.
![Page 61: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/61.jpg)
c100ba
c100ba
.
.
.
c100ba
.
.
.
.
.
.
102
2
1
.
.
.
P:
d150cb10
c150ba10
c150ba10
…c150ba10
.
.
.
.
.
.
.
.
.
.
.
.
…
…
…
.
.
.
.
.
.
.
.
.
.
.
.
1
2
133
132
.
.
.
.
.
.
T:The range is reduced to
[1,¼1 ( 20457
![Page 62: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/62.jpg)
OPEN PROBLEM:
Give algorithm linear in run-length compressed text and pattern.
![Page 63: S C A L E D PATTERN MATCHING](https://reader036.vdocuments.mx/reader036/viewer/2022062408/5681302e550346895d95c1b5/html5/thumbnails/63.jpg)
END