Hierarchical Representation of 2-D Shapes using Convex Polygons: a Contour-Based Approach

Similar documents
Compressing 2-D Shapes using Concavity Trees

Morphological Image Processing

Morphological Image Processing

EECS490: Digital Image Processing. Lecture #23

CLASSIFICATION OF BOUNDARY AND REGION SHAPES USING HU-MOMENT INVARIANTS

Digital Image Processing Fundamentals

Morphological Image Processing

An Efficient Visual Hull Computation Algorithm

Morphological Image Processing

CITS 4402 Computer Vision

Biomedical Image Analysis. Mathematical Morphology

However, m pq is just an approximation of M pq. As it was pointed out by Lin [2], more precise approximation can be obtained by exact integration of t

EECS490: Digital Image Processing. Lecture #17

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

Chapter 11 Representation & Description

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

Lecture 17: Solid Modeling.... a cubit on the one side, and a cubit on the other side Exodus 26:13

Lecture 18 Representation and description I. 2. Boundary descriptors

Morphological track 1

Boundary descriptors. Representation REPRESENTATION & DESCRIPTION. Descriptors. Moore boundary tracking

6 Mathematics Curriculum

Indexing by Shape of Image Databases Based on Extended Grid Files

A Vertex Chain Code Approach for Image Recognition

arxiv: v1 [cs.cc] 30 Jun 2017

Mathematics Curriculum

Image retrieval based on region shape similarity

Topic 6 Representation and Description

Restricted-Orientation Convexity in Higher-Dimensional Spaces

4. References. q h-1. q h

09/11/2017. Morphological image processing. Morphological image processing. Morphological image processing. Morphological image processing (binary)

International Journal of Advance Engineering and Research Development. Applications of Set Theory in Digital Image Processing

morphology on binary images

SHAPE SEGMENTATION FOR SHAPE DESCRIPTION

EXTREME POINTS AND AFFINE EQUIVALENCE

Image representation. 1. Introduction

Introduction. Computer Vision & Digital Image Processing. Preview. Basic Concepts from Set Theory

Code Transformation of DF-Expression between Bintree and Quadtree

Decomposing and Sketching 3D Objects by Curve Skeleton Processing

Mathematical Morphology and Distance Transforms. Robin Strand

Lecture 8 Object Descriptors

ECEN 447 Digital Image Processing

Lofting 3D Shapes. Abstract

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

Geometric Modeling Mortenson Chapter 11. Complex Model Construction

Approximation Algorithms for Geometric Intersection Graphs

1. INTRODUCTION. AMS Subject Classification. 68U10 Image Processing

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

K-structure, Separating Chain, Gap Tree, and Layered DAG

Problem definition Image acquisition Image segmentation Connected component analysis. Machine vision systems - 1

(Refer Slide Time: 00:02:00)

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Section 5.5. Left subtree The left subtree of a vertex V on a binary tree is the graph formed by the left child L of V, the descendents

Central Europe Regional Contest 2016

layers in a raster model

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling

A note on Baker s algorithm

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

EE 584 MACHINE VISION

Lecture 10: Image Descriptors and Representation

Computing Covering Polyhedra of Non-Convex Objects

DDS Dynamic Search Trees

Chapter 3. Sukhwinder Singh

Graphics (Output) Primitives. Chapters 3 & 4

A New Online Clustering Approach for Data in Arbitrary Shaped Clusters

Exercise set 2 Solutions

Course Number: Course Title: Geometry

Robust Shape Retrieval Using Maximum Likelihood Theory

Picture Maze Generation by Repeated Contour Connection and Graph Structure of Maze

Path-planning by Tessellation of Obstacles

My Favorite Problems, 4 Harold B. Reiter University of North Carolina Charlotte

A New Approach to Computation of Curvature Scale Space Image for Shape Similarity Retrieval

Block Method for Convex Polygon Triangulation

A Connection between Network Coding and. Convolutional Codes

Classification and Generation of 3D Discrete Curves

1. Introduction to Constructive Solid Geometry (CSG)

6.001 Notes: Section 4.1

Red-Black-Trees and Heaps in Timestamp-Adjusting Sweepline Based Algorithms

CoE4TN4 Image Processing

Chapter 15 Introduction to Linear Programming

Subset Warping: Rubber Sheeting with Cuts

Symbol Detection Using Region Adjacency Graphs and Integer Linear Programming

Asynchronous Cellular Operations on Gray Images Extracting Topographic Shape Features and Their Relations

EXAM ELEMENTARY MATH FOR GMT: ALGORITHM ANALYSIS NOVEMBER 7, 2013, 13:15-16:15, RUPPERT D

Accepting that the simple base case of a sp graph is that of Figure 3.1.a we can recursively define our term:

Efficient View-Dependent Sampling of Visual Hulls

Einführung in Visual Computing

Minimum-Area Rectangle Containing a Set of Points

Basic Idea. The routing problem is typically solved using a twostep

Preferred directions for resolving the non-uniqueness of Delaunay triangulations

Chapter 4 Concepts from Geometry

CSCI2100B Data Structures Trees

2 Geometry Solutions

Multidimensional Data and Modelling

CONSTRUCTIONS OF QUADRILATERAL MESHES: A COMPARATIVE STUDY

The Ultimate Maths Vocabulary List

Generating All Simple Convexly-Drawable Polar Symmetric 6-Venn Diagrams

The Geometry of Carpentry and Joinery

Transcription:

Hierarchical Representation of 2-D Shapes using Convex Polygons: a Contour-Based Approach O. El Badawy, M. S. Kamel Pattern Analysis and Machine Intelligence Laboratory, Department of Systems Design Engineering, University of Waterloo, Waterloo, ON, N2L 3G1, Canada Abstract A concavity tree is a data structure for hierarchically representing the shape of two-dimensional silhouettes using convex polygons. In this paper, we present a new algorithm for concavity tree extraction. The algorithm is fast, works directly on the pixel grid of the shape, and uses exact convex hull computations. We compare our method to the morphological approach to concavity tree extraction and we report better computational performance and smaller reconstruction errors. Key words: Shape decomposition, shape analysis, shape representation, concavity trees. 1 Introduction Shape is an important feature of a pattern. In the case of binary images, it can be argued that the most prominent feature of the patterns in the image is their shape. Shape can be defined as all the geometrical information that remains when location, scale, and rotational effects are filtered out from an object [1]. A concavity tree is a data structure used for describing non-convex two dimensional shapes. It was first introduced by Sklansky [2] and has since been further researched by others [3 7]. Corresponding author. Email addresses: obadawy@pami.uwaterloo.ca (O. El Badawy), mkamel@uwaterloo.ca (M. S. Kamel). Preprint submitted to Elsevier Science 30 July 2004

1 2 3 1 2 3 (a) (b) (c) (d) (e) Fig. 1. An object (a), its concavities (b,c), meta-concavities (d), and corresponding concavity tree (e). A concavity tree is a rooted tree where the root represents the whole object whose shape is to be analysed/represented. The next level of the tree contains nodes that represent concavities along the boundary of that object. The following level contains nodes, each representing one of the concavities of its parent, i.e., its meta-concavities. If an object or a concavity is itself convex, then the node representing it does not have any children. Figure 1 shows an example of an object (a) and its corresponding concavity tree (e). The object has two concavities, as reflected in level one of the tree. The concavity on the left (b) is convex, so it has no children (i.e., it s a leaf). The concavity on the right (c) is concave, with one convex triangular concavity (d). Typically, each node of a concavity tree stores attributes, or features, describing the underlying object or concavity. Concavity trees are clearly a tool for structural pattern recognition in which a pattern (a 2-D shape in our case) is decomposed into its primitive components. In this paper, we present a new algorithm for concavity tree extraction that takes as input the bilevel image of the object whose shape is to be analysed, extracts its contour, and based on an analysis of that contour, it efficiently extracts a precise concavity tree representing the shape of that object. The result is that the shape of the object is decomposed into its primitive convex components. Moreover, given just this decomposition, and using all primitives, the object can be reconstructed with 100% accuracy. On the other hand, if we just use the larger primitives, the original shape can be reconstructed with good accuracy. We compare our algorithm with the morphological approach to concavity tree extraction [7] and report smaller reconstruction errors and much faster execution speed. An advantage of the proposed algorithm is that it computes the exact convex hull of the shape at hand, as opposed to the morphological algorithm, which approximates the convex hull of shapes. Exact convex hulls are better shape descriptors than approximate ones, a property that can be useful when the primitives are later used for shape recognition. Moreover, the morphological implementation stores (approximate) convex hulls at each node (this is the only information available for it to store.) The proposed algorithm, on the other hand, stores not only (exact) convex hulls, but (optionally) also the 2

exact image of the sub-shape at hand (represented as a list of boundary pixels). This makes it possible to extract any kind of features from each tree node, a property that again is very desirable in later recognition stages. The next section of this paper presents background information about existing shape decomposition algorithms. Section 3 describes the new algorithm in detail. Examples and performance analysis are presented in Section 4 and Section 5 concludes the paper. 2 Background Shape description and representation are very important problems in computer vision and image processing [8]. They constitute the basis for many algorithms in different areas including image and video compression [9,10], and content-based image retrieval [11]. One fundamental approach to shape representation relies on structural pattern recognition techniques where a shape is described in terms of a number of simpler shape primitives. The primitives used in structural pattern recognition have to satisfy certain properties; they have to be simple, well defined, intuitive, compact, and efficiently computed [12]. In recent years, a number of shape decomposition algorithms have been proposed. Many of these algorithms rely on morphological image analysis [12 15]. An advantage of morphological methods is that they have a well-developed mathematical structure, which often translates into simple and compact algorithms. However, a main disadvantage is their computational complexity. This latter disadvantage can be remedied if parallel architectures are used [16]. However, in their absence, morphological algorithms are often impractical for applications that require speed. Concavity trees have been first introduced by Sklansky in relation to the minimum perimeter polygon [2]. Batchelor [3,4] proposed their use in automatic visual inspection of industrial artifacts such as stampings, pressings, and some moldings. In [5,6], parallel and sequential algorithms for concavity tree extraction are presented based on approximate convex hull. Concavity trees are clearly a tool for structural pattern recognition in which a pattern is decomposed into convex polygons. In [7], Xu has proposed a morphological approach to concavity tree extraction. This paper presents a new algorithm for concavity tree extraction based on the analysis of the contour of the shape in the image. The new approach is compared with Xu s morphological algorithm and results are presented. 3

3 The New Algorithm Given the general recursive nature of trees, our algorithm is best outlined using recursion. We start our description with some definitions. 3.1 Definitions Definition 1 A sequence A = [a k ] n k=1 = [a 1, a 2,, a n ] of length n is an ordered collection of elements a k s. The elements of A do not have to be distinct. A subsequence S of a sequence A is formed by discarding some of the elements of A and keeping the other elements in their original order. For a sequence A = [a k ] n k=1, we define A to be the set of all the elements of A (order and multiplicity are ignored, therefore, A n ). Definition 2 Two pixels are said to be direct neighbours if they share a side, and indirect neighbours if they touch only at a corner. The name neighbour denotes either type. Definition 3 A path A = [a k ] n k=1 of length n (n > 1) is a sequence of pixels a 1, a 2,, a n such that for 1 < k n, a k 1 is a neighbour of a k. A direct path refers to a similar sequence but where the pixels are required to be direct neighbours. A closed path is a path whose first and last pixels coincide. A simple path is one where all the pixels are distinct. A simple closed path is a closed path where all pixels are distinct except for the first and last ones. A subpath S of a path A is a subsequence of A that is also a path. Definition 4 A contour of an 8-connected set of pixels S is a path that satisfies all the following conditions: (1) It is closed. (2) It traverses the subset of all pixels in S which have at least one direct neighbour not in S. (3) It does not intersect with itself. (4) Each pixel appears at most twice in the contour. We note that S has many possible contours depending on the direction as well as the starting point of the traversal. Definition 5 The (2-D) convex hull of a set of points S in the 2-D space is the smallest convex polygon enclosing all the points in S. If this polygon has n vertices v 1, v 2,, v n, where v i and v i+1 are adjacent, 1 i < n, then the convex hull can be represented by a sequence H = [h k ] n+1 k=1 where h 1 = v 1, h 2 = v 2,, h n = v n, and h n+1 = v 1. 4

We note that in our definition of the convex hull, S is a set of points, and not a set of pixels. Even though both are represented by 2-D coordinates, a pixel has a finite non-zero area, and is usually approximated by a square, whereas a point has a zero area. We also note that although the convex hull of S is unique, its representation (as a sequence of vertices) is not (depending on the direction and starting vertex). 3.2 Description of the Algorithm The proposed algorithm is based on the following assumptions and premises: (1) The input is a bilevel digital image I, foreground pixels have a value of 1, and background pixels have a value of 0. (2) The set of foreground pixels F is assumed to be 8-connected. (3) The set of background pixels B is 4-connected. The previous 2 assumptions imply that image I contains exactly one object with no holes (Section 4.1 explains how to accomodate objects that contain one or more holes.) (4) It is assumed that the resolution is such that no connected subset of F is less than 2 pixels wide. This will guarantee that each contour is a simple closed path. Algorithm 1 outlines the major steps involved in the concavity tree extraction. The contour C of the object in the image is extracted using the contour tracing algorithm from [17]. It is assumed, without loss of generality, that c 1 = c n is an extreme point of F, therefore, it is guaranteed that c 1 = c n is a vertex of the convex hull of F. The final step in Algorithm 1 represents the core part of the algorithm that recursively constructs the tree. This is achieved by function fconcavitytree() which is explained in Algorithm 2. Algorithm 1 Concavity tree extraction: the main algorithm. Notation: I is the input image, F is the set of foreground ( 1 ) pixels, B is the set of background ( 0 ) pixels, C is the contour of F, T is a rooted tree (the concavity tree), and function fconcavitytree() is explained in Algorithm 2. Require: I is bilevel, F is 8-connected, and B is 4-connected. 1: C Extract contour of F. 2: T fconcavitytree( C ). Each call to fconcavitytree() returns the concavity tree T of its input C. When fconcavitytree() is first called, it is passed the contour C of F (a simple closed 5

Algorithm 2 Concavity tree extraction: fconcavitytree() Notation: T is a rooted tree (the concavity tree), C = [c k ], 1 k n is a contour or a subpath of a contour. H = [h k ], 1 k m is the convex hull of C, A = [a k ], 1 k p is a subsequence of C, S i = [s k ], 1 k l i is a subpath of C, V ij = [v k ], 1 k q j is a subpath of S i, ab is the line segment joining pixels a and b, and d(ab, y) is the length of the normal from y to ab. Function T = fconcavitytree( C ) 1: T = nil 2: AddChild( T, C ). 3: H the convex hull of C. 4: A = [a k ] p k =1 [c k c k H] {All elements of C that are also in H} 5: for i = 1 to p 1 do 6: S i = [s k ] l i k =1 [c k, c k+1,, c k+li 1 c k = a i, c k+li 1 = a i+1 ] {All elements in C starting at a i and ending at a i+1 } 7: Find all j subpaths V ij = [v k ] q j k=1 of S i such that: q j > 2, d(s 1 s li, v 1 ) = 0, d(s 1 s li, v qj ) = 0, and d(s 1 s li, all other v k ) > 0 8: for all V ij do 9: AddChild( T, fconcavitytree( V ij ) ) 10: end for 11: end for path). Any later (recursive) calls are passed (simple) subpaths of the contour of F. When the first call to fconcavitytree() returns, T will be the concavity tree of F. In addition, all nodes in T will contain simple paths except for the root, which will contain the contour of F (a simple closed path). fconcavitytree() in Algorithm 2 starts by initialising T and setting its root to input C. Then the convex hull H of the set of pixels in C is computed using the algorithm in [18]. At each call to fconcavitytree(), c 1 and c n are guaranteed to be two adjacent vertices in the convex hull of C. Therefore, a 1 and a p will be equal to c 1 and c n, respectively. The outer loop in Algorithm 2 works on each section S i of C bounded by two consecutive points in A. The inner loop, on the other hand, works on each (if any) concave section V ij of S i. Each of the V ij s is in turn passed to recursive calls of fconcavitytree(), which will return their corresponding concavity trees to be added as children to the concavity tree formed in the calling function. Figure 2 illustrates the relationship between C, A, S, and V. Part (a) of the figure illustrates the first call to fconcavitytree(), where a whole contour C is passed to the function. The elements of A (a re-ordering of the convex hull of C), the contour section S 2 between a 2 and a 3, and the concavity V 21 of that section are shown to the right. Part (b) of the same figure depicts later calls to f ConcavityT ree(), 6

C is a contour: a 4 a 3 (a) S 2 V 21 c 1 = c n a 1 = a 5 a 2 C A S V C is a simple path: c n a 3 a 4 (b) S 2 c 1 a 2 a 1 V 21 C A S V Fig. 2. Relationship between C, A, S, and V in algorithm 2 where C is now the part of the contour that forms a concavity (i.e., C in part (b) is V 21 in part (a)). Similarly, The elements of A (a re-ordering of the convex hull of C in which the first and last elements are now different), the contour part S 2 bounded by a 2 and a 3, and its concavity V 21 are shown to the right. In line 7 of Algorithm 2, if the coordinates of s 1 and s l are respectively (x 1, y 1 ) and (x l, y l ), then the equation of s 1 s l is given by x y 1 x 1 y 1 1 = 0 (1) x l y l 1 The distance between point v k = (x k, y k ) and the segment s 1 s l is then given by x k y k 1 x 1 y 1 1 x l y l 1 d(s 1 s l, v k ) = (x 1 x l ) 2 + (y 1 y l ) (2) 2 3.3 Computational Complexity Computing the convex hull of n arbitrary pixels requires O(n log(n)) operations. However, if these pixels are the contour of an object, then the convex hull operation requires just O(n) operations [18]. Our algorithm uses the latter method to compute convex hulls of simple paths and simple closed paths. 7

-0.5 Nodes: 13, leaves: 8, height: 3 0 0.5 1 1.5 2 2.5 (a) Original image (b) Concavity tree of (a): 13 nodes, 8 leaves, height = 2 (c) (d) (e) Fig. 3. Artificially constructed shapes (a, c, d, and e) and a concavity tree (b) that illustrate worst-case complexity. In each of the shapes, the total number of contour pixels in each tree level is the same. Extracting the boundary of the object (also known as contour tracing) first requires an initial search in the image for any pixel on the contour, which is done by performing a row by row (or column by column) scan of the image until the first foreground pixel is met. Then, tracing the contour requires O(n) operations. Contour tracing needs to be done once at the beginning. Our algorithm therefore requires O(n) operations to trace the contour, and another O(n) operations to extract the convex hull of the whole object, where n is the number of pixels in the contour. Thereafter, we need O(m) operations to extract the convex hull of each concavity or meta-concavity, where m is the number of pixels in the (meta-)concavity. This translates into a worst case complexity of O((h + 1) n), where h is the height of the resulting concavity tree and n is the number of pixels in the contour. It is worth noting here that h is invariably much smaller than n; carving an extra (meta-) concavity in order to increase h by one will result in many more extra contour pixels. Typically, h is less than ten and n is in the hundreds. Moreover, the worst case complexity of O((h + 1) n) only occurs when the total number of contour pixels in all the concavities of one level in the tree is equal to the total number of contour pixels in all the concavities of the level above it (this number is n). Figure 3 parts (a) and (b) show an example depicting the worst-case complexity of O((h + 1) n) with h = 2. Parts (c), (d), and (e) of the same figure show programmatically constructed shapes that illustrate the case when h is equal to 3, 4, and 5, respectively. In each of the shapes, the number of contour pixels 8

is n. Moreover, the total number of contour pixels in each tree level is the also n. That is, each contour pixel also belongs to one meta-concavity on each level i, where 1 i h. It is worth noting that by visual inspection of the shapes, the height of the tree cannot increase indefinitely. This is because, if n is kept fixed, we cannot decompose the shape without eventually exhausting the concave space inside it. In other words, a factor limiting the number of concavities, and hence restricting h, is that the total area of all concavities is bounded by the finite area of the convex hull of the shape. 3.4 Shape Reconstruction Exact reconstruction of the original image from a concavity tree can be achieved through another recursive procedure. We call a concavity whose level in the tree is odd a white concavity and one whose level in the tree is even (but greater than zero) a black concavity. White concavities are made of background pixels whereas black concavities are made of foreground pixels. A concavity closing edge is the line segment joining the two end points of the contour section defining the concavity. The reconstructed image is initially blank, i.e., all background and hence all zeros. The concavity tree is then traversed in a pre-order way (root first, then children) and at each visited node, a logical operation is performed based on the level of the node as follows (the root is at level zero): If the level of the node is even, including zero, the reconstructed image is logically or ed with the convex image corresponding to the node. This applies to black concavities and to the convex hull of the whole object (i.e., the root of the tree). If the level is odd (white concavity), the reconstructed image is logically and ed with the complement of the convex image stored at the node. In both cases, the result of the logical operation is assigned back to the (partially) reconstructed image. After all the nodes have been visited, the reconstructed image will be readily available. This procedure can be applied directly to the trees generated by the morphological algorithm since at each node, the whole convex image is stored. In the case of the contour-based algorithm, the procedure is a bit more involved. The reason is that only convex hull vertices are stored at each node (as opposed to the whole convex image). Hence, a polygon filling operation is required. Moreover, if the level of the concavity is odd, the convex polygon resulting from the filling is actually slightly bigger than the original corresponding concavity. The procedure of reconstructing the image in the case of the contour-based algorithm is better illustrated by Figure 4. Panel (1) of the figure shows a simple 9

Foreground (dark) pixels have logical value one (1) shape with one concavity and one meta-concavity (2) Contour Only convex hull vertices (the black pixels on the left) are stored in the tree (3) Level 0 (4) Level 1 (5) Level 2 Wrong reconstruction (6) Level 0 filled (7) Level 1 filled (8) Level 2 filled and or = (9) (10) (11) (12) Correct reconstruction (13) Level 0 filled (14) Level 1 filled (15) Level 2 filled and or = (16) (17) (18) (19) Note: Logical AND has higher precedence over logical OR. Foreground (dark) pixels have logical value one. Fig. 4. Image reconstruction. shape with one concavity and one meta-concavity. Note that the convention used here is that foreground pixels have a value of one. The corresponding tree (not shown) is simple and has three levels with one node at each level. The extracted contour of the shape is shown in (2). The black pixels in Panels (3), (4), and (5) are the convex hulls of the shape, the concavity, and the meta-concavity, respectively. Therefore, four pixels are stored at the root of the tree, six in level one, and three in level two. Panels (6) to (12) show the result of reconstructing the image by filling the convex hull polygon at each node and then performing the logical operations outlined above. Clearly, the 10

^ = ^ = (a) Closing edge intersects with pixels that form a path between the two concavity ends (b) Closing edge intersects with disconnected pixels In (a), (b) and (c): First row: original shape and its contour. Second row: convex hull vertices (in black.) Third row: Filling. Fourth row: Logical operation yielding original shape. ^ denotes Logical AND. Foreground (dark) pixels have logical value one. ^ = (c) Closing edge does not intersect with any pixels. Fig. 5. Reconstruction example of simple single-concavity shapes with different slopes for the concavity closing edge. reconstructed image is different from the original one. Panels 13 to 19 show how to fix this problem. At even tree levels, pixels that are on the boundary of the polygon are included in the fill (panels 13 and 15). This is the same filling method used in panels 6, 7, and 8. At odd tree levels, on the other hand, pixels that are on the boundary of the polygon are not included in the fill except for those on the concavity closing edge (excluding the convex hull vertices). This is illustrated in panel 14. Finally, panels 16 to 19 show the correct reconstructed image. We use a modified scan filling algorithm to get the convex image from the convex hull vertices. Scan filling algorithms [17] (also known as edge filling algorithms) consider the line equations of the polygon edges and use parity checks to determine whether a point is in the interior of 11

the polygon or not. This is based on the fact that a straight line intersects any closed curve an even number of times. The filling algorithm can be easily modified so that it takes care of the special polygon filling rules outlined above for convex hulls of white concavities. Figure 5 shows three simple reconstruction examples featuring different slopes for the concavity closing edge. In (a), the closing edge intersects with pixels that form a path between the two concavity ends. In (b), the closing edge intersects with disconnected pixels, and in (c), the closing edge does not intersect with any pixels. 4 Examples and Discussion Figure 6 shows an image (a), its concavity tree (b), and its exact reconstruction (f). The second level of the tree (level one) has 14 nodes corresponding to 14 concavities along the contour of the shape. The contour section corresponding to the sixth node on that level (with the label 6) is shown in (c). Similarly, this last contour section has four concavities (represented by four children in the tree). The contour section corresponding to the first child (labeled 6,1) is shown in (d). The concavity tree has 85 nodes, 45 leaves, and a height of five. 73 of the 85 nodes (around 86%) have an area less than 1% of the total area of the shape. Figure 6(e) shows the 85 convex components (polygons) of the shape. Panel (f) shows the exact reconstruction of the original shape from its 85 convex components. The reconstruction error between the original shape (a) and the reconstructed shape in (f) is 0%. The reconstruction error is based on the number of pixels in the reconstructed image that are not in the original image. Figures 7 and 8 show the result of reconstructing the shape in Figure 6(a) using the largest 4, 8, and 12 components using the proposed contour-based algorithm and Xu s morphological algorithm, respectively. In each of the three cases, we note that the error for the contour-based algorithm is smaller than that of the morphological algorithm. Moreover, the contour-based algorithm is inherently faster than the morphological one. We applied our algorithm to the 13 shapes shown in Figure 9. The shapes are first decomposed into convex sub-shapes, then they are reconstructed using only the largest components in terms of area, and the error between the original and reconstructed images is computed. We applied Xu s morphological algorithm to the same images and compared the number of convex polygons used in the reconstruction and the resulting error for each image. The contour-based algorithm consistently results in smaller errors using approximately the same number of components. On average, the reconstruction error 12

Nodes: 85, leaves: 45, height: 6 0 1 6 2 6,1 3 (a) Original image 4 5 (b) Concavity Tree: 85 nodes, 45 leaves, height = 5 20 20 40 40 60 60 80-10 0 10 20 30 40 50 60 70 80 (c) Concavity #6 80-10 0 10 20 30 40 50 60 70 80 (d) First meta-concavity of concavity #6 10 20 30 40 50 60 70 80-10 0 10 20 30 40 50 60 70 80 (e) Convex hull and concavities (f) Exact reconstruction from all nodes Fig. 6. Illustration of concavity tree extraction. of the contour-based algorithm is 50% smaller than that of the morphological one. Figure 10 shows the average (for all 13 test images) of the reconstruction error as a function of the number of nodes used in the reconstruction. Figure 11 shows that the average execution time (again for all 13 test images) of the contour-based algorithm is an order of magnitude smaller than that of the morphological one. The average execution time is the total of the average 13

Nodes: 4 Error: 0.12 Nodes: 8 Error: 0.07 Nodes: 12 Error: 0.05 Fig. 7. Reconstruction using the largest components. Contour-based algorithm. Nodes: 4 Error: 0.18 Nodes: 8 Error: 0.12 Nodes: 12 Error: 0.07 Fig. 8. Reconstruction using the largest components. Morphological algorithm. 1 2 3 4 5 6 7 8 9 10 11 12 13 Fig. 9. Test images tree extraction and exact reconstruction times. Experiments were conducted on a standard 1.4 GHz single-processor Pentium 4 PC. 14

0.1 0.09 Contour based Morphological 0.08 0.07 Reconstruction error 0.06 0.05 0.04 0.03 0.02 0.01 0 0 2 4 6 8 10 12 14 16 18 20 Number of nodes used in reconstruction Fig. 10. Average reconstruction error for the two algorithms. 35 Morphological Algorithm Contour Based Algorithm 30 Average Execution Time (secs) 25 20 15 10 5 0 1 2 1. Extraction 2. Reconstruction 4.1 Objects with holes Fig. 11. Average execution time for the two algorithms. A simple extension to the proposed algorithm will make it able to handle the decomposition of objects with one or more holes. An object with a hole is naturally decomposed into two components: the filled object, and the hole. If the hole is then treated as an object and decomposed and/or reconstructed using the same techniques presented so far, a logical xor between the original 15

image and all its holes will reconstruct the original shape. We can use one tree per object or hole, or just attach the hole trees to the object tree. Since all operations will be repeated for each hole, the complexity will be multiplied by the number of holes inside the object. Which is very small compared to the number of contour pixels. 5 Conclusion This paper presents a new algorithm for concavity tree extraction. The new method directly works on the pixel grid of the shape and is based on an analysis of its contour. Using our algorithm, the shape of a 2-D object is decomposed into convex polygons based on exact convex hull computations. If all the convex components are used to describe the object, the original shape can be exactly reconstructed. On the other hand, if the largest convex components are used, the original shape can be reconstructed with high accuracy and we would just use a few number of components to describe the object. Our method outperforms the morphological implementation of concavity trees. This representation scheme can be used in structural shape description, analysis, and recognition. References [1] D. Kendall, The diffusion of shape, Advances in Applied Probability 9 (1977) 428 430. [2] J. Sklansky, Measuring concavity on a rectangular mosaic, IEEE Transactions on Computers C-21 (1972) 1355 1364. [3] B. Batchelor, Hierarchical shape description based upon convex hulls of concavities, Journal of Cybernetics 10 (1980) 205 210. [4] B. Batchelor, Shape descriptors for labeling concavity trees, Journal of Cybernetics 10 (1980) 233 237. [5] G. Borgefors, G. Sanniti di Baja, Methods for hierarchical analysis of concavities, in: Proceedings of the International Conference on Pattern Recognition, Vol. 3, 1992, pp. 171 175. [6] G. Borgefors, G. Sanniti di Baja, Analyzing nonconvex 2D and 3D patterns, Computer Vision and Image Understanding 63 (1) (1996) 145 157. [7] J. Xu, Hierarchical representation of 2-D shapes using convex polygons: A morphological approach, Pattern Recognition Letters 18 (1997) 1009 1017. 16

[8] S. Loncaric, A survey of shape analysis techniques, Pattern Recognition 31 (8) (1998) 983 1001. [9] Y. Hasan, L. Karam, Morphological reversible contour representation, IEEE transactions on Pattern Analysis and Machine Intelligence 22 (3) (2000) 227 240. [10] P. Salembier, P. Brigger, J. Casas, M. Pardas, Morphological operators for image and video compression, IEEE transactions on Image Processing 5 (6) (1996) 881 897. [11] O. E. Badawy, M. Kamel, Shape-based image retrieval applied to trademark images, International Journal of Image and Graphics 2 (3) (2002) 375 393. [12] I. Pitas, A. Venetsanopoulos, Morphological shape decomposition, IEEE transactions on Pattern Analysis and Machine Intelligence 12 (1) (1990) 38 45. [13] P. Maragos, R. Schafer, Morphological skeleton representation and coding of binary images, IEEE transactions on Acoustics, Speech and Signal Processing 34 (5) (1986) 1228 1244. [14] J. Xu, Efficient morphological shape representation without searching, in: Proceedings of the International Conference on Image Processing, 1998, pp. 262 266. [15] J. Xu, Efficient morphological shape representation with overlapping disk components, IEEE transactions on Image Processing 10 (9) (2001) 1346 1356. [16] H. Park, R. Chin, Optimal decomposition of convex morphological structuring elements for 4-connected parallel array processors, IEEE transactions on Pattern Analysis and Machine Intelligence 16 (3) (1994) 304 313. [17] T. Pavlidis, Algorihms for Graphics and Image Processing, Computer Science Press, 1982. [18] A. Melkman, On-line construction of the convex hull of a simple polygon, Information Processing Letters 25 (1987) 11 12. 17