- By
**roman** - Follow User

- 157 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Symmetry Detection via String Matching' - roman

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Motivation

Knowledge of the symmetry of object is useful for solving problems in image shape analysis, robotic applications, computer graphics, etc.

We will discus several algorithms that detect symmetry of objects by reducing object from 2D or 3D to string representation while saving symmetry information and check symmetry of result string.

Definitions - Symmetry

- Transform T of an object P = {p1, p2,…} is

the object T(P) = {T(p1), T(p2), ... }.

- P is symmetrical under the transform T,

if T(P) = P.

- A line/plane is an axis of symmetry of an object if the object is invariant to symmetry transform with respect to this axis.

Rotational Symmetry

- Rotational transform: Ra,b
- rotation of b degrees
- about d-2 dimensional axis a
- Rotational symmetry: symmetry under

rotational transform

- Rotational symmetry transform: Ca,k = Ra,360/b
- If some object P is symmetrical under Ca,kthen

a is called “k-fold axis of rotational symmetry”

Reflectional Symmetry

- Involutional transform: Zb,k
- rotation 360/k degrees around line b’
- reflection about d-1 dimensional axis b
- only Zb,1 is defined in 2D space
- in 3D most interesting are Zb,1 and Zb,2
- Reflectional symmetry: symmetry under

involutional transform

- If some object P is symmetrical under Zb,kthen

b is called “k-fold axis of reflectional symmetry”

Snow Crystals

6-fold rotation symmetry + reflection symmetry

Centroid

The centroid of set of points p1,…,pm such that every pi has a weight wi > 0, is the unique point C such that

Coordinates of C:

C can be computed in O(m) time

String matching

String matching algorithm.

KMP – finds in string with length n, substring with length m in O(n+m) time. Infinite alphabet can be used in strings.

Symmetry Detection

Steps of symmetry detection algorithm:

ORDER:

Sort the points of object into cycles.

ENCODE:

Encode each cycle into a string.

CHECK:

Test the symmetry of the encoded string.

Symmetry Detection

Cycle property of ORDER:

If P is symmetrical under any

transform T, such that T(ci) = cj,

then for all k, T(ci + k) = cj + k

Uniqueness property of ENCODE:

Encoded strings of two objects P1 and P2 have cyclic permutations of each other if, and only if, for some T, T(P1) = P2.

Polygon - ORDER

ORDER step is unnecessary for a polygon, since vertices of polygon are already form a valid cycle.

Polygon - ENCODE

ENCODE step generates a two-tuple of measures for each vertex which describes the location of that vertex.

Measures should be invariant under symmetrical transform.

For example:

- Distances between adjacent vertices
- Angles formed by edges at each vertex

So each two-tuple will be:

si = <dist (pi, pi+1), angle (pi-1, pi, pi+1)>

Polygon - ENCODE

Other possibilities: Distances from centroid, angles formed at centroid by two adjacent vertices

Not all combinations give unique encoding.

Example: distances between adjacent vertices and distances from centroid:

Polygon - CHECK

Finding rotational symmetry

Let S = <s0, s1, … ,sn-1> be the encoded cycle of polygon. We search for S in string A:

A = <s1, … ,sn-1, s0, s1, … ,sn-1>

If S first occurs in A at offset k-1 then the polygon must have n/k-fold rotational symmetry.

At least a one-fold symmetry will be found for any polygon – if S is found nowhere else in A it will be found at offset n-1.

Polygon - CHECK

Finding rotational symmetry – Example

S = <<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>>

A = <<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>, <a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>>

S first occurs in A at offset 1 =>

Polygon has n/2 = 4-fold

rotational symmetry

Polygon - CHECK

Finding reflectional symmetry

Let R = <sn-1, sn-2, … ,so> be the reverse encoded cycle of polygon. We search for R in string B:

B = <s0, s1, … ,sn-1, s0, s1, … ,sn-1>

If a match found at offset j, and n–j is odd, then there is a axis of symmetry bisecting the angle at p(n-j-1)/2

If n–j is even, axis of symmetry bisects the edge connecting p(n-j-2)/2 and p(n-j)/2

Polygon - CHECK

Finding reflectional symmetry – Example

R = <<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>>

B = <<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>, <a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>,<a,b>,<a,a>>

Match occurs at offsets: 1, 3, 5, 7

Polygon has 4 axes of reflectional symmetry that bisect vertices P3, P2, P1, P0 respectively.

Note: since we found that polygon has n/k-fold rotational symmetry, its enough to check only k first symbols of R.

Polygon - Complexity

ORDER: not needed

ENCODE: O(n)

O(1) for each vertex

CHECK: O(n)

KMP, string and substring length is order of n.

Total: O(n)

2D Point Set - ORDER

It possible to produce a polygon by connecting points sorted by they polar coordinates, taking angle as primary sort key and omitting points at centroid, and using previous polygon symmetry detection algorithm on resulting polygon.

This algorithm has O(nlogn) complexity since it requires sorting.

2D Point Set - ORDER

In practice such algorithm may have serious problem

This makes the algorithm extremely sensitive to round-off errors.

To avoid this problem we’ll partition points to several cycles such that all points in same cycle are at same distance from centroid and sorted by angle.

2D Point Set - ENCODE

In encoded string each point is represented by angle formed at centroid by this point and it’s successor.

Its not needed to include distance from centroid, since it constant within each cycle

Encoded string: A = <h,a,c,a>

2D Point Set – CHECK

The tests to check a cycle for rotational and reflectional symmetry are the same as these for polygons. However they must be applied for all cycles of the point set.

The degree of rotational symmetry for the point set is a greatest common divisor of the orders of the cycles:

k = GCD (k1, k2, … , km)

2D Point Set – Complexity

ORDER: O(nlogn)

Requires generic number sorting algorithm. Such algorithms need O(nlogn) operations.

ENCODE: O(n)

Computing an angle for each point in the point set

CHECK: O(n)

String matching requires O(n).

Finding GCD of m numbers requires O(m) operations, were m is number of cycles, m << n

Total: O(nlogn)

Segments - ORDER

Find centroid of set of midpoints of the segments, when every midpoint has a weight equal to the length of the its segment.

Partition segments to several cycles such that segments in same cycle have equal length, midpoints of all segments are at same distance from centroid and segments are sorted by angle.

Segments - ENCODE

Each segment is encoded as a two-tuple containing angle formed at centroid by midpoint of this segment and midpoint it’s successor, and angle between segment and line passing through centroid and midpoint of segment.

Segments - CHECK

The tests to check a cycle for rotational and reflectional symmetry are the same as these for polygons and point sets.

Like with point sets, tests must be applied for all cycles, and degree of rotational symmetry equals to a greatest common divisor of the orders of the cycles:

k = GCD (k1, k2, … , km)

Segments symmetry test has same complexity like point set – O(nlogn)

Circles and Other 2D Objects

Same symmetry check technique can be applied to other 2D objects.

As we saw above it’s needed to implement correct (such that hold described properties) ORDER and ENCODE steps corresponding to particular object.

For example circles can be partitioned according to distance from they center to centroid, sorted by angle between two circles. Each circle should be encoded by this angle and diameter.

3D Point Set – Axial Symmetry

Problem:

Given an axis and a 3D point set find the rotational symmetry about that axis, and find all planes of reflectional symmetry containing that axis.

This problem is a direct extension of 2D point set problem. Now ORDER step will partition points to cycles not only by their distance from centroid (axis in this case), but also by their Z coordinate. (Z-axis is parallel to axis of rotation).

Polyhedron

Problem:

Given an axis and a polyhedron with connected surface graph find the rotational symmetry about that axis, and find all planes of reflectional symmetry containing that axis.

Observation:

A (nontrivial) axis of symmetry can intersect the surface of a polyhedron in only one of three ways: It may intersect a vertex, the midpoint of an edge, or the centroid of a face.

Polyhedron - ORDER

C1 – cycle containing vertices topologically adjacent to point of intersection with axis.

Each point in Ck+1 is edge-connected to some point in Ck. A point can be edge-connected to several points in Ck. To distinguish one of these edges for each point in Ck+1 we’ll use function D(pj, pi) whose value is three-tuple of Cartesian coordinates of the point pi in the coordinate system whose origin is at pj, whose Z-axis is parallel to axis of rotation, and whose Y-axis intersects the axis of rotation.

Polyhedron - ORDER

Value of function D is unique for all edges adjacent to pj, and symmetrical points have exactly the same set of values for their adjacent points. Thus for each point pj in Ck+1, we distinguish the adjacent point pi in Ck, which has lexicographical minimum value for D(pj, pi). This defines mapping under which each point in Ck+1 maps exactly to one point in Ck.

Exact algorithm which constructs m cycles from vertex set with size n of a polyhedron is given in the literature [1] and has O(n) time complexity.

Polyhedron - ENCODE

Each vertex of polyhedron can be encoded as tuple containing:

- Coordinates of this vertex (pj)
- Cylindrical angle coordinate
- Radius coordinate
- Z-coordinate
- List of adjacent vertices (pi)
- Sorted in clockwise order
- Given by D(pj, pi) value

Polyhedron – CHECK

While previous step uses tuples of variable size to represent different vertices, it still possible to run CHECK algorithm in linear time.

Let vi, vi,1, vi,2, … vi,ki be the element of i-th tuple.

Encoded string is:

<v1, v1,1, v1,2, … v1,k1 ,v2, v2,1, v2,2, … v2,ki ,vn, vn,1, vn,2, … vn,kn>

For each vertex string contains three point coordinate and for each edge two three-tuple, one for vertex on each end. Total length of string is order of |V| + |E|, which is O(n).

Polyhedron – Axes of Symmetry

- So far, we have considered only polyhedron symmetry about a given axis
- The possible arrangements of nontrivial axes of symmetry is 3D space are fairly restricted
- It possible to find symmetry group by reducing surface graph of polyhedron to either a ring, a skein, or one of the graphs of Platonic solids
- Such reduction doesn’t destroy existing symmetry, but may create new symmetries

Polyhedron – Axes of Symmetry

(k) - One k-fold line of symmetry, as in a regular k-sided cone

- There only one axis of symmetry, which must intersect the polyhedron surface in same place it intersects surface graph.

Polyhedron – Axes of Symmetry

(2,3,3) - Four 3-fold lines and three 2-fold lines, arranged as in regular tetrahedron

Polyhedron – Axes of Symmetry

(2,3,4) - Three 4-fold lines, four 3-fold lines and six 3-fold lines, as in a regular octahedron or hexahedron

Polyhedron – Axes of Symmetry

(2,3,5) - Six 5-fold lines, ten 3-fold lines and fifteen 2-fold lines, as in a regular dodecahedron or icosahedron

Polyhedron – Axes of Symmetry

(2,2,k) - One k-fold line of symmetry and k 2-fold lines of symmetry uniformly spaced in the plane perpendicular to the first line, as in a k-sided regular prism

- This case requires more difficult algorithm, since number of symmetry axes not limited

“Near” Symmetry

- Next figures appear to have some symmetry, but according to our definition have none.
- In some cases we’ll want to find degree of symmetry.

“Near” Symmetry

Maximal Symmetric Subset Problem.

- For each three distinct points p, q, r only one rotation transform maps p to q and q to r.
- For n points there are

n(n-1)(n-2) possible

transform candidates.

- O(nlogn) to check each

candidate.

- Total: O(n4logn).

“Near” Symmetry

Minimal Symmetric Decomposition Problem

Minimal Symmetric Partition Problem

Strip patterns

Summary

- Reduction 2D or 3D objects to strings
- Symmetry checking and finding symmetry axes for 2D objects
- Symmetry checking of 3D objects
- Finding axes of symmetry for 3D objects
- “Near” symmetry problem

References

[1]J. D. Wolter, T. C. Woo, and R. A. Volz,“Optimal algorithms for symmetry detection in two and three dimensions,”

Visual Computer, vol. 1, pp. 37-48, 1985.

[2] P. Eades,

“Symmetry finding algorithms,”

Computational Morphology (G. T. Toussaint, Ed.).

Amsterdam: North-Holland, 1988, pp. 41-51.

[3] M.Atallah, “On Symmetry Detection,”

IEEE Trans. Computers, vol. 34, no. 7, 1985

[4] D.E. Knuth, J.H. Morris, and V.R. Pratt,

“Fast pattern matching in strings,”

SIAM J. Comput., vol. 6, no. 2, pp. 323-350, 1977.

Download Presentation

Connecting to Server..