Research Article | Open Access

Jianhui Zhao, Bingyu Chen, Mingui Sun, Wenyan Jia, Zhiyong Yuan, "Improved Algorithm for Gradient Vector Flow Based Active Contour Model Using Global and Local Information", *The Scientific World Journal*, vol. 2013, Article ID 479675, 8 pages, 2013. https://doi.org/10.1155/2013/479675

# Improved Algorithm for Gradient Vector Flow Based Active Contour Model Using Global and Local Information

**Academic Editor:**F. Yu

#### Abstract

Active contour models are used to extract object boundary from digital image, but there is poor convergence for the targets with deep concavities. We proposed an improved approach based on existing gradient vector flow methods. Main contributions of this paper are a new algorithm to determine the false part of active contour with higher accuracy from the global force of gradient vector flow and a new algorithm to update the external force field together with the local information of magnetostatic force. Our method has a semidynamic external force field, which is adjusted only when the false active contour exists. Thus, active contours have more chances to approximate the complex boundary, while the computational cost is limited effectively. The new algorithm is tested on irregular shapes and then on real images such as MRI and ultrasound medical data. Experimental results illustrate the efficiency of our method, and the computational complexity is also analyzed.

#### 1. Introduction

Image segmentation is one of the basic problems of image processing and computer vision, and its purpose is to divide the image into several different areas, while each region has certain characteristics and disjoints with the others. Contour extraction [1–3] is one basic segmenting approach, for which the active contour model (ACM) has been widely studied and applied [4–14]. Existing methods of ACM can be divided into two types [15]: parametric ACMs [4–8, 16, 17] and geometry based ACMs [9–12, 14, 18–20]. Due to effective mathematic methods, parametric ACMs are often faster than geometry based ACMs [11–13]. Geometry based ACMs need higher dimensional functions, which make them slower. Therefore, parametric ACMs are more suitable for certain applications [13, 15], and the novel algorithm proposed in our paper also belongs to the parametric ACMs.

The method of active contour model [4] was proposed by Kass et al. The original ACM has certain disadvantages. First, the external force field of ACM attenuates rapidly when away from image edges, which makes the capturing range of ACM very small; that is, its external force field is very limited. Second, image noise may stop the deformation of active contour where the local minimum energy is obtained and leads the contour to incorrect border; thus, the initial active contour is required to be very near the object boundary. The disadvantages narrow the applications of original ACM, which can only handle the objects without complex boundaries while the initial active contours are not far from the edges.

Based on the original ACM, Xu and Prince proposed the gradient vector flow (GVF) active contour model [7]. The GVF based ACM presents a new external force field, and the diffusing operation makes GVF force field spread to the entire image and thus reflects the static global information. GVF based ACM generates fairly good results even when dealing with image noise and concave edges. The external force field of GVF is a static force field, and it does not change with deformation time or contour’s position. External force field of GVF has a large capturing range, and it can drive the active contour to concavities of image edge. However, during the diffusion of external force field, the competing of forces happens. Thus, for the object boundary with very deep concavities, the GVF based ACM still has difficulty to correctly deal with and then obtain good results [15, 21].

To address the problem of converging the active contour to deep concavities of object boundary, the magnetostatic active contour model was proposed by Xie and Mirmehdi [12]. The magnetostatic ACM hypothesizes that electric currents flow through both object boundary and active contour; thus, the active contour is moved toward object boundary under the influence of the generated magnetic field. The magnetostatic ACM is based on static magnetic theory, and it presents a new external force field based on the local information of image. The magnetostatic force can push active contour towards the complicated boundary and thus converge the active contour to very complex object boundary and can also segment multiple objects with only one initial active contour. However, the external force field of magnetostatic method is dynamic; that is, it has to be continuously updated during each time of active contour’s deformation, while the calculation of the magnetic force field is relative complex, which makes computation of magnetostatic active contour method slow [13, 22]. Thus, the magnetostatic ACM needs a high computing cost for object segmentation, which limits its applications.

In this paper, an improved GVF based ACM is presented based on the existing methods using both global and local information. The external force field is first computed using the global information of GVF; then, the initial contour is driven to move towards the boundary of object gradually. When the active contour stops, the local information of it is employed to help determine the false part of contour. If the false part exists, the magnetostatic force of it is calculated, and then the external force field is updated to move the active contour for further time. The above steps are repeated until the active contour stops, and there is no false part.

#### 2. Preliminary

To illustrate our proposed approach, the methods of ACM, GVF, and magnetostatic ACM are implemented first, and the procedures are described as follows.

##### 2.1. Implementation of ACM

For a closed parametric curve , , ACM defines the energy function: where and are the weighting parameters of contour elasticity and rigidity, respectively, and denote the first and the second derivatives of with respect to , and is the external energy derived from image and constraint forces so that it has smaller value near the object boundary and bigger value in the other areas.

The minimization of must satisfy the Euler equation: which can be regarded as a force balance equation: where , , internal force discourages both stretching and bending, external force pulls the active contour to the desired image edges, and finally the curve stops at the position with force balance.

In order to solve (2), the active contour is taken as a function of time and parameter ; that is, and the solution of (2) become the solution of:

##### 2.2. Implementation of GVF

The GVF based ACM defines a new external force field , and the new external force field is named gradient vector flow force field. From (4), there is

An edge map is calculated from the original image , and the value of edge map is larger at positions near the image edges. Edge map can be obtained from gray-level images or binary images as where , or 4. Edge map has three characteristics: the gradient vector of edge map, that is, , should point to and be perpendicular with the object boundary; the gradient vector of edge map has larger value at object boundaries; in the smooth region of image where little change with the value of , is close to 0.

The gradient vector flow force field can be expressed as , and its energy function is

The energy function follows a standard principle that, in the absence of gradient vector field, the smoothness of active contour is ensured. When value of is small, the energy function is determined by the sum of the squares of partial derivatives of gradient vector force field. When value of is large, the energy function is determined by and is minimized by . Therefore, nearly equals to the gradient of edge map where gradient value is large and changes little where gradient value is small. As the weighting parameter, is set according to the proportion of noise in image, that is, more noise with larger value of .

##### 2.3. Implementation of Magnetostatic ACM

The magnetostatic ACM is based on level-set approach, while the evolution equation of level-set function is where is the speed function with certain form.

The active contour of magnetostatic based ACM can be represented implicitly as where is the active contour, is the image domain, and is the level-set function at time .

As for its applying in image segmentation, deformation of the active contour of magnetostatic ACM is associated with the following partial differential equation: where is weighting parameter, is stop function, and is the external force field of magnetostatic ACM.

#### 3. Improved GVF Active Contour Model

Then, the new improved algorithm for GVF based ACM is implemented, during which both false contour determination and updating of external force field are difficult problems.

##### 3.1. Basic Idea

To make the active contour converge to deep concavities of object boundary and spend less time during deformation, an improved GVF based ACM is proposed. Our approach combines advantages of GVF based ACM and magnetostatic ACM. Global information is considered with GVF based ACM to generate the external force field, which drives the active contour to object boundary. When there is false part of the stopped contour, local information around the false part is considered with the help of magnetostatic ACM to compute the magnetostatic force and add to the existing external force field; then the external force field is updated.

Therefore, our method has a semidynamic external force field, which is dynamic when there is false part of the active contour, and magnetostatic force is added and is static when the active contour is moved. Our method uses both global and local information of image; that is, the global information is used when GVF external force field is computed, while the local information is used when false part of active contour is judged and the magnetostatic force is computed.

##### 3.2. False Contour Determination

GVF based ACM can converge the active contour to edges of complex object, but it cannot deal with deep concavities of boundary. Figure 1 shows the extracted boundary of an object with deep concavity using GVF; that is, Figure 1(a) is the object and the initial active contour, while Figure 1(b) is the result after 150 times of contour movement. From the result, it can be found that part of the active contour stops at the entrance of deep concavity where the minimum energy is met, and such part is the false active contour. Only if the false part is determined and the local external force field is updated, the false contour can be further moved into the concavity.

**(a)**

**(b)**

Figure 2 is the external force field of GVF and the stopped active contour. To illustrate the force field clearly, the local regions of external force field are enlarged and are shown in Figure 3. The local region around right side of the entrance to the deep concavity is shown in the left image of Figure 3. We can find that the black part of contour has moved to the object boundary, and it is real active contour, while the red part has stopped at the entrance, and it is false active contour. Also, it can be found that most angles between the real active contour and the force vectors of the external force field are near 90 degrees, while most angles between false active contour and vectors of external force field are near 0 degree.

**(a)**

**(b)**

In [22], the false active contour is judged when one angle between active contour and external force field is less than a predefined threshold value. But sometimes this method can make mistakes, since there are certain irregular directions of external forces around the real active contour. As shown in the right image of Figure 3, the angles between irregular external forces and real active contour are also very small. To avoid the inaccurate judgements, a more precise method is needed to determine the false part of active contour.

In our new judgement method for false part, the angles between the tangent vector of each point in active contour and the 9 external forces around it, in the local area, are calculated. If every angle is less than a threshold value, the point in contour is judged as false active contour point. If the amount of false contour points in a part of active contour is more than a threshold value, it is judged as the false part of active contour. The new false active contour determination method makes the judgment more accurate, even in the cases of irregular directions of external forces.

Judgement formula of the false active contour point is where , is the maximum angle between active contour (tangent vector of the point under processing in active contour) and the around external forces in the local region, and is the predefined angle threshold value. Consider that means that the point is false active contour point, while means that this point is not a false active contour point. can be represented as where , while .

Formula (11) is used to scan the whole active contour, and all false active points are recorded. Thus, the active contour is divided into segments; that is, there are dividing points where , and the related segments , . Then, amount of false active contour points is calculated for each segment. If the amount of false active contour points is greater than a predefined threshold, the corresponding segment is a false part of active contour. The judgement formula is where is the length of active contour and is threshold value for the amount of false active contour points of one segment. If , is a false part of active contour; and if , is not a false part.

Judgements of false parts in active contour are displayed in Figure 4. The top image is the determined false part (in red color) of active contour from the method of [22], while the bottom image shows the determined result from our new method. From the comparison, it can be found that our new method can detect the false part of active contour with higher accuracy, and only the false part needs further processing to approach towards the deep concavity.

**(a)**

**(b)**

##### 3.3. Updating of External Force Field

In our improved GVF active contour model, the external force field is made of two parts: one is the static GVF force field, the other is the dynamic magnetic force field. The basic external force field of GVF based ACM is calculated by minimizing the energy function (7); then the initial active contour deforms under the influence of the force field. When the false part appears in the deformed contour, the magnetic force field is computed; then the new external force field is obtained through combination of the basic external force field and the magnetic force field. And then the active contour deforms for the next iteration under the influence of the new external force field.

The calculation of the magnetic force field is based on the magnetostatic theory. Assume that there are electric currents in both the object boundary and the false active contour. The magnetic field produced by false active contour is ignored, and only the magnetic field generated from object boundary is considered. In the magnetic field from object boundary, the false active contour is affected by the produced magnetic force and moved towards the object boundary. The electric current of object boundary is obtained through rotating the gradient of image for 90 degrees using the following equation: where and are partial derivatives of image in and . When , direction of the electric current is counter clockwise; when , direction of the electric current is clockwise.

The magnetic field produced by electric current of object boundary is where is a point in object boundary, is the object boundary, is the electric current vector at point , and is the unit vector from to , while is the distance between and . Suppose that the electric current of false active contour is ; the magnetic force generated from magnetic field of object boundary is where is the direction of electric current of false active contour. The magnetic force exerted on the false active contour is always vertical to it while points towards inside or outside of the active contour.

After computation of the magnetic force field around the false active contour, the basic external force field is added with the magnetic force field ; then the new external force field is obtained as where is the weighting parameter of , and it is used to adjust the effect from the magnetic force.

Figure 5 displays the force field around false active contour produced from the electric current of object boundary. The black curve represents object boundary, the green + denotes magnetic field from object boundary going perpendicularly into the image plane, and the green denotes the magnetic field coming perpendicularly out of image plane, while the blue arrows represent the magnetic forces with vertical directions to the false active contour, which is denoted with a red line.

As shown in the top image of Figure 6, there is no downward component of basic external force field at entrance of deep concavity where the false active contour stops. As shown in the bottom image of Figure 6, after adding the magnetic force field, now there is downward component of updated external force field , which helps converge the false active contour into deep concavity.

#### 4. Experimental Results

To test the performance of our new method, experiments are performed including setting of parameters, comparisons with existing ACMs, and testing on real images.

##### 4.1. Setting of Parameters

The initial active contour is generated by interpolation of a series of manually marked points for object. In our improved GVF active contour model, the parameters need to be set are , , , , , , , and .

The elastic parameter and rigid parameter are used to control integrity and smoothness of the active contour, that is, ensure that the active contour is a complete closed curve with good smoothness during the deformations. In our work, we set and . Parameter is the smoothing parameter, and it is set according to image noise. Generally, , and we set . Parameter controls the direction of electric current in object boundary, and when , the electric current is counter clockwise; when , the electric current is clockwise. If the initial active contour is inside or outside of the object, the directions of electric currents of object boundary and active contour must be the same. If the initial active contour intersects with the object boundary, the electric current directions of object boundary and active contour must be different. Only in this way, the active contour can be moved to object boundary; otherwise it is moved away from object boundary. Parameter is used when adding the basic external force field and the magnetic force field. It adjusts the weight of magnetic force field in the updated external force field, and we set . Angle is the threshold value to judge false active contour points. Too large value of can take the real active contour points as false ones, while too small value of can take false active contour points as real ones; thus, we set . Parameter is the number of segments used when judging the false active contour, and it is set based on the whole length of the active contour. Since too long or too short segment will affect the judgment accuracy of false active contour, is set to make each segment have 50 active contour points. Percentage is the threshold value for false active contour determining. For each active contour segment, if the proportion of false active contour points is more than , the segment is taken as false active contour segment. In our work, we set .

##### 4.2. Comparison with Existing ACMs

Existing ACMs and our method are tested on object with one deep concavity, and the results are shown in Figure 7. The 1st row results from balloon active contour model, the 2nd row results from distance vector flow active contour model, the 3rd row results from gradient vector flow active contour model, and the 4th row results from our method. The 1st column is the object and the initial active contour, the 2nd column is the results after 50 (150 of our method) iterations, and the 3rd column is the results after 100 (250 of our method) iterations, while the 4th column is the results after 150 (350 of our method) iterations. Then, the methods are tested on the object with multiple deep concavities, and related results are shown in Figure 8 with the same arrangements as Figure 7. From the results, it can be found that our method has the ability to converge the active contour to complex object border, even for the object boundary with very deep concavities.

Compared with GVF based ACM, when the initial active contour stops deformation, our method continues to scan the active contour and search for the false part. Then, magnetic force field around the false part is computed, and the new external force field is generated. Thus, the active contour has opportunities to be adjusted for more times until there is no false part. Therefore, computing cost of our method is higher than these existing ACMs. However, our method performs faster than the magnetostatic ACM. The magnetostatic ACM calculates magnetic force of every point in active contour and updates the external force field for each deformation, while our method calculates the magnetic force field only when the false active contour appears. Our method updates the external force field only if needed, which makes its computational efficiency better than that of magnetostatic ACM.

##### 4.3. Results on Real Images

Our improved GVF based ACM are tested on some real images of objects with complex boundaries, for example, fish, plane, fire, shell, as shown in Figure 9, and the initial active contours successfully converge to the deep concavities after a number of iterations. Then, our method is used to process medical data including MRI and ultrasound images, as illustrated in Figure 10. The active contours move to image edges correctly, and the object boundaries are extracted with high precision. From the 2nd to 4th rows, the 1st and 2nd columns are regions of interest and the 3rd column are initial active contours, while the 4th column are correctly converged active contours.

#### 5. Conclusion

GVF based ACM has the large capture range due to its external force field, but it has difficulty to converge the active contour to deep concavities of object boundary. In this paper, we proposed an improved method for GVF with the help of magnetic force field from magnetostatic ACM. Our method uses global information to calculate the basic GVF external force field to adjust the initial active contour and then uses local information to determine the false part of active contour and calculate the magnetic force field for the false contour. The new external force field is obtained through addition of GVF external force field and magnetic force field and is used to drive the active contour to converge again. These operations are repeated until there is no false part of the stopped active contour. The key techniques of our method include a new algorithm to determine the false part of active contour and a new algorithm to update the external force field.

Based on a lot of experiments, the new method has been tested and analyzed. Compared with the existing ACMs, our method has better performance for edge extraction, even for boundaries with very deep concavities. Our method also has higher computational efficiency than magnetostatic ACM.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgments

This work was supported by National Basic Research Program of China (973 Program no. 2011CB707904), Science and Technology Bureau of Suzhou Municipality (no. SH201115), Science and Technology Bureau of Wuhan Municipality (no. 201150124001), Natural Science Foundation of Hubei Province of China, Natural Science Fund of China (no. 61272276), and R&D Special Fund for Public Welfare (no. GYHY201106047).

#### References

- B. C. Lucas, Y. Otake, M. Armand, and R. H. Taylor, “An active contour method for bone cement reconstruction from C-arm X-ray images,”
*IEEE Transactions on Medical Imaging*, vol. 31, no. 4, pp. 860–869, 2012. View at: Publisher Site | Google Scholar - J. Zhao, G. Liang, Z. Yuan, and D. Zhang, “A new method of breakpoint connection using curve features for contour vectorization,”
*Electronics and Electrical Engineering*, vol. 18, no. 9, pp. 79–82, 2012. View at: Google Scholar - W. Kim and C. Kim, “Active contours driven by the salient edge energy model,”
*IEEE Transactions on Image Processing*, vol. 22, no. 4, pp. 1667–1673, 2013. View at: Google Scholar - M. Kass, A. Witkin, and D. Terzopoulos, “Snakes: active contour models,”
*International Journal of Computer Vision*, vol. 1, no. 4, pp. 321–331, 1988. View at: Publisher Site | Google Scholar - K. W. Sum and P. Y. S. Cheung, “Boundary vector field for parametric active contours,”
*Pattern Recognition*, vol. 40, no. 6, pp. 1635–1645, 2007. View at: Publisher Site | Google Scholar - L. D. Cohen and I. Cohen, “Finite-element methods for active contour models and balloons for 2-D and 3-D images,”
*IEEE Transactions on Pattern Analysis and Machine Intelligence*, vol. 15, no. 11, pp. 1131–1147, 1993. View at: Publisher Site | Google Scholar - C. Xu and J. L. Prince, “Snakes, shapes, and gradient vector flow,”
*IEEE Transactions on Image Processing*, vol. 7, no. 3, pp. 359–369, 1998. View at: Publisher Site | Google Scholar - T. McInerney and D. Terzopoulos, “T-snakes: topology adaptive snakes,”
*Medical Image Analysis*, vol. 4, no. 2, pp. 73–91, 2000. View at: Google Scholar - R. Malladi, J. A. Sethian, and B. C. Vemuri, “Shape modeling with front propagation: a level set approach,”
*IEEE Transactions on Pattern Analysis and Machine Intelligence*, vol. 17, no. 2, pp. 158–175, 1995. View at: Publisher Site | Google Scholar - L. A. Vese and T. F. Chan, “A multiphase level set framework for image segmentation using the Mumford and Shah model,”
*International Journal of Computer Vision*, vol. 50, no. 3, pp. 271–293, 2002. View at: Publisher Site | Google Scholar - V. Caselles, R. Kimmel, and G. Sapiro, “Geodesic active contours,”
*International Journal of Computer Vision*, vol. 22, no. 1, pp. 61–79, 1997. View at: Google Scholar - X. Xie and M. Mirmehdi, “MAC: magnetostatic active contour model,”
*IEEE Transactions on Pattern Analysis and Machine Intelligence*, vol. 30, no. 4, pp. 632–646, 2008. View at: Publisher Site | Google Scholar - T. Wang, I. Cheng, and A. Basu, “Fluid vector flow and applications in brain tumor segmentation,”
*IEEE Transactions on Biomedical Engineering*, vol. 56, no. 3, pp. 781–789, 2009. View at: Publisher Site | Google Scholar - C. Li, C. Xu, C. Gui, and M. D. Fox, “Level set evolution without re-initialization: a new variational formulation,” in
*Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR '05)*, pp. 430–436, June 2005. View at: Google Scholar - L. He, Z. Peng, B. Everding et al., “A comparative study of deformable contour methods on medical image segmentation,”
*Image and Vision Computing*, vol. 26, no. 2, pp. 141–163, 2008. View at: Publisher Site | Google Scholar - B. Olstad and A. H. Torp, “Encoding of a priori information in active contour models,”
*IEEE Transactions on Pattern Analysis and Machine Intelligence*, vol. 18, no. 9, pp. 863–872, 1996. View at: Publisher Site | Google Scholar - B. Li and S. T. Acton, “Vector field convolution for image segmentation using snakes,” in
*Proceedings of the IEEE International Conference on Image Processing (ICIP '06)*, pp. 1637–1640, October 2006. View at: Publisher Site | Google Scholar - O. Juan, R. Keriven, and G. Postelnicu, “Stochastic motion and the level set method in computer vision: stochastic active contours,”
*International Journal of Computer Vision*, vol. 69, no. 1, pp. 7–25, 2006. View at: Publisher Site | Google Scholar - N. Paragios and R. Deriche, “Geodesic active regions and level set methods for supervised texture segmentation,”
*International Journal of Computer Vision*, vol. 46, no. 3, pp. 223–247, 2002. View at: Publisher Site | Google Scholar - D. Tschumperlé, “Fast anisotropic smoothing of multi-valued images using curvature-preserving PDE's,”
*International Journal of Computer Vision*, vol. 68, no. 1, pp. 65–82, 2006. View at: Publisher Site | Google Scholar - C. Xu and J. L. Prince, “Generalized gradient vector flow external forces for active contours,”
*Signal Processing*, vol. 71, no. 2, pp. 131–139, 1998. View at: Google Scholar - B. Chen, J. Zhao, E. Dong, J. Chen, Y. Zhao, and Z. Yuan, “An improved GVF snake model using magnetostatic theory,” in
*Computer, Informatics, Cybernetics and Applications*, vol. 107 of*Lecture Notes in Electrical Engineering*, pp. 431–440, 2012. View at: Publisher Site | Google Scholar

#### Copyright

Copyright © 2013 Jianhui Zhao et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.