Presentation is loading. Please wait.

Presentation is loading. Please wait.

Symmetry Detection via String Matching Sergey Kiselev Symmetry Seminar Haifa University, Spring 2005.

Similar presentations


Presentation on theme: "Symmetry Detection via String Matching Sergey Kiselev Symmetry Seminar Haifa University, Spring 2005."— Presentation transcript:

1 Symmetry Detection via String Matching Sergey Kiselev Symmetry Seminar Haifa University, Spring 2005

2 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.

3 Definitions - Symmetry  Transform T of an object P = {p 1, p 2,…} is the object T(P) = {T(p 1 ), T(p 2 ),... }.  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.

4 Rotational Symmetry  Rotational transform: R a,b  rotation of b degrees  about d-2 dimensional axis a  Rotational symmetry: symmetry under rotational transform  Rotational symmetry transform: C a,k = R a,360/b  If some object P is symmetrical under C a,k then a is called “k-fold axis of rotational symmetry”

5 Rotational Symmetry 3-fold rotational symmetry 5-fold rotational symmetry

6 Reflectional Symmetry  Involutional transform: Z b,k  rotation 360/k degrees around line b’  reflection about d-1 dimensional axis b  only Z b,1 is defined in 2D space  in 3D most interesting are Z b,1 and Z b,2  Reflectional symmetry: symmetry under involutional transform  If some object P is symmetrical under Z b,k then b is called “k-fold axis of reflectional symmetry”

7 Reflectional Symmetry Reflectional Symmetry Z b,1 Reflectional Symmetry Z b,2

8 Snow Crystals 6-fold rotation symmetry + reflection symmetry

9 Centroid Coordinates of C: The centroid of set of points p 1,…,p m such that every p i has a weight w i > 0, is the unique point C such that C can be computed in O(m) time

10 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.

11 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.

12 Symmetry Detection Cycle property of ORDER: If P is symmetrical under any transform T, such that T(c i ) = c j, then for all k, T(c i + k ) = c j + k Uniqueness property of ENCODE: Encoded strings of two objects P 1 and P 2 have cyclic permutations of each other if, and only if, for some T, T(P 1 ) = P 2.

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

14 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: s i =

15 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:

16 Polygon - ENCODE ENCODE Example: Encoded string: S =,,,,,,, >

17 Polygon - CHECK Finding rotational symmetry Let S = be the encoded cycle of polygon. We search for S in string A: A = 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.

18 Polygon - CHECK Finding rotational symmetry – Example S =,,,,,,, > A =,,,,,,,,,,,,,, > S first occurs in A at offset 1 => Polygon has n/2 = 4-fold rotational symmetry

19 Polygon - CHECK Finding reflectional symmetry Let R = be the reverse encoded cycle of polygon. We search for R in string B: B = 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

20 Polygon - CHECK Finding reflectional symmetry – Example R =,,,,,,, > B =,,,,,,,,,,,,,,, > Match occurs at offsets: 1, 3, 5, 7 Polygon has 4 axes of reflectional symmetry that bisect vertices P 3, P 2, P 1, P 0 respectively. Note: since we found that polygon has n/k-fold rotational symmetry, its enough to check only k first symbols of R.

21 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)

22 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.

23 2D Point Set - ORDER 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. In practice such algorithm may have serious problem

24 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 =

25 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 (k 1, k 2, …, k m )

26 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)

27 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.

28 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.

29 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 (k 1, k 2, …, k m ) Segments symmetry test has same complexity like point set – O(nlogn)

30 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.

31 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).

32 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.

33 Polyhedron - ORDER C 1 – cycle containing vertices topologically adjacent to point of intersection with axis. Each point in C k+1 is edge-connected to some point in C k. A point can be edge-connected to several points in C k. To distinguish one of these edges for each point in C k+1 we’ll use function D(p j, p i ) whose value is three-tuple of Cartesian coordinates of the point p i in the coordinate system whose origin is at p j, whose Z-axis is parallel to axis of rotation, and whose Y-axis intersects the axis of rotation.

34 Polyhedron - ORDER Value of function D is unique for all edges adjacent to p j, and symmetrical points have exactly the same set of values for their adjacent points. Thus for each point p j in C k+1, we distinguish the adjacent point p i in C k, which has lexicographical minimum value for D(p j, p i ). This defines mapping under which each point in C k+1 maps exactly to one point in C k. 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.

35 Polyhedron - ENCODE Each vertex of polyhedron can be encoded as tuple containing: Coordinates of this vertex (p j ) – Cylindrical angle coordinate – Radius coordinate – Z-coordinate List of adjacent vertices (p i ) – Sorted in clockwise order – Given by D(p j, p i ) value

36 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 v i, v i,1, v i,2, … v i,k i be the element of i-th tuple. Encoded string is: 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).

37 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

38 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.

39 Polyhedron – Axes of Symmetry (2,3,3) - Four 3-fold lines and three 2-fold lines, arranged as in regular tetrahedron

40 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

41 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

42 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

43 “ 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.

44 “ 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(n 4 logn).

45 “ Near ” Symmetry Minimal Symmetric Decomposition Problem Minimal Symmetric Partition Problem Strip patterns

46 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

47 Questions?

48 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 ppt "Symmetry Detection via String Matching Sergey Kiselev Symmetry Seminar Haifa University, Spring 2005."

Similar presentations


Ads by Google