# Rectilinear Pattern Recognition

Document Sample

```					Rectilinear Pattern Recognition

Dan J. Nardi
Masters Thesis
April 11, 2003
Index of Topics

   Introduction of Problem
   Target & Chip Model
   Algorithms
   Overlay
   Search
   Graph Model
   Recursion for ‘deep compare’
   Conclusion
Introduction of Problem

   IBM needs help

   Need algorithm to find all occurrences of a
simple pattern within larger pattern
   Data describes geometric layout
   Uses only rectilinear shapes
Target & Chip Model

   Smaller pattern is our
‘target’
Target & Chip Model

   Larger pattern is our ‘chip’
Algorithms

   Program broken into two parts

   Read in data and optimize (overlay)

   Perform search (deep compare)
Algorithms

   Read data into appropriate data structures
   Vertex table
   Edge table
   Face table

   Shapes are on different layers that overlap

   Needed to ‘flatten’ representation
Overlay Algorithm

   Have:

   Want:
Overlay Algorithm

   We used the Plane Sweep Algorithm
   Computational Geometry: Algorithms and Applications by M. de
Berg et al [pages 20 – 38]

   Start at highest horizontal edge
   Go to next highest, and so on
   Keep track of active vertical edges
   Test for intersection(s)
Plane Sweep Algorithm
Plane Sweep Algorithm
Plane Sweep Algorithm

Intersection Found
Plane Sweep Algorithm

Intersection Found
Plane Sweep Algorithm
Overlay Algorithm
get all horizontal edges and sort into list

for each horizontal edge in list
{
remove inactive vertical edges;    //active edges now above activeH
add active vertical edges;         //vert. edges starting @ activeH

for each active vertical edge
{
test_intersection(activeH, activeV);
if(intersection == true)
update tables with new values;
}
}
Search

   Ready to compare target & chip data
   Can be solved with recursion
   But where to start?
   Target ‘key’
   Face in target with the largest # edges
   Most unique  more definitive search
Search

   Now that we have starting point

   How to search
   Requires a lot of memory
   Depth-first search
   Less memory needed
   Need a finite tree to search
Depth-first Search
Depth-first Search
Depth-first Search
Depth-first Search
Depth-first Search

Can throw away this sub-tree
Graph Model

   Now we need to represent the patterns in such a
way that we can use one of these searches
   Visualize a tree
   Root node is target ‘key’
   Each neighboring face becomes a child node
   Recursively iterate through pattern
Graph Model
f1

f1
e         f2                f3
f2        f3

f4

e          f4       e        f4
e

e                 e

Abstract Tree
Graph Model

   Don’t need to represent multiple shared edges
   Mark faces & edges as ‘visited’ once checked

f1

e   e   e   f3   f3     f3        e   f2        f2   f2   e   e

Concrete Tree (repetitive edges)
Recursive ‘Deep Compare’

   Use recursion on abstract trees

Deep Compare Algorithm
get list of possible matches (those equivalent to target key)

for each face in list
{
if(deepCompare(t-key, cface));
keep face in list
}

bool deepCompare(tface, cface)
{
if(tface == cface)
{
do{
new-cface = get next neighbor of cface
new-tface = get next neighbor of tface

if not (deepCompare(new-cface, new-tface))
return false;
}while still have unvisited neighbors;

return true;
}
return false;
}
Search

   If deepCompare is true for possible match
   Then candidate is a final match and is flagged
   Else
   Removed from the list

   At end all matches are flagged
Conclusion

   Algorithm can be adapted for other input data

   We’re allowed conveniences by having
rectilinear shapes (less detail and overhead)

   Using plane-sweep algo. saves on runtime
   Now log(n) not n2
Conclusion

   Good choice for target ‘key’ quickly
decreases search space

   Depth-first search saves on memory
The End

Created: April 4, 2003

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 5 posted: 4/28/2010 language: English pages: 36