An Evolved Image Segmentation Technique for Gradient Detection and Outside Markers

Fahad Al Ghazali1

Computer Engineering Department, Center for Advanced Studies in Engineering, Pakistan CASE, G-5/1 , Islamabad

Abstract— In this paper, an evolved image segmentation technique is presented, which incorporates watershed segmentation and a modified graph based segmentation technique. The presented algorithm successfully solves the inability of watershed transforms to segment regions having gradually changing gray level shades or segments having granularity in their outlook. Furthermore, the algorithm also paints inside outside markers on most prominent regions which reduce over-segmentation, which is another observed problem with watershed technique. The algorithm has been simulated and tested using MATLAB code and it has been shown in this paper, that the proposed algorithm reduces the above mentioned problems in watershed technique. The applications of this algorithm can be in all the fields related to image segmentation. Keywords— Watersheds, Image segmentation, granularity, gradient, markers

smoothed version of the gradient magnitude image (which also makes it usable with colour images). This ends up finding smooth regions separated by visible (higher gradient) boundaries. Since such boundaries are what active contours usually follow, pre-computing such a segmentation using either watershed or the related tobogganing technique is often used in active contour algorithms as in [3]. Unfortunately, watershed segmentation associates a unique region with each local minimum, which can lead to over-segmentation, [4]. Watershed segmentation is therefore often used as part of an interactive system, where the user first marks seed locations (with a click or a short stroke) that correspond to the centres of different desired components. Fig. 1 shows the results of images after going through watershed transformation.

I. INTRODUCTION Region based segmentation is a very powerful concept for region based image segmentation. A. Region Based Segmentation Region segmentation is the task of finding groups of pixels that “go together”. In statistics, this problem is known as cluster analysis and is a widely studied area with hundreds of different algorithms. In computer vision, image segmentation is one of the oldest and most widely studied problems. Early techniques tend to use region splitting or merging, which correspond to divisive and agglomerative algorithms in the clustering literature. More recent algorithms often optimize some global criterion, such as intra-region consistency and inter-region boundary lengths or dissimilarity as in [1]. B. Watershed A technique related to thresholding, since it operates on a grayscale image, is watershed computation [2]. This technique segments an image into several catchment basins, which are the regions of an image (interpreted as a height field or landscape) where rain would flow into the same lake. An efficient way to compute such regions is to start flooding the landscape at all of the local minima and to label ridges wherever different evolving components meet. The whole algorithm can be implemented using a priority queue of pixels and breadth-first search [2] Since images rarely have dark regions separated by lighter ridges, watershed segmentation is usually applied to a

Fig. 1 a)The original image of famous cameraman.tif b)The cameraman.tif after watershed transformation, it can be observed that it has been over-segmented and the background is not identifiable

Furthermore, if there is an image region, in which there is continuous change in shades of gray levels, just like a gradient textured image, the watershed is observed to be unable to detect it as an independent segment. Similarly, as the watershed works on immersion of topographic image through water, it is also unable to properly detect the objects, which have granulated colour or outlook. It means that, when an object has a colour which has all gray levels randomly distributed over its body, the watershed also finds it hard to declare it as an independent region. This remains the case, no matter how much granulated, the coloured object is distinguishable from its vicinity through human visual system. One way can be to pass the image through the averaging filter, as it would subdue the object’s granular shade. Even after this modification in procedure, it has been observed that,

watershed technique doesn’t declare it as an independent segment. Fig.2 illustrates this problem. Here we have an image with 3 distinct regions. On the left side, we have a region in which the shade of the region is continuously decreasing. Then, there is a second region in the right, within, which there is a region that possesses a shade, which is continuously and randomly varying. Human visual system easily distinguishes, that there are three regions in this image, but it has been a great challenge for computer vision algorithms.

minimum. b) The catchment basins which are the points at which a drop of water, if placed at any of those locations, would fall to a single minimum. c) Watershed lines will be combination of points at which water will be equally likely to fall to more than one such minimum. Once these points are found, the decisions of regions are made utilizing computations based on neighbourhood connectivity and sorting. The mathematical details of this algorithm are provided in [2] & [4]. III. THE PROPOSED ALGORITHM In this part, the proposed sequence of algorithm is presented in detail. In the first step, the image I(x,y) is taken as an input to the algorithm. The image is first passed through Laplacian and averaging filters. Laplacian filter is a very efficient technique for edge detection as it highlights and segments parts which have high gradient. The averaging or mean filter is applied to reduce noisy part of the image and to smooth out the parts of the images which have high granular shade. Then this image ILM(x,y) obtained after passing the original image through laplacian and averaging filters is given to watershed transform. The watershed transformed image is in a form which shows the proposed edges in low gray scale levels. The watershed transformed image Iw(x,y) is then thresholded in order to give clear edge points, i.e. the edge points which depict boundaries of objects and have gray scale level of zero. This thresholded image is now Iw_th(x,y) The resultant image from the previous transformations Iw(x,y) are processed through the proposed algorithm. In this algorithm the edge points from Iw_th(x,y)are extracted and stored in an array edge_points[n,2], in which n is the number of edge points and are number of rows in the array. The second order ‘2’ is the number of columns of the array and store x and y coordinates of the edge points. The array edge_points[n,2] is used for the analysis of the original input image I(x,y) again. From the original image I(x,y), the grayscale levels of the pixel points, pointed by edge_points[n,2] are taken. Finally, the whole of the image is scanned again at each location pointed by edge_points[n,2]and a vicinity check is performed. This vicinity check inspects that whether the pixel points lying adjacent to the edge_points[n,2], declared by the first part of the algorithm, have sufficient intensity differences with neighbouring pixels or not. For each of the edge_points[i,2],if the difference

Fig. 2 a) The original showing three distinct regions with one segment having continuous shade, the other with granular shade b)The image after passing through watershed transformation technique

C. Graph-based Segmentation While many merging algorithms simply apply a fixed rule to group pixels and regions together, [1] present a merging algorithm that uses relative dissimilarities between regions to determine which ones should be merged, which produces an algorithm that provably optimizes a global grouping metric. They start with a pixel-to-pixel dissimilarity measure w(e) such as intensity differences between N8 neighbors. (Alternatively, they also use the joint feature space distances introduced by Comaniciu and Meer, [5]). In the proposed algorithm, this approach of finding relative dissimilarities between regions is taken and modified such that it not only counts on dissimilarities, but also on the relative and sufficient similarities of adjacent regions to give finalized version of segmented image. II. WATERSHED TRANSFORM CONCEPTS & TERMINOLOGIES In the watershed transform, the starting point of the algorithm is taken as the topographic interpretation of the image, which is a 3-D graph, with x and y coordinates of the image placed on the horizontal plane and in the vertical direction, corresponding intensity levels of the image are plotted. In this way, we get an interpretation in which high intensity values of the images can be observed in terms of peaks. The low intensity values can be observed in terms of valleys and the pixels with intermediate intensities can be viewed as slopes to the peaks. This is quite an efficient way of observing image such that we can have an idea of the image’s gradients as well. The whole watershed technique is based on the immersion or flooding of this artificial landscape in water, which is followed by detection of edges and regions which survive this flooding. Here, the total points can be divided into three main categories. a)Points belonging to a regional



is found to be less than a threshold value, the edge_points[n,2] are modified to new coordinate values. Otherwise, the edge_points[n,2]. This process is repeated for every single of the edge points. IV. THE FLOWCHART OF THE ALGORITHM Fig.3 depicts the steps involved in the proposed algorithm


Pixel Vales at Edge Points

Application of Laplacian and Averaging Filter Watershed Transformation

Subtraction of the pixel values at edge points and the pixel values at their neighbouring pixels

Thresholding of the Watershed Transformed image

Difference >Threshold Value

No Yes

Fig. 5 a) Image algorithm

b) After Watershed c) After Proposed

Maintain Edge Points

Edge Points
Update Edge Points

Similarly, the proposed algorithm performs in the same manner with the cameraman.tif shown in Fig.1. Fig. 6 depicts that how the proposed algorithm is able to distinguish the camera rods, along with the background and sketches a marker around the boundary of the cameraman.

Fig. 3

The Flowchart of the algorithm

V. RESULTS The results show that the proposed algorithm is able to detect distinct segments of images which have grayscale levels which are constantly and continuously changing, as well as those which have granular colours. Moreover, the proposed algorithm reduces the effect of over segmentation such that the resultant image possesses a distinct marker like structure around prominent and foreground objects. Fig. 4 shows the results of the image shown in fig. 2 after processed by the proposed algorithm. It can be observed that the algorithm successfully differentiates the three segments in the image.

Fig. 6 a) The cameraman Image b) After processing through the proposed algorithm VI. CONCLUSIONS The algorithm presented in this paper gives the intended results quite efficiently, however, the algorithm is to be tested with large number of images to prove its use for medical images as well. Further changes in the algorithm on hit and trial basis can be performed to remove tiny grains from the result images which appear around the judged edges. REFERENCES
[1] “Felzenszwalb, P. F. and Huttenlocher, D. P. (2004b). Efficient graphbased image segmentation. International Journal of Computer Vision, 59(2), 167–181.” (“Vincent, L. and Soille, P. (1991). Watersheds in digital spaces: An efficient algorithm based on immersion simulations. IEEE Transactions on Pattern Analysis and Machine Intelligence, 13(6), 583–596.”) Mortensen, E. N. and Barrett, W. A. (1999). Toboggan-based intelligent scissors with a four parameter edge model. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’99), pages 452–458, Fort Collins. Beare, R. (2006). A locally constrained watershed transform. IEEE Transactions on Pattern Analysis and Machine Intelligence, 28(7), 1063–1074.

[2] Fig. 4 a) The original image proposed algorithm b) The image after going through the

Fig. 5 depicts the image of a person in which watershed segmentation is unable to clearly segment all the parts of the image. The proposed algorithm differentiates the major segments and also creates the marker like structure around the edge of the face of the man.




Comaniciu, D. and Meer, P. (2002). Mean shift: A robust approach toward feature space analysis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 24(5), 603–619.

Sign up to vote on this title
UsefulNot useful