Convergent Tangent Estimator for Discrete Objects Based on Isothetic Covers

Corresponding Author: Yumnam Surajkanta Computer Science and Engineering, National Institute of Technology, Silchar, India Email: ysurajkanta@gmail.com Abstract: In this article, we propose a tangent estimation method for discrete object based on isothetic covers. We introduce a concept of maximal isothetic straight segments as a maximal segment of isothetic covers that are linearly separable. A new tangent estimator is proposed as a function of maximal isothetic straight segments. Upper bound for the tangent estimator are derived and show that it tends toward the directions of the tangents of the underlying real curve as we reduce the grid size. We show how consecutive isothetic tangents are related to the convexity of the isothetic covers. The new tangent estimator is optimal i.e., linear to the number of given points and shows good performance in the presence of noise.


Introduction
Estimation of geometric properties of discrete objects plays an important role in computer vision and image processing. Tangent is one of the fundamental but often neglected geometrical properties of discrete objects and found use in a number of applications ranging from perimeter, shape estimation to convexity analysis, object recognition, etc. (Šukilović, 2015;An et al., 2011;Coeurjolly and Klette, 2004;Prasad and Leung, 2012;Lenoir et al., 1996;Stojmenovic and Žunić, 2008). For example, the rate of change of the directions of tangents is used to approximate the curvature of discrete curves (Vialard, 1996;Worring and Smeulders, 1993;Asada and Brady, 1986). Tangent are also used in the estimation of the length of the perimeter of a digital object (Ellis et al., 1979), description of curves (Özuysal, 2019), structure estimation (Marin et al., 2015). Tangential covers are also used to extract countours from noisy images (Ngo et al., 2017).
One of the problems in determining the geometrical properties of discrete objects is that a discrete object has an infinite number of euclidian counterparts. Therefore, it is needed to make assumptions about the shapes of the underlying euclidean objects before determining the geometrical properties.
One way to approximate tangents is to fit a continuous curve around the point of interest and find the derivative of the curve. However, such a method put restrictions on the type of underlying curves and shapes and the size of the local region. Lewiner et al. (2005) used the least-square method to fit parametric curves around the discrete points. Coeurjolly et al. (2001), use osculating circles to describe discrete curves and the curvature at a point is given by the inverse of the radius of the circle associated with the local region to which the point belongs.
Smoothening techniques like gaussian filter can be applied to discrete curves and tangents are estimated from the smoothened continuous curves (Mokhtarian and Mackworth, 1986). Another method is to use global optimization techniques to approximate discrete curves with one of the continuous curves from a family of various types (Kerautret and Lachaud, 2008). Discrete line segments are also used in the estimation of tangents of a curve. Kim et al. (2002), in their article divides curves into small segments and each of the sub-curves is approximated by line segments. A tangent at a point on the curve is given by the slope of line segment associated with the region. Matas et al. (1995), select 2M neighbours around the point of interest and tangent is estimated as the median direction of the vectors directing from the 2M neighbours to the point of interest. Some of the methods for determining the derivative of discrete curves are based on the integral invariants. It involves moving an appropriate kernel along the curves and finding the integrals of the curve inside the kernel (Coeurjolly et al., 2013;Lin et al., 2010). Prasad et al. (2011), propose a tangent estimation based on the geometrical properties of elliptic curves and the method can be extended to other conic sections (Prasad et al., 2014). Lachaud et al. (2007), in their articles fits discrete line segments around the point of interest and tangent is calculated as the weighted average of the slopes of the lines around the point.
In this article, we propose a tangent estimating method based on isothetic covers of discrete objects. Isothetic covers provide a simple yet useful abstraction of objects. Information content of the isothetic covers are a function of grid size and can be adapted based on the applications. Our tangent estimator is based on the properties of line segments that can be fitted between the isothetic covers of discrete objects and show that the tangent estimator is multi-grid convergent and linear to the number of discrete points in the object. The abstraction of boundaries of the objects by isothetic covers makes our tangent estimator robust and less vulnerable to noise distortion.

Isothetic Cover
Deftnition 1 {Isothetic Polygon} Isothetic polygon is a simple polygon whose alternating sides are from two disjoint sets, one containing a collection of horizontal lines, H and the other containing a collection of vertical lines, V.
If the lines in H and V are equally spaced then the isothetic cover is called a regular isothetic polygon otherwise it is called an irregular isothetic polygon. Here, we will be dealing with only regular isothetic polygons and by isothetic polygon, we refer to a regular isothetic polygon. The distance between two consecutive lines in H or V is called grid size, denoted by g and intersection point between a line in H and a line in V is called a grid point. Such grid point forms the vertex of isothetic polygons. A grid cell, µ, is formed by intersections of pairs of consecutive lines from H, (h i , h i+1 ) and V, (v j , v j+1 ) and we use grid centre, µ c , to denote the centre of the grid cell µ.
Isothetic cover is a minimum area isothetic polygon which covers a digital object S. It can be defined as a union of grid cells which either partially or fully intersect S. Depending upon whether each grid cell lies completely within S, isothetic cover I can be classified as an outer isothetic cover or an inner isothetic cover.

Deftnition 2
{Outer Isothetic cover} Outer Isothetic cover, I (S), is an isothetic polygon where each grid cell, µ i , belonging to the cover either fully or partially lies inside S: {Inner Isothetic cover} Inner isothetic cover, I(S) is an isothetic polygon where each grid cell, µ i , belonging to the cover lies completely inside S: It can be shown that only grid cells with partial intersection lie between the inner isothetic cover and the outer isothetic cover of objects: We assume grid cells between the isothetic covers are ordered in an anti-clockwise order and use I i,j to denote a segment of outer isothetic cover along with its corresponding inner isothetic cover segment where i and j are the first and the last indexes of the grid cells that lie between them.

Deftnition 4
{Isothetically Straight Segment} A pair of outer isothetic cover and inner isothetic segment, I i,j , is said to be isothetically straight if there exists a euclidean line that can lie between the two covers without intersecting them.
Our definition of isothetic straight segments is equivalent to the notion of digital straightness as given in Kovalevsky (1990), which states that a discrete curve is digitally straight if the centres of pixels on either of the curve are separable by a straight line. Equivalently digital lines are defined as a set of integer points satisfying η ≤ Mx − Ny < η + |M | + |N | with slope given as / M N where M, N, η are integers (Debled-Rennesson and Reveilles, 1995). In the view of the digital straightness, isothetically straight segment can be redefined as below.

Deftnition 5
A pair of outer isothetic cover and inner isothetic cover segment I i,j is said to be isothetically straight with slope M N and shift η if the grid centres between the isothetic covers satisfy the inequalities where η, M, N are integers and g is the grid size. The real lines which bound the grid centres in isothetically straight segments from above are called upper leaning lines and similarly, the real lines which bound the grid centre from below are called lower leaning lines. In the first quadrant,

Deftnition 6
{Maximal Segment} An Isothetic segment, I i,j , is called a maximal isothetic straight segment iff the following properties hold (i) I i,j is isothetically straight (ii) There are no euclidean lines that can fit in the isothetic segments I i−1,j and I i,j+1 .

Tangent Istimator
Our tangent estimator is based on the maximal isothetic straight segments that passed through a grid cell that lies between the isothetic covers of an object. It is possible for successive grid cells that lie between the isothetic covers to have the same set of maximal isothetic segments. Therefore, it is necessary to take into consideration the position of the grid cell in each maximal segment. We use relative positioning to take into account of the position of the grid cell within a maximal segment. The tangent at a point, c k µ , where c k µ is the centre of the grid cell, µ k , is given by the linear combination of the slope of the maximal segments that pass through the grid cell scaled by the relative position of the grid cell within each segment.
All the maximal segments defined around the object are indexed in anti-clockwise order, L i = I mi , ni where I m i,ni is the ith maximal straight isothetic segment in anticlockwise order. It can be seen that there is a minimum of one maximal isothetic segment passing through each grid cell of the isothetic covers. Let ( ) k µ L be the set of maximal segments that go through a grid cell µ k and α i be the slope of the ith isothetic segment L i . The relative position of a grid cell, µ k , in a maximal segment, L i , is calculated as (Lachaud et al., 2007):

Deftnition 7
The Isothetic Tangent direction at point c k µ is given by the linear combination of the slope of the maximal isothetic segments that pass through grid cell µ k : where, Λ is a triangular function with maximum at Since the set of maximal isothetic segments for a grid cell is never empty, the isothetic tangent is always defined for a given point. Though the Equation (1) estimates slope of the tangent at each grid centre that lies between the isothetic covers, it can be extended to include any real points on the line joining the grid centres. Isothetic covers and the corresponding maximal isothetic segments of a disk are illustrated in Fig. 1.

Isothetically Convex
An object is said to be isothetically convex if the convex hull of its isothetic cover does not contain any grid points which are not part of the cover. Since our tangent estimator is based on grid centres, we adapted the definition of isothetic convexity so that it is based on grid centres. Object S is isothetically convex if the convex hull of the grid centres of the isothetic cover does not contain any grid centres which are not part of the isothetic cover. It can be seen that convexity of grid centres of an isothetic cover is same as the convexity of the grid points of the isothetic cover. In other words, if the grid centres of an isothetic cover form a convex set then the grid points of the isothetic cover also form a convex set. An object, S, is isothetically convex if it satisfies the following Equation: where, H (P) is the convex hull of the points set P and I' (S) is the complement of the isothetic cover of S. The following lemmas relate the isothetic convexity and the successive slopes of the maximal isothetic segments around an object. We use B i (or U i ) to denote the lower leaning line (or the upper leaning line) of ith maximal isothetic segment L i and P Bi , Q Bi (or P Ui , Q Ui ) to denote the first and the last grid centres on B i (or U i ).

Lemma 1
Let the slopes of maximal isothetic segments, L 1 , L 2 , ..., L m defined for object S be non-decreasing. Then we have

Proof
Let B i and B i+1 be the lower leaning lines of L i and L i+1 and V be the intersection point between the two. Since the lower leaning lines bounds grid centres in the lower half of the isothetic covers from below and have non decreasing slopes, we have Q P + and V is enough to show that the polygonal curve π bounds grid centres in ( ) I S from below. They are illustrated in Fig. 2.
If there is a grid centre V ' in the triangle, then it is possible to construct isothetic straight segment L' such that V ' is on its lower leaning line and the intersection of L' and L i or L' and L i+1 is not empty. Thus there exists a maximal isothetic segment between L i and L i+1 with the grid centre V ' on its lower leaning line, contradicting the fact that L i and L i+1 are consecutive.

Theorem 1
S is isothetically convex if and only if the slopes of its maximal isothetic segments arranged in an anticlockwise order (clockwise order), are non decreasing (non increasing).

Proof
We will consider only the lower half of the isothetic covers in the proof and the result can be easily extended to the upper half of the isothetic cover.  Let assume that the object S is isothetically convex. Let L i and L i+1 be any two consecutive maximal isothetic segments with decreasing slope. Then, there is atleast one grid centre between the line joining

Theorem 2
An object is isothetically convex if and only if the isothetic tangents defined around the object in an anticlockwise order (or clockwise order) have non decreasing(non-increasing) slopes.

Proof
For the proof, it is sufficient to show that the isothetic tangents defined around the object have non decreasing slopes whenever the slopes of the maximal isothetic segments are non-decreasing. Since triangular function Λ is semi-differentiable at 1/2 and we are traversing around the object in only one direction, we will discuss only the right derivative of ( ) k α here. Right derivative of the isothetic tangent w.r.t k can be expressed as: Let us assume that slopes of the maximal isothetic segments are non-decreasing. Then, we have to show that ∂ + αˆ (k) is non negative. Since α i -α j is less than or equal to 0 for any pair of isothetic segments, L i and L j with i < j, we have to show that: Depending upon the position of µ k in L i and L j , we have the following cases:

Convergence of Isothetic Tangent Estimator
One of the desirable properties of a discrete tangent estimator is the asymptotic convergence. In this section, we show that isothetic tangent direction converges toward the real tangent direction as the grid size gets smaller. Though the result is shown only for convex shape, it is applicable to concave shape as well.
The length of a maximal isothetic segment depends on the local curvature of the object where the segment is defined. The following lemma relates the length of maximal isothetic segments with the radius of a circular disk.

Theorem 3
The upper bound for the lengths of isothetic segments that can be defined for a circular disk with radius r is where g is the size of the grid.

Proof
The thickness of an isothetic segment cannot be greater than

Theorem 4
Let K be a point on the boundary of convex object S. Then the slope of any maximal isothetic segment that passed through the grid square that contains K approaches the slope of the tangent at K as the grid size g tends toward zero.

Proof
Let L be a maximal isothotic segment with slope α that cover K. Let also assume that K is the origin and L is located in the first octant. Let d be the abscissa of the grid centre that is located in the right end of the segment and M be a point on the boundary of S with x-coordinate x M = d. And f (x) be the function which describes the boundary of S.
If h is the vertical thickness of the isothetic segment L, then the maximum distance of K or M from the leaning lines of L is h + g/2. Then we have: Using the taylor expansion, we can express f (d) as: From Equation (5) and (6), we have: Assuming the boundary countour is non linear, it can be approximated locally by a circle of radius r. Therefore d can be written as some constant fraction of ( ) which also approaches zero as g tends toward zero. Hence Lim g→0 α = f ′ (0). The linear part of the boundary can also be proved in the similar fashion by ignoring the second and the higher degree terms in the taylor expansion. Thus the slope of the maximal isothetic segment tends toward the real slope of the curve at point K as the grid size tends toward zero.

Theorem 4
Let K be a point on the boundary of convex object S. Then the slope of isothetic tangent estimated at the centre of grid square that contains K approaches the slope of the real tangent at K as the grid size g tends toward zero.

Proof
Let α(K) be the slope of the real tangent at K and c k µ be the centre of the grid cell that contains K. ( ) k µ L be the set of maximal isothetic segments that pass through the grid cell that contains K. Then the slope of the isothetic tangent estimated at c k µ is given as: is the set of isothetic segments that pass through the grid cell that contains K, the slope of every maximal isothetic segment in ( ) k µ L tends toward α(K) as the grid size approaches zero. Since ( ) K α is a linear combination of slopes in ( ) k µ L and the coefficients of slopes sum to one, the direction of the isothetic tangent at c k µ tends toward α(K) as the grid size approaches zero.

Complexity of Isothetic Tangent Estimator
The computation of isothetic tangent is based on finding the next maximal isothetic segment from the preceding maximal segment in incremental updates. If The algorithm finds the next maximal isothetic segment by deleting from the beginning of the current segment until it is possible to include the next grid centre in the other end. Then the algorithm extends the end of the segment until it is no longer possible to include the next grid centre and remain isothetically straight. The complexity of the algorithm depends on the deletion and the addition operations of a grid centre to an isothetically straight segment. We show in the following paragraphs that it is possible to add or delete a grid centre from an isothetically straight segment in constant time.
Algorithm 1 compute_next maximal_isothetic_segment (m k ; n k ) 1: n k+1 = n k +1; m k+1 = m k +1 2: while ( Addition of a grid centre to an isothetically straight segment is based on the incremental Reveilles's algorithm (Debled-Rennesson and Reveilles, 1995). Whether it is possible to extend the segment I i, j with properties (M, N, P U , Q U , P B , Q B , η) to the next grid centre, ) are updated depending on the following cases: • If 0 ≤ R ≤|M| + |N|−1, then I i,j+1 is an isothetically straight segment and the properties of the segment remain same as I i,j .
• If R = −1, then I i,j+1 is isothetically straight and properties are updated as • If R = |M| + |N|, then I i,j+1 is isothetically straight and properties are updated as Feschet has shown in their article (Feschet and Tougne, 1999) that update of a digital straight line after a deletion can be done in constant time. Figure 3 illustrates the deletion of a grid centre, µ i , from the isothetic segment I i,j . Deletion of the starting grid centre causes an update in the properties of the isothetic segment only if the grid centre is on one of the leaning lines. As it can be seen from Fig. 3 g can be added to I i+1,j without causing an update in the properties of the segment. The properties of the new segment, I i+1,j are derived from A. The Table 1 summarise the update after a deletion.
Since the update to the isothetically straight segment can be done in constant time, the computation required for finding all the maximal isothetic segments is linear to the number of grid cells between the isothetic covers. Thus the complexity of isothetic tangent estimator is linear to the number of grid cells between the isothetic covers of the object.

Results
Isothetic tangent estimator is implemented in C and is evaluated against various digital objects using different grid sizes. Figure 4 shows the maximal isothetic segments defined for a disk of radius 20 and grid sizes g = 4 and g = 1. It can be observed that as the grid size reduces, the average number of maximal isothetic segments which pass through a given cell increases and the accuracy of the tangent estimation at a grid centre depends on the number of isothetic segments passing through the grid cell. Figure 5a shows the graph of theoretical tangents directions of a disk plotted against the directions of isothetic tangents both expressed in polar coordinates. It can be seen that both of them increase monotonically with the direction of the position vectors of the points and maximum deviations of isothetical tangents from theoretical ones occur at multiples of π/2. This is expected as the regions have the least density of isothetic segments per grid cells. Figure 5b shows the errors in tangent estimations for g = 1, 2 and 4. It can be observed that errors in tangent estimations decrease with reduction in grid size and it agrees well with the theoretical prediction that isothetic tangents converge toward the directions of the real tangent as grid size tends toward zero. Figure 6a shows a disk with eroded edge, simulating a disk distorted by noise and Figure 6b shows the abstraction of the distorted edge with isothetic covers. Dependence of Isothetic Tangent Estimator on isothetic covers makes it less vulnerable to distortion compared to other tangent estimators which work directly with pixels. Figure 7 shows the plot of isothetic tangents for the distorted disk against the theoretical tangents of a circle and the second figure compares the errors in tangent estimations between the distorted disk and the undistorted disk.
It can be observed that estimated tangents for both disks are more or less same albeit with a bit more variations in the distorted disk. Table 2 shows the errors in tangents estimation for some common curves using our method and the estimation of tangents by approximating curves with linear isothetic segments. The first column contains the test images using which the comparisons are done and the second column contains the grid size using which the isothetic covers are constructed for the comparison test. The three columns under each of the methods contain the maximal error, mean of the errors and the measure of the spread or the standard deviation of the errors for each test run. Several observations can be made from the values in Table 2. It can be observed that the maximal error and the spread of the errors generally increased with the grid size.    However, for the linear approximations, error in measurement depends on the position of the line segments approximating the curves and the increase in errors with the increase in grid size is not always true while the errors strictly increase with the grid size in isothetic tangent estimations. Another observation is that the isothetic tangent estimation has lower errors in measurements than the linear approximation for a given grid size and in both the methods, errors in tangent estimations increased with the increase in curvature of the test object.

Conclusion
We have presented a method for tangent estimation based on the isothetic covers of objects. Isothetic covers provide a simple yet useful abstraction of an object and reduce the number of points we have to deal with by a factor of grid size. Information content and resolution of isothetic covers depend on the grid size and can be adjusted depending on the application requirements. Abstraction of edges with isothetic covers makes our tangent estimator robust in the presence of noise. We use maximal isothetic segments to estimate the local properties of an object and isothetic tangents are given as the weighted linear combination of maximal isothetic segments. We have shown that isothetic tangent estimator is multi-grid convergent and successive isothetic tangents directions are related to the convexity of the objects.
We have proved that complexity of isothetic tangent estimator depends linearly on the number of grid points of the isothetic cover and shown that experimental results agree well with the theoretical predictions.
Tangent estimation of a discrete curve has a variety of applications and one particular application of discrete tangent estimation is the curvature estimation of discrete objects. Geometrical primitives like circles, ellipses etc. have distinct curvature patterns and it can be used in object recognition. For the future work, we would like to explore the digital geometry problem of shape determination using curvature estimation based on isothetic segments.