Anda di halaman 1dari 6

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006

SNSI06-047

IMAGE SEGMENTATION USING ACTIVE CONTOUR (SNAKE)


Cherry Ballangan1) Rudy Adipranata2) William Nugroho
Informatics Department, Petra Christian University, Surabaya
cherry@peter.petra.ac.id1) rudya@peter.petra.ac.id2)
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, 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

E snake = Eint (v( s)) + Eimg (v( s)) + Econ (v( s))ds
s =0

where:

E snake is the energy function of the active contour from which an object is detected.
v(s ) is the contour (curve).
Eint is the internal energy of the active contour affecting the motion of the contour.
Eimg is energy from the input image including low level features such as edge points.
296

(1)

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006

SNSI06-047

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

Eint is given by:

Eint = ( s )

dv ( s )

2
+ (s)

ds

2
d v(s)
ds

(2)

where:
The derivative dv ( s ) / ds calculates the energy affecting the elasticity of the contour.
(s ) is the parameter for elasticity.

The second derivative d v ( s ) / ds 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]:

Ax = f x ( x , y )
where

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

0
...
a1
b1
c1 d1 e1
b
0
...
a 2
2 c 2 d 2 e2
a3 b3 c3 d 3
0
...
e3

A = 0 ... ... ...


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

e s 1 0 ... a s 1 bs 1 c s 1 d s 1
d
...
as
bs
c s
s es 0
The values of a, b, c, d and e can be obtained by using the following equations:

as =

(3)

s 1
h

bs =

(4)

2( s + s 1 ) s


2( s +1 + s ) s +1

2 c s = s +1 4s s 1 + s +12 s d s =
2 e s = s4+1
4
4
h
h
h
h
h
h
h

where s represents the index of the contour points and h is the space between points in the contour. An iterative solution
can then be formulated as follows:
1
1 1 (i )

( i +1)
(5)
x
=A+ I x
+ f x ( x, y )

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 the
contour points can be obtained in similar way using the following equation:
1
1 1 (i )

( i +1)
(6)
y
= A+ I y
+ f y ( x, y )

3.

Segmentation Method

The proposed image segmentation method consists of four main steps: preprocessing, initialization, parameter
calculation, 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 to
enhance the result.
Gray scaling is a process to convert a colored image, e.g. RGB image, into a gray level image. There are many different
approaches 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.
297

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006

SNSI06-047

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 image
with 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 the
initialization of the active contour (initial contour) and also the initialization of the matrix that is needed to deform the
contour (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 part
of 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 in
Equations 5 and 6. The flowchart of this step is given in Figure 2.

4.

Result and Discussion

The 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 in
Figure 4, for various values of alpha, Figure 5, for various values of beta, and Figure 6, for various values of delta.

298

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006

SNSI06-047

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 5
shows 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.

299

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006

Alpha 0,1

Alpha 0,3

SNSI06-047

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 presented
in Figure 7 for the preprocessing invert process and in Figure for the threshold process. Preprocessing invert is important
when 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.

300

Seminar Nasional Sistem dan Informatika 2006; Bali, November 17, 2006

SNSI06-047

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.

Conclusion

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

Bibliography
[1]
[2]
[3]
[4]
[5]
[6]

Davatzikos, C. A., & Prince, J. L. (1995). An Active Contour Model for Mapping the Cortex. IEEE Transactions
on Medical Imaging, 14(1), 65-80.
Kass, M., Witkin, A., & Terzopoulos, D. (1988). Snakes: Active Contour Models. International Journal of
Computer Vision, 1, 321-331.
King, P., Mitra, S., & Nutter, B. (2004). An Automated, Segmentation-Based, Rigid Registration System For
Cervigram/Spl Trade/ Images Utilizing Simple Clustering and Active Contour Techniques. In 17th IEEE
Symposium on Computer-Based Medical Systems. Proceedings (pp. 292-297).
Lee, S.-Y., Chwa, K.-Y., Shin, S. Y., & Wolberg, G. (1995). Image Metamorphosis Using Snakes and Free-Form
Deformations. ACM, 439-448.
Nixon, M., & Aguado, A. (2002). Feature Extraction and Image Processing. Oxford: Newnes.
Wang, H., & Ghosh, B. (2000). Geometric active deformable models in shape modeling. IEEE Transactions on
Image Processing, 9(2), 302 - 308.

301

Anda mungkin juga menyukai