10
A fast convex hull algorithm with maximum inscribed circle affine transformation Runzong Liu, Bin Fang n , Yuan Yan Tang, Jing Wen, Jiye Qian College of Computer Science, Chongqing University, Chongqing 400030, PR China article info Article history: Received 5 May 2011 Received in revised form 31 August 2011 Accepted 5 September 2011 Communicated by Y. Yuan Available online 22 September 2011 Keywords: Convex hull Computational geometry Affine transformation Point pattern Shape analysis abstract This paper presents a fast convex hull algorithm for a large point set. The algorithm imitates the procedure of human visual attention derived in a psychological experiment. The merit of human visual attention is to neglect most inner points directly. The proposed algorithm achieves a significant saving in time and space in comparison with the two best convex hull algorithms mentioned in a latest review proposed by Chadnov and Skvortsov in 2004. Furthermore, we propose to use an affine transformation to solve the narrow shape problem for computing the convex hull faster. & 2011 Elsevier B.V. All rights reserved. 1. Introduction Convex hull is a fundamental construction for computational geometry [1]. It makes possible solving many other problems, for example, half-space intersection, Delaunay triangulation, linearly separability analysis [2], image registration [3], natural computa- tion [4], and pattern recognition [5,6]. Convex hull algorithms are widely used in geographic information systems, and they are also used in astrophysics data system [7]. The notion of convex hull is defined in the following ways [1]: Definition 1. Region D, which belongs to space E 2 , is called convex if for any two points d 1 and d 2 , which belong to D, segment d 1 d 2 entirely belongs to D. Definition 2. A convex hull of a point set S, which belongs to space E 2 , is a boundary of the smallest convex region in E 2 , which surrounds S. There are two variants of the convex hull problem [8]: Problem 1. A set S is given in E 2 , which contains N points. The task is to pick out those points, which are the vertexes of the convex hull. Problem 2. A set S is given in E 2 , which contains N points. The task is to build a convex hull of these points (i.e. to find the boundary CH(S)). Problem 2 can be easily solved by solving Problem 1. Here we only consider Problem 1. There are many different convex hull algorithms, for example, Granham scan algorithm [9], Andrew algorithm [10], Quickhull algorithm [11], and Datta and Parui’s algorithm [12]. All of the above algorithms are widespread, while Quickhull algorithm and Andrew algorithm are the two best algorithms in a latest review of convex hull algorithms [8]. Recently, there are also some studies on convex hull algorithm [1316]. Each of the studies made a valuable contribution to a particular field of convex hull algorithm. A latest literature [17] proposed an algorithm com- posed of two existing algorithms, i.e. Quickhull and Granham scan algorithm. We call it as QuiGran algorithm below. The study reported that QuiGran performed better than Quickhull as an improved version of the Graham scan algorithm. The common architecture (see Fig. 1) of convex hull algorithms can be deduced by a more common one (see Fig. 2), with each component defined as follows: Initial convex hull: The initial convex hull can be a starting point (Granham scan algorithm), or points for partitioning (Andrew algorithm, Quickhull algorithm). The initialization is easy but important for the algorithm efficiency. Point location: Point Location can be sorting the points (Graham scan algorithm), or locating the points to specific partitions (Andrew algorithm, Quickhull algorithm). Point comparison: Point comparison is to compare the query point with some threshold to decide whether the point is a vertex of the convex hull. The thresholds might be different for different algorithms, for instance, whether the angle is greater Contents lists available at SciVerse ScienceDirect journal homepage: www.elsevier.com/locate/neucom Neurocomputing 0925-2312/$ - see front matter & 2011 Elsevier B.V. All rights reserved. doi:10.1016/j.neucom.2011.09.011 n Corresponding author. Tel.: þ86 23 65112784; fax: þ86 23 65102502. E-mail addresses: [email protected], [email protected] (B. Fang). Neurocomputing 77 (2012) 212–221

A fast convex hull algorithm with maximum inscribed circle affine transformation

Embed Size (px)

Citation preview

Page 1: A fast convex hull algorithm with maximum inscribed circle affine transformation

Neurocomputing 77 (2012) 212–221

Contents lists available at SciVerse ScienceDirect

Neurocomputing

0925-23

doi:10.1

n Corr

E-m

journal homepage: www.elsevier.com/locate/neucom

A fast convex hull algorithm with maximum inscribed circleaffine transformation

Runzong Liu, Bin Fang n, Yuan Yan Tang, Jing Wen, Jiye Qian

College of Computer Science, Chongqing University, Chongqing 400030, PR China

a r t i c l e i n f o

Article history:

Received 5 May 2011

Received in revised form

31 August 2011

Accepted 5 September 2011

Communicated by Y. Yuanproposed by Chadnov and Skvortsov in 2004. Furthermore, we propose to use an affine transformation

Available online 22 September 2011

Keywords:

Convex hull

Computational geometry

Affine transformation

Point pattern

Shape analysis

12/$ - see front matter & 2011 Elsevier B.V. A

016/j.neucom.2011.09.011

esponding author. Tel.: þ86 23 65112784; fa

ail addresses: [email protected], newmaybetrue@

a b s t r a c t

This paper presents a fast convex hull algorithm for a large point set. The algorithm imitates the

procedure of human visual attention derived in a psychological experiment. The merit of human visual

attention is to neglect most inner points directly. The proposed algorithm achieves a significant saving

in time and space in comparison with the two best convex hull algorithms mentioned in a latest review

to solve the narrow shape problem for computing the convex hull faster.

& 2011 Elsevier B.V. All rights reserved.

1. Introduction

Convex hull is a fundamental construction for computationalgeometry [1]. It makes possible solving many other problems, forexample, half-space intersection, Delaunay triangulation, linearlyseparability analysis [2], image registration [3], natural computa-tion [4], and pattern recognition [5,6]. Convex hull algorithms arewidely used in geographic information systems, and they are alsoused in astrophysics data system [7].

The notion of convex hull is defined in the following ways [1]:

Definition 1. Region D, which belongs to space E2, is calledconvex if for any two points d1 and d2, which belong to D,segment d1d2 entirely belongs to D. � Definition 2. A convex hull of a point set S, which belongs to

space E2, is a boundary of the smallest convex region in E2,which surrounds S.

There are two variants of the convex hull problem [8]:

Problem 1. A set S is given in E2, which contains N points.The task is to pick out those points, which are the vertexes ofthe convex hull. � Problem 2. A set S is given in E2, which contains N points. The

task is to build a convex hull of these points (i.e. to find theboundary CH(S)).

ll rights reserved.

x: þ86 23 65102502.

163.com (B. Fang).

Problem 2 can be easily solved by solving Problem 1. Here weonly consider Problem 1.

There are many different convex hull algorithms, for example,Granham scan algorithm [9], Andrew algorithm [10], Quickhullalgorithm [11], and Datta and Parui’s algorithm [12]. All of theabove algorithms are widespread, while Quickhull algorithm andAndrew algorithm are the two best algorithms in a latest reviewof convex hull algorithms [8]. Recently, there are also somestudies on convex hull algorithm [13–16]. Each of the studiesmade a valuable contribution to a particular field of convex hullalgorithm. A latest literature [17] proposed an algorithm com-posed of two existing algorithms, i.e. Quickhull and Granham scanalgorithm. We call it as QuiGran algorithm below. The studyreported that QuiGran performed better than Quickhull as animproved version of the Graham scan algorithm. The commonarchitecture (see Fig. 1) of convex hull algorithms can be deducedby a more common one (see Fig. 2), with each component definedas follows:

Initial convex hull: The initial convex hull can be a startingpoint (Granham scan algorithm), or points for partitioning(Andrew algorithm, Quickhull algorithm). The initialization iseasy but important for the algorithm efficiency. � Point location: Point Location can be sorting the points (Graham

scan algorithm), or locating the points to specific partitions(Andrew algorithm, Quickhull algorithm).

� Point comparison: Point comparison is to compare the query

point with some threshold to decide whether the point is avertex of the convex hull. The thresholds might be different fordifferent algorithms, for instance, whether the angle is greater

Page 2: A fast convex hull algorithm with maximum inscribed circle affine transformation

Fig. 1. The common architecture of a convex hull algorithm.

Fig. 2. The common architecture of solving a problem.

R. Liu et al. / Neurocomputing 77 (2012) 212–221 213

than or equal to p (Graham scan algorithm, Andrew algorithm)or whether the point is inside a triangle (Quickhull algorithm).

Fig. 3. The locations of points in Lemmas 2 and 3.

Renew the convex hull: The renewal of a convex hull can bemade by adding a new vertex to the original convex hullvertex set (Graham scan algorithm), or by merging severalconvex hull vertex subsets into a bigger convex hull vertexsubset or the whole convex hull vertex set (Andrew algorithm,Quickhull algorithm).

The initialization of the convex hull can be achieved by somesimple calculations for the extreme points of the point set, e.g.point with max x coordinate. Besides, only several points need tobe processed to renew the convex hull. Therefore, the main spentof a convex hull algorithm is the spent of point location and pointcomparison which are two basic query processes for every convexhull algorithm. One merit of human recognition procedure isvisual attention [18]. When human tries to find the convex hull ofa point set, he or she only pays attention to the points near theboundary. Most inner points are neglected by him or her usingthe information of an initial estimation of the boundary of thepoint set. The initial estimation of the boundary is achieved by theobservation of some extreme points of the point set, which alsobelong to the vertex set of the convex hull of the point set. On thisaccount, we should use the information of the extreme points of apoint set to reduce the computation of point location and pointcomparison as much as possible. However, most of the currentconvex hull algorithms have not fully or efficiently utilized theinformation of the extreme points of a point set. In this paper, theproposed algorithm, i.e. the visual-attention-imitation convexhull algorithm (VAICH), makes a big advance on the usage ofinformation of the extreme points of a point set.

The rest of the paper is organized as follows. Before proposingvisual-attention-imitation convex hull algorithm (VAICH), somemathematical lemmas about convex hull are discussed in Section2. In Section 3, our approach VAICH is proposed. In Section 4, weestablish Maximum Inscribed Circle Affine Transformation (MICAT)to solve the narrow shape problem for computing the convex hull

faster. The experimental results about VAICH and MICAT arepresented in Section 5. Section 6 finally provides the conclusions.

2. Mathematical basis for visual-attention-imitation convexhull algorithm

Lemma 1. Given a point set S, the centroid O of S is inside the convex

hull of S.

Proof. S¼ ½S1,S2, . . . ,Sn� is a point set. ½A1,A2, . . . ,Ah� is the vertexset of the convex hull of S. Then, the necessary and sufficientcondition for a point A inside the convex hull is

A¼ r1A1þr2A2þ � � � þrhAh,

Xh

i ¼ 1

ri ¼ 1, riZ0: ð1Þ

From the definition of convex hull, we know that any point

from point set S is inside the convex hull, that is

Si ¼ ri1 A1þri2 A2þ � � � þrih Ah,

Xh

j ¼ 1

rij ¼ 1, rij Z0, i¼ 1;2, . . . ,n: ð2Þ

If O is the centroid of the point set S

O¼ ðS1þS2þ � � � þSnÞ=n: ð3Þ

ð2Þ&ð3Þ )

O¼ ro1A1þro2

A2þ � � � þrohAh,

roi¼ 1=n

Xn

j ¼ 1

rji , i¼ 1;2, . . .h,

rjiZ0) roi

Z0,

Xh

i ¼ 1

roi¼Xh

i ¼ 1

1=nXn

j ¼ 1

rji

0@

1A¼ 1=n

Xn

j ¼ 1

Xh

i ¼ 1

rji ¼ 1: & ð4Þ

Since (4) satisfies (1), O is inside the convex hull.

Lemma 2. Let E be a point of a point set S, and O be the centroid of S,A and B be two vertexes of the convex hull of S, and the direction from

O to E intersect with the segment AB at point D. If segment OE is

shorter than the distance from O to AB then E is strictly inside the

convex hull of S.

Proof. From the definition of convex hull, the segment AB

entirely belongs to the convex region. Since D is a point of thesegment AB, D is inside the convex hull. From Lemma 1, we alsoknow that the centroid O is inside the convex hull. Therefore, thesegment OD entirely belongs to the convex region (see Fig. 3). Ifsegment OE is shorter than the distance from O to AB, OE isshorter than the segment OD. Because D is a point on the directionfrom O to E and OE is shorter than the segment OD, E is inside the

Page 3: A fast convex hull algorithm with maximum inscribed circle affine transformation

R. Liu et al. / Neurocomputing 77 (2012) 212–221214

segment OD. In view that the segment OD entirely belongs to theconvex region, E belongs to the convex region. Therefore, E isinside the convex hull. &

Lemma 3. Let E be a point of a point set S, O be the centroid of S, and

V be a sub set of the convex hull of S, which surrounds O. OMIN is the

shortest distance among the distances from O to the borders of V. If

segment OE is shorter than OMIN then E is strictly inside the convex

hull of S.

Proof. Let A,B be two neighboring vertexes of V. If segment OE isshorter than the shortest distance among the distances from O tothe borders of V, OE is shorter than the distance from O to theborder AB (see Fig. 3). From lemma 2, E is inside the convexhull. &

Lemma 4. Let point A and point B be two intersections of a line and

two edges of the convex hull of a point set S. Let the centroid O

of S locate at the origin, and the equation of the line AB be

axþbyþc¼ 0,co0. U is the set of points of S which satisfy the

inequality axþbyþc40 (see Fig. 4). If p is the point which

maximizes the function f ðx,yÞ ¼ axþbyþc among the points of U

then p is strictly a vertex of the convex hull of S.

Proof. Assume the contrary and consider all the possible casesaccording to the amount of vertexes of the convex hull whichbelong to U. Because U is not null, there is at least one vertex ofthe convex hull between A and B.

One case is that there is only one vertex C of the convex hull

between A and B. Apparently, p is inside the triangle ABC, otherwise,

p is outside the convex hull. Since p is inside the triangle ABC, C is

farther from the line AB than p. That is to say, the value of function

f ðx,yÞ ¼ axþbyþc at point C is larger than that at point p. But p is

the point which maximizes the function f ðx,yÞ ¼ axþbyþc among

the points of U, so it is impossible unless p is C.

The other case is that there are more than one vertex of the

convex hull between A and B. Consider such two neighboring

vertexes C and D of the convex hull between A and B, and p is

located between the direction from O to C and the direction from

O to D (see Fig. 4). Noticed that because C and D are the

neighboring vertexes of the convex hull, p is inside the triangle

CDO, otherwise p is outside the convex hull. Because p belongs to

U and p is inside the triangle CDO, P is inside the polygon ABCD. If

CD is not parallel to AB, C or D is farther from the line AB than p,

that is to say, p is not the point which maximize the function

f ðx,yÞ ¼ axþbyþc, so it is impossible. If CD is a parallel with AB

and p is not on the segment CD, both C and D are farther from the

line AB than p, so it is also impossible. The only possible case is

that CD is parallel to AB and p is on the segment CD. However, in

this case, p is also a vertex of the convex hull. &

Therefore, p is strictly a vertex of the convex hull.

Fig. 4. The locations of points in Lemma 4.

Lemma 5. The vertex set of the convex hull of a given point set S is

the point set P such that, for each point p of P, there is a direction

from which p is the farthest point among the points of S.

Proof. From Lemma 4, we can easily deduce that if there exist adirection from which a point p of S is the farthest point among thepoints of a point set S, p is strictly a vertex of the convex hull of S.Now, we just need to prove that for a vertex p of the convex hull,there is a direction from which p is the farthest point. And we givesuch a direction below. Points A, B are vertexes of the convex hull,and they are the neighboring vertexes of p. Let p locate at theorigin, the equation of the line AB be axþbyþc¼ 0,co0. Point p0

is the vertex of the convex hull which maximizes the functionf ðx,yÞ ¼ axþbyþc. The direction through p0 parallel to AB is adirection from which p is the farthest point. &

3. Visual-attention-imitation convex hull algorithm (VAICH)

Provided that you are asked to find the convex hull of a pointset, how will you finish the task? According to our psychologicalexperiment with 10 persons, when we try to find the convex hullof a point set, some extreme points are firstly found out as aninitial convex hull. Then we neglect inner points by the centroidof the point set, exclude inner points near the boundary of theinitial convex hull and only pay attention to points by theboundary of the initial convex hull. And then the inner pointsattached to the boundary are analyzed. The procedure goes onuntil the whole convex hull is finally found out. Our algorithmimitates this procedure of human visual attention (see Fig. 5).

Step 1. Calculate the initial convex hull: Since the vertex set ofthe convex hull of a given point set S is the point set P such that,for each point p of P, there is a direction from which p is thefarthest point among the points of S (see Lemma 5), we cancompute a fixed number of such points to form an initial convex

Fig. 5. Flow chart of visual-attention-imitation algorithm which imitates the

procedure of human visual attention.

Page 4: A fast convex hull algorithm with maximum inscribed circle affine transformation

Fig. 7. Partitions of point set divided by visual-attention-imitation algorithm.

R. Liu et al. / Neurocomputing 77 (2012) 212–221 215

hull. Although the whole convex hull can be found out bycomputing all of such extreme points, it is similar to the gift-wrapping algorithm [19] and Graham scan algorithm, which isbeyond the scope of this paper. Since there may be someduplicate points among the extreme points, for example, thepoint with maximum x coordinate and the point with maximum y

coordinate may be duplicate, the initial convex hull we found maybe a segment if we only compute extreme points from two differentdirections. In order to ensure that the initial convex hull has at leastthree non-collinear vertexes, we should compute extreme pointsfrom at least four different directions. The following eight extremepoints of the point set can be found out by simple calculations: pointwith maximum x coordinate, point with minimum x coordinate,point with maximum y coordinate, point with minimum y coordi-nate, point that maximizes the function f�ðx,yÞ ¼ x�y, point thatminimizes the function f�ðx,yÞ ¼ x�y, point that maximizes thefunction f þ ðx,yÞ ¼ xþy, point that minimizes the functionf þ ðx,yÞ ¼ xþy. x and y in the above functions are respectively thex coordinate and the y coordinate. These eight extreme pointsconstitute the vertexes of the initial convex hull. But beforecalculating them, a translation should be applied on the point setto make the centroid of S locate at the origin so as to make sure thatthe centroid of the point set locates inside the initial convex hull,which is required for the following steps.

Step 2. Threshold A: neglect inner points by the centroid: Thedistance from each border of the initial convex hull to thecentroid O is calculated respectively. We name such a distanceas partition distance. The shortest partition distance is named asOMIN. If the distance from a point to the centroid is shorter thanOMIN, the point is inside the convex hull and it will be neglected(see Lemma 3). It is quite good that point location is not neededfor threshold A, while it is a basic and time-consuming queryprocess for every point for other convex hull algorithms and thefollowing thresholds of this algorithm (see Fig. 6).

Step 3. Threshold B: exclude inner points near the boundary of the

convex hull. If there is no duplicate among the eight extremepoints mentioned above, the initial convex hull contains eightborders. The eight convex hull borders and the centroid O divide

Excluded by Threshold Ain Step 2

Excluded by Threshold Bin Step 3

Excluded by Threshold Cin Step 4

Border of theinitial convex hull

Vertex of theinitial convex hull

Fig. 6. Illustration of steps 2, 3 and 4 of v

the point set into eight partitions (see Fig. 7). If the distance froma point to O is shorter than the partition distance of the partitionwhich the point locates in, the point is inside the convex hull, andit will be excluded (see Lemma 2 and Fig. 6). It is useful forefficiency improvement that we can directly compare the dis-tances from the points to O with the partition distance withoutany other computation in threshold B.

Step 4. Threshold C: analyze inner points attached to the boundary.

O is the centroid, A,B are two neighboring vertexes of the convexhull, we call the partition between the direction from O to A and thedirection from O to B as partition ABO. If a point locates at thepartition ABO, it will be checked if it is inside the triangle ABO. If it isinside the triangle ABO, it will be excluded (see Fig. 6). If it is outsidethe triangle ABO, it will be put into a data set corresponding to itspartition for the following process.

Step 5. Renew the convex hull. Each data set derived from Step4 contains at least one new vertex of the convex hull (see Fig. 7).We find the new vertex by calculating which point of this set isfarthest from the border of the convex hull in the correspondingpartition (see Lemma 4). After renewing the convex hull, wedivide the corresponding partition by the direction from thecentroid O to the new vertex and we get two new partitions.Correspondingly, we get two new data sets from the original dataset in the corresponding partition (see Fig. 7). The new data setsare processed by Step 3, Step 4 and Step 5 recursively until nonew data set is derived.

isual-attention-imitation algorithm.

Page 5: A fast convex hull algorithm with maximum inscribed circle affine transformation

−4

−2

0

2

4

6

8

R. Liu et al. / Neurocomputing 77 (2012) 212–221216

Theorem 1. The convex hull found by the visual-attention-imitation

convex hull algorithm is the convex hull of the input point set S.

Proof. From the algorithm, we know that all the points from S

have been processed. And from Lemmas 1 to 3, we know that allthe points excluded by the algorithm are inside the output convexhull. From Lemma 5, we know that all the output points of thealgorithms are vertexes of the convex hull of point set S. Besides,all the output points of the algorithms are points from S, theconvex hull found by the algorithm is a boundary of the smallestconvex region which surrounds S. Therefore, the convex hullfound by the algorithm is the convex hull of the input pointset S. &

−10 −5 0 5 10−10

−8

−6

Fig. 9. The renewed convex hull and the inscribed circle after a stretching.

4. Maximum inscribed circle affine transformation (MICAT)

In some cases, the shape of the convex hull of a point set isnarrow. In these cases, the radius length of the convex hull’sinscribed circle which is centered at the centroid O of the point setcan be enlarged by an affine transformation which stretches thepoint set through centroid O along a direction q with intensity t

(see Fig. 8). We denote such affine transformation as pðq,tÞ below.In Theorem 2 at the last part of this section, it is proved that suchaffine transformation keeps the convex hull vertex set unchanged.Therefore, if we find the best affine transformation which canmake the area of the inscribed circle maximum compared to thearea of the convex hull among all possible cases, we can excludeas many inner points as possible by the threshold A. This willsimplify the calculation of the convex hull (see Fig. 9). We callsuch a best affine transformation as Maximum Inscribed CircleAffine Transformation (MICAT).

If the transformation maps parallel lines onto parallel lines, itis called affine [20]. Affine transformation has also been applied topoint pattern matching [21] and character recognition [22].

Two dimensions affine transformations [23–25] can be definedas

y1

y2

" #¼

a1

a2

" #þ

k11 k12

k21 k22

" #�

x1

x2

" #:

Here, x and y are respectively the old and new coordinatevectors. The matrix A and K are constant matrixes. A more detailedand pellucid introduction of affine transformation can be found on aweb page [26].

−8

−6

−4

−2

0

2

4

6

−10 −8 −6 −4 −2 0 2 4 6 8 10

stretching direction qintensity t

O

Fig. 8. The initial convex hull and the inscribed circle.

For the affine transformation pðq,tÞ mentioned above, theequation can be specified as

y1

y2

" #¼

k11 k12

k21 k22

" #�

x1�ox1

x2�ox2

" #,

k11 ¼ t � cos2qþsin2q,

k12 ¼ sin q cos q � ðt�1Þ,

k21 ¼ sin q cos q � ðt�1Þ,

k22 ¼ t � sin2 qþcos2 q:

Here, ox is the coordinate vector of centroid O. q is thestretching direction which passes through centroid O. t is thestretching intensity.

And the reverse affine transformation is

y1

y2

" #¼

ox1

ox2

" #þ

k�111 k�1

12

k�121 k�1

22

24

35 � x1

x2

" #,

k�111 ¼ sin2 qþcos2 q � t�1,

k�112 ¼ sin q cos q � ð1�tÞ � t�1,

k�121 ¼ sin q cos q � ð1�tÞ � t�1,

k�122 ¼ cos2 qþsin2 q � t�1:

For MICAT, we have to specify q and t to make the area of theinscribed circle maximum compared to the area of the convexhull. Notice that all the stretching transformations pðq,tÞ can bedecomposed into two orthogonal sub-stretching pðj,t1Þ andpðj:,t2Þ. Here, j is the direction from the centroid O to theintersection D of the inscribed circle and the convex hull edge (seeFig. 10). j: is the direction orthogonal to j. Then we can realizeall the stretching transformations by firstly applying sub-stretch-ing pðj,t1Þ and secondly applying sub-stretching pðj:,t2Þ. In fact,if the stretching pðj,t1Þ has already made the area of theinscribed circle maximum compared to the area of the convexhull, the stretching pðj:,t2Þ will only reduce the area of theinscribed circle compared to the area of the convex hull. There-fore, in order to work out MICAT, we only need to consider substretching pðj,t1Þ, and make q¼j, t¼ t1,t2 ¼ 0. Furthermore, the

Page 6: A fast convex hull algorithm with maximum inscribed circle affine transformation

ii ��

Fig. 10. A part of a convex hull and its inscribed circle. OC is orthogonal to OD.

R. Liu et al. / Neurocomputing 77 (2012) 212–221 217

stretching pðj,t1Þ will make the area of the inscribed circlemaximum compared to the area of the convex hull if and only ifthe inscribed circle has intersections with two or more edges ofthe convex hull. Thus, we only need to calculate all the stretchingintensities ti which satisfy that the inscribed circle has a newintersection with the ith edge of the convex hull while keepingthe original intersection unchanged. The minimum of ti is theanswer for t because it can keep the circle inscribed to thepolygon under the affine transformation while others cannot.

ti can be derived by

ti ¼

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffifficot2 ai�cot2 bi

q:

ai and bi are explained by Fig. 10. In Fig. 10, O is the centroid ofthe convex hull, and D is the intersection of the initial inscribedcircle and the convex hull edge. AB is the ith edge of the convexhull. The point C is the intersection of AB and the directionthrough O orthogonal to OD. ai is the angle of line OC and CD. bi

is the angle of the edge AB and the line OC.The detailed procedure of calculating ti can be found in

Appendix A.Then, MICAT is the affine transformation pðj,tÞ

t¼ arg minðti ¼

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffifficot2 ai�cot2 bi

qÞ:

Note that t can be used to describe how narrow a pointpattern is.

Although the application of MICAT can exclude as many innerpoints as possible by the threshold A and thus save lots ofcomputation, the computation of MICAT should be compensated.Besides, the saving of computation by MICAT depends on howmany additional points can be excluded by the threshold A, andthis depends on the stretching intensity t and the size of the pointset. Therefore, we should choose a threshold for t, e.g. t41:5, andanother threshold for the size of point set, e.g. 200,000. Then, foran unknown point pattern, we can calculate the stretchingintensity t for MICAT on the initial convex hull mentioned abovebefore applying MICAT on the whole point set. If t is more than1.5 and the size of the point set is more than 200,000, we applyMICAT; otherwise we do not apply MICAT.

Theorem 2. The vertex set of the convex hull of a point set will not

change under the affine transformation pðq,tÞ.

Proof. Any affine transformation pðq,tÞ can be decomposed tothree steps of independent transformations:

p¼ tðjðrÞÞ:

Here, r is translation, j is rotation, and t is stretching along thedirection of one of the orthogonal coordinate axis with intensity t.

It is obvious that translation and rotation will not change the

vertex set of the convex hull. Here, we only prove that, for space

of two dimensions, stretching along the direction of y coordinate

axis also keeps the vertex set of the convex hull of a point set

unchanged.

For a 2D space, Eq. (2) mentioned in Lemma 1 can be specified

as

Si ¼ ðxi,yiÞ, Aj ¼ ðAxj,AyjÞ,

xi ¼ rxi1 Ax1þrxi2 Ax2þ � � � þrxih Axh,

Xh

j ¼ 1

rxij ¼ 1, rxij Z0, i¼ 1;2, . . . ,n: ð5Þ

yi ¼ ryi1 Ay1þryi2 Ay2þ � � � þryih Ayh,

Xh

j ¼ 1

ryij ¼ 1, ryij Z0, i¼ 1;2, . . . ,n, ð6Þ

Under stretching t, coordinate x keeps unchanged, while

coordinate y enlarges with intensity t:

xn

i ¼ xi; Axn

i ¼ Axi; ð7Þ

ð5Þ&ð7Þ )

xn

i ¼ rxi1 Axn

1þrxi2 Axn

2þ � � � þrxih Axn

h,

Xh

j ¼ 1

rxij ¼ 1, rxij Z0, i¼ 1;2, . . . ,n:ð8Þ

yn

i ¼ t � yi; Ayn

i ¼ t � Ayi; ð9Þ

ð6Þ&ð9Þ )

yn

i ¼ ryi1 Ayn

1þryi2 Ayn

2þ � � � þryih Ayn

h,

Xh

j ¼ 1

ryij ¼ 1, ryij Z0, i¼ 1;2, . . . ,n:ð10Þ

From (8) and (10), we can see that stretching along the

direction of y coordinate axis also keeps the vertex set of the

convex hull of a point set unchanged. That is to say, the vertex set

of the convex hull of a point set will not change under the affine

transformation p¼ tðjðrÞÞ. &

5. Experimental results

Experiments were carried out on a PC with Intel Pentium1.50 GHz CPU and Windows XP operating system usingMatlab7.4.0.

Six types of data sets were built in experiment to comparevisual-attention-imitation convex hull algorithm (VAICH) withQuickhull algorithm, QuiGran algorithm and Andrew algorithm,which were generated by the following functions in Matlab7.4.0:

mu¼[2 3] SIGMA¼[1 0.5; 0.5 10]S¼mvnrnd (mu, SIGMA, num); (Fig. 11A)S¼unifrnd (0, 1, num, 2); (Fig. 11B)S¼exprnd (5, num, 2); (Fig. 11C)S¼evrnd (1, 2, num, 2); (Fig. 11D)S¼ lognrnd (3, 2, num, 2); (Fig. 11E)S¼ johnsrnd ([�1.7 � .5 .5 1.7], num, 2); (Fig. 11F)

Here, num is the amount of points in the point set S. Functionmvnrnd returns a matrix S of random vectors chosen from themultivariate normal distribution with mean MU and covarianceSIGMA. The functions unifrnd, exprnd, evrnd, lognrnd, and johnsrndreturn a matrix S of random vectors generated from the uniformdistribution, the exponential distribution, the extreme value

Page 7: A fast convex hull algorithm with maximum inscribed circle affine transformation

Fig. 11. Six types of testing data generated by Matlab7.4.0.

Table 1Proportions of points excluded by threshold A and by threshold B in VAICH.

Threshold Data type

mvnrnd

(%)

unifrnd

(%)

exprnd

(%)

evrnd

(%)

lognrnd

(%)

johnsrnd

(%)

Threshold A 72.82 77.97 52.29 91.39 17.86 99.96

Threshold B 16.58 0.53 11.37 5.51 3.01 0.016

R. Liu et al. / Neurocomputing 77 (2012) 212–221218

distribution, the lognormal distribution, and the distribution in theJohnson system respectively.

5.1. Threshold efficiency analysis in six random cases

It is shown that more than 50% of points were excluded bythe threshold A and more than 60% of points were excluded bythe threshold A and B for all the six types of testing data exceptthe lognrnd type in Table 1. For the type of johnsrnd, nearly all thepoints were excluded by threshold A. The biggest advantage ofour algorithm is that threshold A can be used to exclude innerpoints quickly. However, the worst case of the algorithm may bethat a set of points locate in a narrow annulus. In this case,threshold A makes no use.

5.2. Comparison with Quickhull, QuiGran and Andrew in six

random cases

From Table 2, we can see that our algorithm VAICH is muchfaster than Quickhull algorithm, QuiGran algorithm and Andrewalgorithm for all the six types of experiment data, while Quickhullalgorithm is the best algorithm for data of the mvnrnd type andthe unifrnd type in a review of convex hull algorithms [8]. We canalso see that the larger the point amount is, the more saving ofcomputation time VAICH achieves compared to the other algo-rithms. When the point amount is 200,000 in the experiment,

VAICH is about two or three times faster than Quickhull algorithmand about seven times faster than Andrew algorithm for all thesix data types except the lognrnd type. VAICH is also about twotimes faster than QuiGran algorithm when the point amount is200,000. However, since the method of point comparison used inStep 4 of VAICH is the same as that of Quickhull algorithm, thecomplexity of VAICH is the same as the complexity of Quickhullalgorithm which takes Oðn2Þ in the worst case and Oðn log nÞ inaverage [8]. Additionally, a latest literature [27] mentioned that itwould take a long time (several minutes) for the convex hullalgorithms to find the convex hull of a point set of 107 points. Wealso do an experiment to check the computation time of the fouralgorithms when the point amount is 107. The result is shown inTable 3. From Table 3, we can see that VAICH also performs wellfor huge amount of points and it only takes about 10 s to dealwith 107 points, while Quickhull and QuiGran take about 1 minand Andrew algorithm takes over 2 min to deal with 107 points.

Table 4 also shows that VAICH uses less memory space thanAndrew algorithm and QuiGran algorithm. And it can save about20% memory space compared to Quickhull. In fact, both Quickhulland VAICH are recursive algorithms which return correspondingparts of convex hull for given subsets, but the subsets of VAICHare smaller than those of Quickhull. It is because that we considereight vertexes for the initial convex hull of VAICH, while only twovertexes are considered for that of Quickhull. Therefore, manypoints are excluded by the initial convex hull of VAICH and theywill not be included in the subsets, while no point can beexcluded by the initial convex hull of Quickhull.

5.3. Efficiency analysis with MICAT

In this experiment, the data of type unifrnd was stretchedalong y coordinate axis with intensity t before being processed byVAICH. We can see from Table 5 that when the intensity t forMICAT is more than 1.5, MICAT can make the threshold A excludeabout 30% additional points.

5.4. Efficiency comparison between VAICH with MICAT and VAICH

without MICAT

As shown in Table 6, the application of MICAT results inconsiderable saving of computation time for the convex hull of alarge point set when its size is more than 200,000 and thetransformation intensity t is larger than 1.7. The saving alwaysincreases with the size of the point set while it only increases withthe stretching intensity t in some extent. However, we should alsonotice that when t is 1.28, the application of MICAT has noadvantage although the data size is 800,000. This demonstrates thatthe cost of the computation of MICAT and its application on thepoint set may be over the saving of computation by MICAT forVAICH. It supports the analysis and the suggestion in the lastparagraph above the Theorem 2 in Section 4.

Page 8: A fast convex hull algorithm with maximum inscribed circle affine transformation

Table 3Average computation time of convex hull algorithms when the point amount is 107. The unit is second.

Algorithm Data type

mvnrnd unifrnd exprnd evrnd lognrnd johnsrnd

Andrew 136.47 135.04 135.34 134.82 136.60 136.88

Quickhull 24.49 50.29 56.27 27.74 74.47 22.91

QuiGran 23.96 69.37 48.28 25.46 100.55 23.47

VAICH 10.27 12.34 18.42 6.83 28.85 5.72

Table 4Peak memory usage of convex hull algorithms when the data size is 106. The unit is KB. The last line reports the percentages of memory

space saved by VAICH compared to Quickhull.

Algorithm Data type

mvnrnd unifrnd exprnd evrnd lognrnd johnsrnd

Andrew 251,676 252,052 251,976 253,452 254,076 253,784

Quickhull 274,492 283,392 281,884 235,236 293,516 231,224

QuiGran 260,328 226,634 260,723 256,816 278,165 257,204

VAICH 212,360 210,420 213,828 184,876 191,488 192,444

Saving (%) 22.64 25.75 24.14 21.41 34.76 16.77

Table 2Average computation time of convex hull algorithms. The unit is millisecond.

Point Algorithm Data type

amount mvnrnd unifrnd exprnd evrnd lognrnd johnsrnd

50,000 Andrew 753.34 724.88 748.21 740.91 729.22 732.52

Quickhull 243.77 464.45 372.21 216.44 337.86 183.02

QuiGran 200.88 422.06 320.33 216.83 328.12 186.48

VAICH 182.26 220.81 275.99 138.84 296.28 90.51

100,000 Andrew 1427.38 1430.17 1448.24 1425.15 1422.94 1426.49

Quickhull 427.46 872.77 535.01 337.02 519.09 320.51

QuiGran 315.43 813.15 505.15 328.81 449.68 326.19

VAICH 255.57 272.48 372.85 178.32 408.96 156.37

200,000 Andrew 2816.62 2830.74 2828.91 2842.41 2859.53 2838.92

Quickhull 759.45 1606.31 878.20 723.35 1584.18 529.60

QuiGran 553.43 1522.98 783.46 587.80 1323.01 530.79

VAICH 395.63 451.62 525.91 258.66 735.08 215.41

Table 5Proportions of points excluded by the threshold A with MICAT and by the threshold A without MICAT.

Datatype mvnrnd unifrnd

Intensity t 1.77 3.14 4.12 1.5 3 5

No MICAT (%) 67.54 62.57 55.36 52.32 26.12 15.65

MICAT (%) 90.86 97.65 97.25 78.29 78.29 78.29

Table 6Time of computation of convex hull by VAICH with MICAT and by VAICH without MICAT. The unit of the computation time is millisecond.

Datatype mvnrnd

Size 200,000 400,000 800,000

Intensity t 1.77 3.14 4.12 1.76 2.10 3.17 1.28 2.41 3.37

No MICAT 399.6 399.8 401.5 561.9 563.9 571.6 931.0 917.1 1117.3

MICAT 394.6 336.6 372.1 521.6 507.7 482.6 936.4 754.8 776.9

Saving (%) 1.3 15.8 7.3 7.2 10.0 15.6 �0.6 17.7 30.5

R. Liu et al. / Neurocomputing 77 (2012) 212–221 219

Page 9: A fast convex hull algorithm with maximum inscribed circle affine transformation

R. Liu et al. / Neurocomputing 77 (2012) 212–221220

6. Conclusions

Convex hull plays an important role in pattern recognition andimage processing. In this paper, we propose a convex hull algorithmwhich imitates the procedure of human visual attention. The mainidea behind the proposed algorithm is to exclude the inner pointsinside the inscribed circle directly. Thus, the algorithm can savemuch computation of point location and point comparison. Experi-mental results show that visual-attention-imitation convex hullalgorithm (VAICH) has better performance than Quickhull algorithmand Andrew algorithm which are the two best algorithms in areview [8] in 2004. VAICH is capable to deal with massive point setsand it only takes about ten seconds to deal with 107 points on a PCwith Intel Pentium 1.50 GHz CPU. When recognizing the convex hullof a narrow and large point set, Maximum Inscribed Circle AffineTransformation (MICAT) is designed to make VAICH faster. Thevirtue of MICAT has been proved by the experimental results.Moreover, we also find that the stretching intensity t for MICAT isable to describe how narrow the shape of a point pattern is.

Acknowledgments

This work is supported in part by the National Natural ScienceFoundations of China (60873092, 90820306 & 61173129).

Appendix A. Procedure of calculating ti

In Fig. A1, O is the centroid of the convex hull, and D is theintersection of the original inscribed circle and the convex hull edge;AB is the ith edge of the convex hull; the point C is the intersection ofAB and the direction through O orthogonal to OD; the points D0, A0,and B0 are respectively the new locations of points D, A, and B afterthe stretching transformation with intensity ti along direction OD;the point G is the intersection of OC and the direction through B0

orthogonal to OC; the point F is the intersection of A0B0 and thedirection through O orthogonal to A0B0.

Note that we are looking for the value of ti such that theinscribed circle of center O and radius OD0 touches the side A0B0.Thus we want to have OD0 ¼OF

OD0 ¼ OF: ðA:1Þ

OD0 ¼ ti � OD: ðA:2Þ

OF ¼OC � sinðb0iÞ,b0i ¼+OCB0: ðA:3Þ

ðA:1Þ&ðA:2Þ&ðA:3Þ ) ti � OD¼OC � sinðb0iÞ: ðA:4Þ

ii� i��

,

,

,

Fig. A1. The original convex hull and the new convex hull after an affine

transformation. A referenced figure for calculating ti.

GB0 ¼ ti � GB: ðA:5Þ

tanðb0iÞ ¼ GB0=GC: ðA:6Þ

tan2ðb0iÞ ¼ sin2ðb0iÞ=ð1�sin2

ðb0iÞÞ: ðA:7Þ

ðA:4Þ&ðA:5Þ&ðA:6Þ&ðA:7Þ ) ti ¼

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiðOC=ODÞ2�ðGC=GBÞ2

q: ðA:8Þ

cotðaiÞ ¼OC=OD,ai ¼+OCD: ðA:9Þ

cotðbiÞ ¼ GC=GB,bi ¼+OCB: ðA:10Þ

ðA:8Þ&ðA:9Þ&ðA:10Þ ) ti ¼

ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffifficotðaiÞ

2�cotðbiÞ

2q

: ðA:11Þ

References

[1] F.P. Preparata, M. lan Shamos, Computational Geometry: An Introduction,first ed., Springer-Verlag, New York, 1985.

[2] M. Tajine, D. Elizondo, New methods for testing linear separability, Neuro-computing 47 (2002) 161–188.

[3] R. Minhas, J. Wu, Invariant feature set in convex hull for fast image registration,in: Conf. Proc. IEEE Int. Conf. Syst. Man Cybern., 2007, pp. 1557–1561.

[4] J.S. Fan, S.W. Xiong, J.Z. Wang, The multi-objective differential evolutionalgorithm based on quick convex hull algorithms, in: Proceedings of FifthInternational Conference on Natural Computation, 2009, pp. 469–473.

[5] P. Szczypinski, A. Klepaczko, Automated recognition of abnormal structuresin WCE images based on texture most discriminative descriptors, Adv. Intell.Soft Comput. 84 (2010) 263–270.

[6] X. Zhou, W. Jiang, Y. Tian, Y. Shi, Kernel subclass convex hull sample selectionmethod for SVM on face recognition, Neurocomputing 73 (2010) 2234–2246.

[7] F. Murtagh, A new approach to point pattern matching, Publ. Astron. Soc. Pac.104 (1992) 301–307.

[8] R.V. Chadnov, A.V. Skvortsov, Convex hull algorithms review, Proceedings ofEighth Russian-Korean International Symposium on Science and Technology,vol. 2, 2004, pp. 112–115.

[9] R.L. Graham, An efficient algorithm for determining the convex hull of a finiteplanar set, Inf. Process. Lett. 1 (1972) 132–133.

[10] A.M. Andrew, Another efficient algorithm for convex hulls in two dimensions,Inf. Process. Lett. 9 (1979) 216–219.

[11] C.B. Barber, D.P. Dobkin, H. Huhdanpaa, The quickhull algorithm for convexhulls, ACM Trans. Math. Softw. 22 (1996) 469–483.

[12] A. Datta, S.K. Parui, A dynamic neural net to compute convex hull, Neuro-computing 10 (1996) 375–384.

[13] S. Naher, D. Schmitt, A framework for multi-core implementations of divideand conquer algorithms and its application to the convex hull problem, in:Proceedings of 20th Annual Canadian Conference on Computational Geome-try, 2008, pp. 13–15.

[14] H.K. Ahn, Y. Okamoto, Adaptive algorithms for planar convex hull problems,IEICE Trans. Inf. Syst. E94-D (2011) 182–189.

[15] F. Cantin, A. Legay, P. Wolper, Computing convex hulls by automata iteration,Implementation Appl. Autom. 5148 (2008) 112–121.

[16] Y.J. Kim, J. Lee, M.S. Kim, G. Elber, Efficient convex hull computation forplanar freeform curves, Comput. Graph. 35 (2011) 698–705.

[17] M. Sharif, S.Z.Z. Naqvi, M. Raza, W. Haider, A new approach to computeconvex hull, Innovative Syst. Des. Eng. 2 (2011) 187–193.

[18] A. Allport, Visual attention, in: M.I. Posner (Ed.), Foundations of CognitiveScience, MIT Press, Bradford Books, Cambridge, 1989, pp. 631–682.

[19] R.A. Jarvis, On the identification of the convex hull of a finite set of points inthe plane, Inf. Process. Lett. 2 (1973) 18–21.

[20] J.B. Antoine Maintz, M.A. Viergever, A survey of medical image registration,Med. Image Anal. 2 (1998) 1–36.

[21] J. Hong, X. Tan, A new approach to point pattern matching, in: Proceedings ofNinth International Conference on Pattern Recognition, 1988, pp. 82–84.

[22] T. Wakahara, K. Odaka, Adaptive normalization of handwritten charactersusing global/local affine transformation, IEEE Trans. Pattern Anal. Mach.Intell. 20 (1998) 1332–1341.

[23] Z. Yang, F.S. Cohen, Image registration and object recognition using affineinvariants and convex hulls, IEEE Trans. Image Process. 8 (1999) 934–946.

[24] I. El Rube, M. Ahmed, M. Kamel, Wavelet approximation-based affineinvariant shape representation functions, IEEE Trans. Pattern Anal. Mach.Intell. 28 (2006) 323–327.

[25] Y. Mei, D. Androutsos, Affine invariant shape descriptors: the ICA-Fourierdescriptor and the PCA-Fourier descriptor, in: Proceedings of 19th Interna-tional Conference on Pattern Recognition, 2008, pp. 1–4.

[26] R. Fisher, S. Perkins, A. Walker, E. Wolfart, Affine Transformation, /http://homepages.inf.ed.ac.uk/rbf/HIPR2/affine.htmS, Copyright 2003, last accessedon August, 2, 2011.

[27] Z.W. Zhang, X.C. WU, Algorithm for convex hull of planar massive scatteredpoint set, Comput. Eng. 35 (2009) 43–45,48.

Page 10: A fast convex hull algorithm with maximum inscribed circle affine transformation

R. Liu et al. / Neurocomputing 77 (2012) 212–221 221

Runzong Liu received the B.S. degree in project man-

agement from Nanjing University of Technology, Nanj-ing, China, in 2004. In 2005, he began to study in the

science from Southwest petroleum University,Sichuan, China, and the Ph.D. degree in computer

College of Computer Science, Chongqing University,Chongqing, China. He is currently working towards thePh.D. degree with the College of Computer Science,Chongqing University. His research interests includemachine learning, pattern recognition, computervision and cognitive science.

Bin Fang received the B.S. degree in electrical engi-neering from Xi’an Jiaotong University, Xi’an, China,the M.S. degree in electrical engineering from SichuanUniversity, Chengdu, China, and the Ph.D. degree inelectrical engineering from the University of HongKong, Hong Kong. He is currently a Professor withthe College of Computer Science, Chongqing Univer-sity, Chongqing, China. His research interests includecomputer vision, pattern recognition, information pro-cessing, biometrics applications, and document analy-sis. He has published more than 120 technical papersand is an Associate Editor of the International Journal

of Pattern Recognition and Artificial Intelligence. Prof.

Fang has been the Program Chair, and a Committee Member for many interna-tional conferences.

Yuan Yan Tang received the B.S. degree in electrical andcomputer engineering from Chongqing University,Chongqing, China, the M.Eng. degree in electrical engi-neering from the Graduate School of Post and Telecom-munications, Beijing, China, and the Ph.D. degree incomputer science from Concordia University, Montreal,Canada. He is presently a Professor in the Department ofComputer Science at Chongqing University. His currentinterests include wavelet theory and applications, patternrecognition, image processing, document processing, arti-ficial intelligence, parallel processing, Chinese computingand VLSI architecture.

He has serviced as General Chair, Program Chair andCommittee Member for many international conferences. He is the Founder and Editor-in-Chief of International Journal on Wavelets, Multiresolution, and InformationProcessing (IJWMIP) and Associate Editors of several international journals related toPattern Recognition and Artificial Intelligence. Professor Y.Y. Tang is an IAPR Fellow andIEEE Fellow.

Jing Wen received her M.Sc. degree in computer

science from Chongqing University, Chongqing, China.She is currently working at the college of computer ofChongqing University. Her current research interestsinclude pattern recognition, image processing,biometrics, etc.

Jiye Qian received the B.S. degree in computer sciencefrom Chongqing University of Posts and Telecommu-nications, Chongqing, China, in 2004 and the M.S.degree in automation from Chongqing University,Chongqing, China, in 2007. He is currently workingtowards the Ph.D. degree with the College of ComputerScience, Chongqing University. His research interestsinclude sensor signal processing and computer vision.