You are on page 1of 2

# XI International PhD Workshop OWD 2009, 1720 October 2009

## Tibor Moravk, University of ilina

Abstract

The task of image segmentation is a first step in many computer vision methods. The paper deals with image segmentation methods with application in programming environment Matlab. Next are described some chosen algorithms and their advantages and disadvantages.
1. Introduction

It is widely used in simple applications. In brightness threshold, all the pixels brighter than a specified brightness level are taken as 1 and rest are left 0. In this way we get a binary image with useful image as 1 and unwanted as 0. Sufficient contrast on objects and background is necessary to do the thresholding [2]. Thresholding is the transformation of an input image / to an output binary image g as follows: (1) where T is the threshold, g(i, j) = 1 for image elements of objects, and g(i, j) = 0 for image elements of the background. In Matlab is converting gray scale image to binary, based on threshold (Fig.1) realized by function im2bw(I, level). I is input image and level specify threshold in the range [0, 1]

Main goal of image segmentation is to divide an image into parts that have a strong correlation with objects or areas of the real world contained in the image. In image processing useful pixels in the image are separated from the rest. The result of image segmentation is a set of segments that collectively cover the entire image, or a set of contours extracted from the image [1]. A segmentation could be used for object recognition, occlusion boundary estimation, image compression, image editing, etc. Many segmentation problems can be solved successfully using lower-level processing only (e.g. contrasted printed characters). Complex scene as face detection is processed then cooperation with higher processing levels which use specific knowledge of the problem domain is necessary. Matlab is a popular Mathematical Programming Environment. Matlab can be used for operations with images through special toolbox Image Processing that provides an algorithms and graphical tools for image processing, analysis, visualization, and algorithm development. In this paper are described possibilities of image segmentation with Matlab. There are many problems that can occur during image segmentation related with ambiguity of image data (complexity of objects, non-uniform color and intensity, shadows, reflections). Threshold and Edge detection are the two most common image segmentation techniques. More complex method witch I presented in this paper is Perceptual color image segmentation based on kmeans clustering. Matlab provide functions to perform this methods.
2. Thresholding

a)

b)

Fig.1. Thresholding s egmenta tion: a) original image, b) thr eshold seg mentation,

Threshold can by estimate experimentally or can be compute automatically from histogram by function level = graythresh(I). This function uses Otsu's method, which chooses the threshold to minimize the variance of the black and white pixels and finding threshold at the minimum between the histograms peaks. For non-uniform lighting images are using variable tresholds in which the threshold value varies over the. Thresholds are determine independently in each subimage and is then processed with respect to its local threshold.
3. Edge-based segmentation

In edge detection special algorithms are used to detect edges of objects in the image. Edges mark image locations of discontinuities in gray-level, color, texture, etc. Edges typically occur on the boundary between two different regions in an image. There are

469

a number of algorithms for this, but these may be classified as derivative based where the algorithm takes first or second derivative on each pixel or gradient based where a gradient of consecutive pixels is taken in x and y direction. Operation called kernel operation is usually carried out. A kernel is a small matrix sliding over the image matrix containing coefficients which are multiplied to corresponding image matrix elements [1]. Function that provides edge detection in Matlab is edge BW = edge(I, method). Supported methods of edge-detection are gradient-magnitude methods Sobel (Fig.2a), Prewitt, Roberts, next zero-crossings, Laplacian and Canny method (Fig.2b). The Canny method applies two thresholds to the gradient: a high threshold for low edge sensitivity and a low threshold for high edge sensitivity. This helps fill in gaps in the detected edges. Sobel method applying following two kernels [4]: -1 Sx= -2 -1 0 0 0 1 2 1 1 Sy= 0 -1 2 0 -2 1 0 -1

larger clusters. They create master segments (Fig.3b). It iterates through the group of clusters and for each small cluster finds all neighboring clusters(Fig.3c) [3].

a)

b)

c)

Fig.3. perceptual image seg mentation algorith m: a ) original image, b) res ult of k- mea ns seg ments; c) final segments a fter s egmentation

5. Conclusion

## The resultant matrix is then obtained:

M (i, j ) = S x + S y
2

(2)

a)

b)

## Fig.2. Edge-detection: a) Sob el method, b ) cann y method

The three image segmentation methods presented in this paper are the methods used in practice and they give good results for specific application. All methods were implemented in MATLAB. Threshold segmentation is good for simple images. If objects do not touch each other, and if their gray-levels are clearly distinct from background, thresholding is a suitable segmentation method. Thresholding is computationally inexpensive and fast. Edge-based segmentation is the earliest segmentation approaches and still remains very important. The more prior information that is available to the segmentation process, the better the segmentation results that can be obtained. The most common problems of edgebased segmentation, caused by image noise or unsuitable information in an image. The perceptual color image segmentation algorithm is slow and has larger segments, but has better results in complex images.
Bibliography

The image resulting from edge detection cannot be used as a segmentation result. Supplementary processing steps must follow to combine edges into edge chains that correspond better with borders.
4. Perceptual color image segmentation

This segmentation method use K-means clustering. The k-means is an iterative technique that is used to partition an image into K disjoint clusters with numerical attributes. K is positive number and indicates number of searched objects in image. The basic algorithm is: This iterative partitioning minimizes the sum, over all clusters, of the withincluster sums of point-to-cluster-centroid distances. By default, k-means uses squared Euclidean distances. IDX = kmeans(X, k) partitions the points in the n-by-p data matrix X into k clusters. After k-means clustering the image is partitioned into large group of small clusters. The small clusters are in the next step used to form an initial set of

[1] Sonka M., Hlavac V., Boyle R.: Image Processing, Analysis and Machine Vision. Thomson, 2008 [2] onka, M., Hlav V.: Potaov viden, Grada, Praha, 1992 [3] Luk P., Beno M., Hudec R., Dubcov Z.: Color image segmentation for retrieval in large image databases, Conference Transcom 2009, 22-24 June 2009, ilina [4] http://www.mathworks.com/
Author:

Ing. Tibor Moravk University of ilina ul. univerzitn 1 010 26 ilina, Slovakia tel. +421 (0)41/513 3306 email: tibor.moravcik@fel.uniza.sk

470