296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

6
Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 296 IMAGE SEGMENTATION USING ACTIVE CONTOUR (SNAKE) Cherry Ballangan 1)  Rudy Adipranata 2)  William Nugroho  Informatics De partment, Petra Christian University, Surabaya [email protected] 1)  [email protected] 2)  ABSTRAK  Segmentasi gambar (image se gmentation) merupakan salah satu bagian yang penting dalam ilmu pengolahan gambar. Segmentasi gambar memisahkan bagian-bagian dari sebuah gambar sehingga nantinya analisa gambar dapat d ilakukan bagian demi bagian, tanpa harus memproses bagian-bagian yang tidak diperlukan. Mendisain sebuah metode  segmentasi gambar y ang akurat masih merupak an suatu tantangan dan sekaligus juga dorongan bagi par a peneliti untuk mengembangkan metode-metode yang sudah ada dan juga merumuskan metode yang baru. Dalam tulisan ini, active contour digunakan untuk meningkatkan akurasi pendeteksian pinggiran (boundary) suatu obyek. Active contour, atau  snake, adalah spline yang meminimumkan energi dan dapat digunakan dalam mendeteksi pinggiran suatu obyek. Segmentasi gambar berdasarkan active contour ini terdiri dari beberapa langkah. Pertama, beberapa pemrosesan awal dilakukan untuk meningkatkan hasil segmentasi gambar. Setelah itu sebuah kontur/kurva diinisialisasi di luar daerah  yang diinginkan. Kemudian setelah menghitung semua parameter, active contour mulai diproses untuk mendapatkan  pinggiran dari obyek yang diinginkan. Agar dapat mendeteksi pinggiran suatu obyek, turunan pertama dari gambar input perlu didapatkan. Akhirnya, akibat dari energi eksternal dari snake, kontur akan merayap ke arah yang diinginkan,  sampai kontur tersebut konvergen pada sebuah obyek yang dikehendaki. Beberapa eksperimen telah dilakukan untuk mengesahkan algoritma image segmentation ini. Percobaan-percobaan tersebut menunjukkan bahwa active contour dapat menghasilkan image segmentation yang baik. Semakin tinggi nilai parameter alfa dan beta, makin dekat hasil akhir kontur kepada obyek. Makin tinggi nilai parameter delta, makin cepat kontur bergerak, hanya saja kontur dapat melewati pinggiran suatu obyek. Nilai delta yang kecil akan menyebabkan kontur bergerak perlahan-lahan tapi tidak melewati batas pinggiran suatu obyek. Beberapa pemrosesan awal diperlukan untuk memperoleh hasil yang lebih baik.  Kata kunci : Segmentasi Gambar, Active Contour, Pengolahan Gambar Digital. 1. Introduction With the advances of digital imaging technologies, the field of computer vision and digital image processing develop rapidly. Computer vision has contributed significantly to other fields such as robotics, computational intelligence, entertainment as well as medical imaging. Along with computer vision, digital image processing is often needed to acquire important information from digital images. One of many important tasks in image processing is image segmentation. Image segmentation is a process to separate an object from its background or from other objects in an image. Object separation is useful when further processes need to be applied to an object, without modifying other parts of the object such as the background. Since the result of image segmentation will affect the next processes conducted, developing an accurate image segmentation is a crucial process. There are three types of image segmentation:  Classification-based , segmentation based on similarity of pixels. The easiest way to perform this type of segmentation is by using a threshold.   Edge-based , segmentation process to obtain a line in an image which is considered as an edge of an object. The edge will separate an object from its background or from other objects.   Region-based , segmentation is performed based on collection of pixels that have many types of associations such as texture, color or gray level, and starts from a point within the image to other neighborhood points. In this paper, an image segmentation system is designed to obtain a good result with a fast process. This segmentation method employs an active contour which will be described in Section 2. The whole system of the method is presented in Section 3, followed by the presentation of some experiment results in Section 4 and then concluded in Section 5. 2. Active Contour Active contour, also called as snake, is a spline that uses the energy minimization procedure to impose a contour toward a  particular feature. The method was first proposed by Kass et al [2] . Active contour is a popular method in computer vision as well as digital image processing area [1,3,4,6] . Snake is mathematically represented using the following equation: = + + = 1 0 int )) ( ( )) ( ( )) ( (  s con img  snake ds  s v  E  s v  E  s v  E  E  (1) where:   snake  E  is the energy function of the active contour from which an object is detected.  ) (  s v  is the contour (curve).  int  E  is the internal energy of the active contour affecting the motion of the contour.  img  E  is energy from the input image including low level features such as edge p oints.

Transcript of 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

7/25/2019 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

http://slidepdf.com/reader/full/296-301-snsi06-47-image-segmentation-using-active-contour-snake 1/6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 

296

IMAGE SEGMENTATION USING ACTIVE CONTOUR (SNAKE)

Cherry Ballangan1)  Rudy Adipranata2)  William Nugroho

 Informatics Department, Petra Christian University, [email protected] 

1)  [email protected] 

2) 

ABSTRAK  Segmentasi gambar (image segmentation) merupakan salah satu bagian yang penting dalam ilmu pengolahan gambar.Segmentasi gambar memisahkan bagian-bagian dari sebuah gambar sehingga nantinya analisa gambar dapat dilakukan

bagian demi bagian, tanpa harus memproses bagian-bagian yang tidak diperlukan. Mendisain sebuah metode segmentasi gambar yang akurat masih merupakan suatu tantangan dan sekaligus juga dorongan bagi para peneliti untuk

mengembangkan metode-metode yang sudah ada dan juga merumuskan metode yang baru. Dalam tulisan ini, activecontour digunakan untuk meningkatkan akurasi pendeteksian pinggiran (boundary) suatu obyek. Active contour, atau snake, adalah spline yang meminimumkan energi dan dapat digunakan dalam mendeteksi pinggiran suatu obyek.Segmentasi gambar berdasarkan active contour ini terdiri dari beberapa langkah. Pertama, beberapa pemrosesan awal

dilakukan untuk meningkatkan hasil segmentasi gambar. Setelah itu sebuah kontur/kurva diinisialisasi di luar daerah yang diinginkan. Kemudian setelah menghitung semua parameter, active contour mulai diproses untuk mendapatkan

 pinggiran dari obyek yang diinginkan. Agar dapat mendeteksi pinggiran suatu obyek, turunan pertama dari gambar

input perlu didapatkan. Akhirnya, akibat dari energi eksternal dari snake, kontur akan merayap ke arah yang diinginkan, sampai kontur tersebut konvergen pada sebuah obyek yang dikehendaki. Beberapa eksperimen telah dilakukan untukmengesahkan algoritma image segmentation ini. Percobaan-percobaan tersebut menunjukkan bahwa active contour

dapat menghasilkan image segmentation yang baik. Semakin tinggi nilai parameter alfa dan beta, makin dekat hasilakhir kontur kepada obyek. Makin tinggi nilai parameter delta, makin cepat kontur bergerak, hanya saja kontur dapat

melewati pinggiran suatu obyek. Nilai delta yang kecil akan menyebabkan kontur bergerak perlahan-lahan tapi tidakmelewati batas pinggiran suatu obyek. Beberapa pemrosesan awal diperlukan untuk memperoleh hasil yang lebih baik. Kata kunci : Segmentasi Gambar, Active Contour, Pengolahan Gambar Digital.

1.  IntroductionWith the advances of digital imaging technologies, the field of computer vision and digital image processing developrapidly. Computer vision has contributed significantly to other fields such as robotics, computational intelligence,entertainment as well as medical imaging. Along with computer vision, digital image processing is often needed to

acquire important information from digital images. One of many important tasks in image processing is imagesegmentation.

Image segmentation is a process to separate an object from its background or from other objects in an image. Objectseparation is useful when further processes need to be applied to an object, without modifying other parts of the objectsuch as the background. Since the result of image segmentation will affect the next processes conducted, developing anaccurate image segmentation is a crucial process. There are three types of image segmentation:

•  Classification-based , segmentation based on similarity of pixels. The easiest way to perform this type ofsegmentation is by using a threshold.

•   Edge-based , segmentation process to obtain a line in an image which is considered as an edge of an object. Theedge will separate an object from its background or from other objects.

•   Region-based , segmentation is performed based on collection of pixels that have many types of associations

such as texture, color or gray level, and starts from a point within the image to other neighborhood points.In this paper, an image segmentation system is designed to obtain a good result with a fast process. This segmentationmethod employs an active contour which will be described in Section 2. The whole system of the method is presented inSection 3, followed by the presentation of some experiment results in Section 4 and then concluded in Section 5.

2.  Active ContourActive contour, also called as snake, is a spline that uses the energy minimization procedure to impose a contour toward a particular feature. The method was first proposed by Kass et al[2]. Active contour is a popular method in computer vision

as well as digital image processing area[1,3,4,6]

. Snake is mathematically represented using the following equation:

∫ =++=

1

0int ))(())(())((

 sconimg  snake ds sv E  sv E  sv E  E    (1)

where:

•   snake E   is the energy function of the active contour from which an object is detected.

• 

)( sv  is the contour (curve).

•  int E   is the internal energy of the active contour affecting the motion of the contour.

•  img  E   is energy from the input image including low level features such as edge points.

7/25/2019 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

http://slidepdf.com/reader/full/296-301-snsi06-47-image-segmentation-using-active-contour-snake 2/6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 

297

•  con E   is the external constraint imposed by either users or high level processes.

 E int is given by:

2

2)(

2

)(

2

)()(intds

 svd  s

ds

 sdv s E    β α    +=   (2)

where:

•  The derivative ds sdv /)(  calculates the energy affecting the elasticity of the contour.

•  )( sα   is the parameter for elasticity.

•  The second derivative2

/)(2

ds svd   calculates the energy affecting the curvature of the contour

•  )( s β   is the parameter for curvature.

The active contour formula shown in Equation 1 is further expressed numerically using the following equation[5]

:

),(  y x f  A   =x   (3)

where ),(  y x f  x  is the edge magnitude of the image, and A is a penta-diagonal matrix having the following pattern:

=

−−−−−

 s s s s s

 s s s s s

cbaed 

d cbae

ed cba

aed cb

baed c

 A

...0

...0

.....................

..................0

...0

...0

...0

11111

33333

22222

11111

  (4)

The values of a, b, c, d  and e can be obtained by using the following equations:

41

ha  s

 s−=  β   

241 )(2

hhb  s s s

 s α  β  β  −+−=   −21

411

hhc  s s s s s

 s α α  β  β  β  +−+ +=  2

14

1 )(2hh

d   s s s s

++ −+−=   α  β  β   4

1

he  s

 s+=  β   

where s represents the index of the contour points and h is the space between points in the contour. An iterative solutioncan then be formulated as follows:

 

 

  

  

 +

∆+=

+),(

)(11

1)1( y x x f 

i I  A

ixx   (5)

where  I   is an identity matrix, xi+1

  is the new  x position of the contour, and delta is a step size. The  y position of thecontour points can be obtained in similar way using the following equation:

 

 

  

 

 +

+=+

),()(1

11)1(

 y x y f i

 I  Ai

yy   (6)

3.  Segmentation MethodThe proposed image segmentation method consists of four main steps: preprocessing, initialization, parametercalculation, and contour deformation .The flowchart of the system is presented in Figure 1.

3.1  Preprocessing

Preprocessing is an optional step and aims to produce a better segmentation. This step consists of four tasks: gray scaling,

 blurring, color inversion and threshold. Depending on the nature of the input image, each process can be chosen toenhance the result.

Gray scaling is a process to convert a colored image, e.g. RGB image, into a gray level image. There are many differentapproaches to perform this conversion. In this paper, the following formula is used to obtain the gray level of each pixel:

0.299R + 0.587G + 0.114B.

Blurring in this preprocessing is performed to thicken the edge of an object. In this experiment, Gaussian blur is used.Gaussian is one of many powerful smoothing filters, in that the detail of the image is kept while the noise is reduced.

7/25/2019 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

http://slidepdf.com/reader/full/296-301-snsi06-47-image-segmentation-using-active-contour-snake 3/6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 

298

 Figure 1. Flowchart of the Image Segmentation System

The color inversion process is a simple process that changes the low value pixel into high value and vice versa. The result

of this process is known as negative images. Threshold is a process to convert a gray level image into a binary imagewith a threshold value as a limit that determines whether a gray level pixel will be converted into 0 (black) or 255

(white).

3.2  Initialization

The initialization step is an important step as it affects the success of the process of active contour. This includes theinitialization of the active contour (initial contour) and also the initialization of the matrix that is needed to deform thecontour (matrix  A, see Equation 4). The closer the initial contour to the desired boundary, the more success is the

segmentation. The number of points of the initial contour also affects the size of matrix A.

3.3  Parameter Calculation

As described in Section 2, active contour is influenced by three parameters: alpha, beta and delta. Alpha and beta are partof the internal force, and will be used to calculate matrix  A, whereas delta is used to process matrix  I  and also affects

vector x and y which are the x and y position of the contour points.

3.4  Snake deformation

After all the elements of the active contour formula are calculated, the contour can be deformed by calculating the x and y  position of each iteration, until it stops when it converges to the desired boundary. This is done by using the formula inEquations 5 and 6. The flowchart of this step is given in Figure 2.

4.  Result and DiscussionThe method has been implemented into segmentation software to validate the proposed method. The first result that will be presented here has been pre-processed using all the preprocessing option as described in Section 3, and setting alpha =1.0, beta = 0.7 and delta = 12.0. The result of this experiment is shown in Figure 3.

Different values of alpha, beta and delta have been observed as well. Both alpha and beta have values in the range of 0

and 1 whereas delta can be any value greater than 0. The experiments were performed on the same image, with size 170 × 194 pixels and used the gray scaling and threshold preprocessing. The results of these experiments are presented inFigure 4, for various values of alpha, Figure 5, for various values of beta, and Figure 6, for various values of delta.

7/25/2019 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

http://slidepdf.com/reader/full/296-301-snsi06-47-image-segmentation-using-active-contour-snake 4/6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 

299

 Figure 2. Contour Deformation

Input image with initial contour Active contour after converged

Segmentation result, after cropped

Figure 3. Segmentation Result Using Alpha = 1.0, Beta = 0.7 and Delta = 12.0

It can be seen in Figure 4 that the bigger the value of alpha, the closer the contour converges to the object. Figure 5shows that the variation of beta values does not significantly effect the convergence process. However, it determines the

shape of the contour. Figure 6 shows that if the value of delta is big, the converged contour is closer to the desired object.

7/25/2019 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

http://slidepdf.com/reader/full/296-301-snsi06-47-image-segmentation-using-active-contour-snake 5/6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 

300

  Alpha 0,1  Alpha 0,3  Alpha 0,5

 Alpha 0,7  Alpha 0,9  Alpha 1

Figure 4. Segmentation Results Using Different Values Of Alpha. Beta Is Set To 0.5 And Delta To 8.0.

 Beta 0,1  Beta 0,3  Beta 0,5

 Beta 0,7  Beta 0,9  Beta 1

Figure 5. Segmentation Result Using Different Values Of Beta. Alpha Is Set To 0.7 And Delta To 8.0.

 Delta 4  Delta 5  Delta 6

 Delta 7  Delta 8  Delta 9

Figure 6. Segmentation Result Using Different Values Of Beta. Alpha Is Set To 1.0 And Beta 0.5.

Some experiments to analyze the effect of preprocessing have also been carried out. The experiment results are presentedin Figure 7 for the preprocessing invert process and in Figure for the threshold process. Preprocessing invert is importantwhen the gray value of the object is greater than the gray value of the background. Inversion, in this case, will change the

edge value of the image, thus will help the contour to detect the edge.

Preprocessing threshold is essential to omit unnecessary edges so that it would not interfere the segmentation process.Figure 8 illustrates this problem.

7/25/2019 296 301 Snsi06 47 Image Segmentation Using Active Contour Snake

http://slidepdf.com/reader/full/296-301-snsi06-47-image-segmentation-using-active-contour-snake 6/6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006 SNSI06-047 

301

 Original Image With Initial Contour Inverted Image

Original Image with Converged Contour

(fail to detect the edge)

Inverted Image with Converged Contour

Figure 7. The Segmentation Result of Inverted Images Using  Alpha = 1, Beta = 0,8 And Delta = 8.0

Original Image with Initial Contour Threshold Image

Original Image with Converged Contour(fail to detect the edge)

Threshold Image with Converged Contour

Figure 8. The Segmentation Result of Threshold Using  Alpha = 1, Beta = 0,8 and  Delta = 8.0.

5.  ConclusionAn image segmentation system using active contour have been designed and implemented. The experiment results showthat active contour can be well used for image segmentation. Choices of parameter values might affect the result of thesegmentation. The higher the value of alpha and beta, the closer the converged contour to the object, although the valueof beta is not as significant as the value of alpha. The greater the value of delta, the faster the contour moves to thedesired object. In addition, some preprocessing may improve the performance of the segmentation.

Bibliography[1]

 

Davatzikos, C. A., & Prince, J. L. (1995). An Active Contour Model for Mapping the Cortex.  IEEE Transactionson Medical Imaging, 14(1), 65-80.

[2]  Kass, M., Witkin, A., & Terzopoulos, D. (1988). Snakes: Active Contour Models.  International Journal ofComputer Vision, 1, 321-331.

[3]  King, P., Mitra, S., & Nutter, B. (2004). An Automated, Segmentation-Based, Rigid Registration System ForCervigram/Spl Trade/ Images Utilizing Simple Clustering and Active Contour Techniques. In 17th IEEESymposium on Computer-Based Medical Systems. Proceedings (pp. 292-297).

[4]  Lee, S.-Y., Chwa, K.-Y., Shin, S. Y., & Wolberg, G. (1995). Image Metamorphosis Using Snakes and Free-Form

Deformations. ACM , 439-448.[5]   Nixon, M., & Aguado, A. (2002). Feature Extraction and Image Processing . Oxford: Newnes.[6]  Wang, H., & Ghosh, B. (2000). Geometric active deformable models in shape modeling.  IEEE Transactions on

 Image Processing, 9(2), 302 - 308.