Image Processing
Length: 1733 words (5 doublespaced pages) Rating: Red (FREE)                                  
Adaptive Shape Contour Tracing Algorithm
ABSTRACT In this paper we are going to present a new shape contour tracing algorithm called ¡§Adaptive Contour Tracing Algorithm¡¨. The algorithm can trace open and closed discontinuous digital shapes and return an ordered set of boundary points that represent the contour of the shape. Unlike other algorithms that return boundary points that are part of the traced shape, our algorithm returns background points that are adjacent to the shape¡¦s contour. Furthermore, the algorithm is not hindered by shapes that are noisy and illdefined as it can adapt to interruptions in the shape¡¦s contour using a preset tolerance and is able to scan multiple neighbors of a given point. The algorithm has a low complexity and no restrictions on the type or size of the traced shape. The extracted ordered set of boundary points represents the contour of a given shape and is important for curvaturebased shape descriptors. Categories and Subject Descriptors I.4.6 [Image Processing and Computer Vision]: Segmentation ¡V Edge and feature detection, Pixel classification General Terms Algorithms. Keywords Image Processing; Contour Tracing; Shape Boundary Extraction. 1. INTRODUCTION Contour tracing is an important process in boundarybased shape matching. All shapes are represented by a pattern of pixels and the contour pixels are usually a small subset of that pattern. Curvaturebased shape matching methods rely on the contour pixels to describe the irregularities in shapes and a reliable contourtracing algorithm is needed to extract the boundary of shapes. If the shape has holes then another hole search algorithm need to be applied to extract the hole pattern and such an algorithm is not part of this article. We developed a sequential contourtracing algorithm denoted the ¡§Adaptive Contour Tracing Algorithm¡¨. The algorithm computes the surrounding contour of any shape and adapts to all types of closed curve representations whether they are filled or partially filled digital shapes. Any pixel, 1pixel wide lines, and full shapes could be traced and represented by closed curves. The algorithm also accounts for discontinuities in the shape contour and can reach nearby pixels. The contour trace starts from the top left point or pixel closest to the shape and proceeds clockwise following the surrounding of the contour of the shape rather than the contour itself. The path around the contour is traced in a lookforward sweep pattern to find the next surrounding point that is closest to the contour. The path is then closed when the start point is found. 2. ADAPTIVE CONTOUR TRACING Input Data: A square tessellation, Q, of Qwidth x Qheight containing cells that belong to the shape and cells that belong to the background of the shape. A Tessellation is a group of cells (pixels in images) that has the same shape and size. Definitions: 1 Each cell is represented by an xy coordinate point p = (x, y) 2 The terms ¡§cell¡¨, ¡§point¡¨ and ¡§pixel¡¨ all refer to the same definition of a cell. 3 Define 8neighbor(cell, direction) as Moore¡¦s neighborhood which is a common concept that defines the 8neighboring cells of any cell as shown in 4 Define iorder neighbor of any cell iorder(cell, direction) as the set of (i*8) cells, where i > 0, that are i1 cells away from that cell. Moore¡¦s Neighbor corresponds to our 1order notation. The 2order neighbor contains 16 cells and 3order neighbor contains 24 cells as shown in Figure 2. 5 Define 4 orientations to read cells around any cell p: (LRDirection, RLDirection, DUDirection and UDDirection) as shown in Figure 3. 6 The topleft cell of Q has (x, y)= (1,1) and the xaxis increases from left to right and the yaxis increases from top to bottom. 7 Let s denotes any shape cell, p denotes any background cell, c and d denote any cell, C and D are the set of cells of iorder around cells c and d respectively. 8 When disregarding 1pixel shapes, Define a stranded point s as a cell where all 8neighbor or 1order cells = p. 9 Define neighborhood tolerance factor T as the maximum iorder where the trace algorithm should keep looking for a contour boundary. Output Data: An ordered sequence P (p1, p2, ¡K, pn) of n contour boundary points. The Algorithm:  Set P to be empty.  From top to bottom and left to right scan the cells of Q until the leftmost shape pixel s1 with (x1, y1) coordinate is found as shown in figure 4.  Insert p1=(x11,y1), left background cell next to s1, in P.  Set startpoint = p1, previouspoint = p1, currentdirection = DU, iorder = 1  Set p2 = getNextPoint (1, p1 , DU) and Insert p2 in P.  Set n = 3  While true do (Comment: Scan all iorders up to maximum tolerance T) For i = 1 to T Set pn = getNext (i, pn1 , pn2) If pn = p1 then exit while loop If pn is not empty Then Insert pn in P Set n = n+1 Exit For Loop End If Next i End While Function getNext Input Parameters: iorder i, currentpoint, previouspoint Output Parameters: nextpoint Begin (Comment: the direction of movement is switched between the four directions depending on the increase and decrease in the x and y coordinate values of the previous and current points) If currentpoint.x > previouspoint.x Then nextpoint = getNextPoint (i, currentpoint, LRdirection) Else If currentpoint.x < previouspoint.x Then nextpoint = getNextPoint(i, currentpoint, RLdirection) Else If currentpoint.x = previouspoint.x Then If currentpoint.y > previouspoint.y Then nextpoint = getNextPoint(i, currentpoint, UDdirection) Else If currentpoint.y < previouspoint.y Then nextpoint = getNextPoint(i, currentpoint, DUdirection) End If End If End Function getNext Function getNextPoint Input Parameters: iorder i, currentpoint, currentdirection Output Parameters: nextpoint Set nextpoint=empty Begin Set C = iorder(currentpoint, currentdirection) For n = 1 to (i*8) where cn „¡ C (Comment: if cn is a background cell then in order to use it as a boundary point it must have an iorder background cell and the later must have an 8neighbor shape cell that is not stranded  if stranded checking is enabled) If (cn = p) Then Set D = 8neighbor(cn, currentdirection) For m = 1 to 8 where dm „¡ D If (dm = s) and (s is not stranded) and (cn not traced before) Then Set nextpoint = cn Set cn to be traced Exit For End If Next m End If Next n End Function getNextPoint 3. COMPARISONS WITH OTHERS There were many contour tracing algorithms proposed in the literature such as the Square Tracing Algorithm [1][2], MooreNeighbor Tracing [3], Radial Sweep [4] and Pavlidis Algorithm [5]. All of the available contour tracing algorithms return contour points that belong to the shape rather than the surroundings of the shape. They are also concerned with continuos contours where all contour pixels need to have a an 8neighbor shape pixel. Our algorithm does not look for a shape contour cell in the 8neighbor cells of the current cell like other algorithms but rather it looks in the 8neighbor cells of each of the iorder cells of the current cell in the current direction (Figure 5) and tries to find an adjacent shape contour cell to a potential background cell. In other words, we look in the 1order and 2order cells of the current cell at the same time. This concept is what makes it immune to discontinuities in the shape¡¦s contour as it can jump over openings in the contour. The current pixel does not belong to the shape¡¦s contour but rather to its surroundings. The selected direction depends on the xy coordinates of the current and previous background cells traced as defined in getNext function. The start up direction of the start point is DUdirection as there is no prior point. Our algorithm can handle discontinuous contours by adapting to a specified neighborhood tolerance as shown in the traced shape of Figure 6. The neighborhood tolerance specifies how far to look for a contour pixel from the current position. The algorithm is not restricted to the 8neighbor pixels of a pixel but rather it can look forward to other neighbors as the 16neighbor and 24neighbor pixels. This algorithm has the power to trace shapes such as a thin line that is 1pixel wide or shapes that contain only 1 pixel or 2 pixels as shown in Figure 7. To trace a 1 pixel shape, the check for stranded point has to be disabled. Stranded points are pixels in the background that are cut off from the shape pattern.. Tracing 1pixel is possible due to tracing the surroundings of the shape rather that the contour of the shape. Figure 8 shows a variety of shapes traced with our algorithm. The algorithm is robust and not calculation intensive. The time complexity of the algorithm is O(n) where n is the number of shape contour pixels. 4. SUMMARY AND CONCLUSION The adaptive contour tracing algorithm presented the new concept of tracing the surrounding of the shape rather than the contour itself. This concept has the advantage of tracing any closed or open shape even if it was a single pixel. The algorithm can also trace distorted and disconnected boundaries since it is not using the surrounding 8neighbors of pixels but rather the 8neighbors of each of the 8neighbors of the current pixel. This concept needs to be enhanced to resolve these 2 issues: 1) The failure to differentiate between open gaps and actual contour convex as shown in figure 9 as the 1 pixel gap in the contour of the camel was not a discontinuity but the algorithm did not have any logic to differentiate between an opening in the contour and following the contour. One solution to this might be to use a contour extraction algorithm like the Canny Algorithm and the addition of logic to insure that all the contour pixels returned by the Canny Algorithm has been traced. 2) The failure to trace very small shapes of around 10 pixels as the returned trace could be coarse and may not reflect the actual shape as shown in figure 10. 5. REFERENCES [1] A. Rosenfeld, ¡§Digital Topology,¡¨ American Mathematical Monthly, pp. 621630, vol. 86, 1979. [2] A. Rosenfeld, R. A. Melter, ¡§Digital Geometry,¡¨ The Mathematical Intelligencer, pp 6972, vol. 11, No. 3, 1989. [3] R. C. Gonzalez and R. E. Woods. Digital Image Processing, 2nd ed., Prentice Hall, Upper Saddle River, NJ. 2002. [4] F. P. Preparata and M. I. Shamos. Computational Geometry: An Introduction. SpringerVerlag, New York, NY, 1985. [5] T. Pavlidis. Algorithms for graphics and image processing. Computer Science Press, Rockville, MD, 1982. How to Cite this Page
MLA Citation:
"Image Processing." 123HelpMe.com. 24 Jul 2016 <http://www.123HelpMe.com/view.asp?id=71072>. Related Searches
Keywords:
