Image Segmentation and Detection Using Watershed Transform and Region Based Image Retrieval
Image Segmentation and Detection Using Watershed Transform and Region Based Image Retrieval
Image Segmentation and Detection Using Watershed Transform and Region Based Image Retrieval
Web Site: www.ijettcs.org Email: [email protected], [email protected] Volume 2, Issue 2, March April 2013 ISSN 2278-6856
Image Segmentation and Detection using Watershed Transform and Region Based Image Retrieval
Niket Amoda1, Ramesh K Kulkarni2
1
Department of Electronics and Telecommunication Engineering, Vivekanand Institute of Technology, University of Mumbai, M.G. Road Fort, Mumbai, India
example or sketch and those of the images in the database are then calculated and retrieval is performed with the aid of an indexing scheme. The indexing scheme provides an efficient way to search the image database. Recent retrieval systems have incorporated users' relevance feedback to modify the retrieval process in order to generate perceptually and semantically more meaningful retrieval results. A visual content descriptor can be either global or local. A global descriptor uses the visual features of the whole image, whereas a local descriptor uses the visual features of regions or objects to describe the image content. To obtain the local visual descriptors, an image is often divided into parts first. Some of the widely used techniques for extracting color, texture, shape and spatial relationship features from images are now described briefly. There are two generally used methods for image segmentation: discontinuity based method and similarity based methods. 1.1Discontinuity Detection Methods The interface between two different contiguous homogeneous regions is usually marked by a discontinuity in grey-level, colour or texture. Grey-level discontinuities can be located using simple edge detectors that look for local gradient maxima. The gradient of an image function f(x, y) at location (x, y) is given by:
Keywords: Content based image retrieval, K-Means Algorithm, Discrete Wavelet Transform, Region Based Image Retrieval.
1. INTRODUCTION
Early image retrieval techniques were based on textual annotation of images. Content based image retrieval, uses the visual contents of an image such as color, shape, texture, and spatial layout to represent and index the image. In typical content based image retrieval systems, the visual contents of the images in the database are extracted and described by multi-dimensional feature vectors. The feature vectors of the images in the database form a feature database. To retrieve images, users provide the retrieval system with example images or sketched figures. The system then changes these examples into its internal representation of feature vectors. The similarities / distances between the feature vectors of the query Volume 2, Issue 2 March April 2013 (1)
1.2Similarity Based Methods Similarity based methods of segmentation are based on similarity comparison between pixel and regions. There are four commonly used similarity based segmentation techniques: Thresholding, Region Growing, Region Splitting and Merging and Clustering.
Read Images into the Database Resize each Image to size 128*192
Implement k-means clustering algorithm on 3-D Wavelet coefficients of Approximation Subband of last Level Using the Mask obtained after Clustering, extract Regions from the 4 Subbands of the last Level
Calculate the Size, Mean and Covariance of each Region and store in Feature Database
Stop Figure: 1 Flow Diagram The algorithm requires that all the images in the database and the query image be of the same size. A size of 128*192 was chosen for all of the images. If the image had a different size, it was first resized to 128*192 and then the pre-processing operations were carried out on the image. In the RBIR application, each image is divided into the corresponding color channels (i.e. H, S and V) and the DWT was applied separately to each color channel. The jth Wavelet coefficient of subband B (B {LL, LH, HL, HH}, where L stands for low and H for high) Volume 2, Issue 2 March April 2013
Compute Region Similarity Scores between each region of Query Image and all regions of Database Images
Stop Figure: 3 Flow Diagram After reading the query image, the same pre-processing operations of image resizing, RGB to HSV conversion, DWT decomposition, Watershed clustering and feature extraction must be performed on the query image. At the end of the pre-processing operation, the sizes, mean vectors and covariance matrices of the regions of the query image would be obtained.
3. IMPEMENTATION
The watershed transformation is performed on a gradient image g extracted from the original image However the problem with the conventional intensity gradient is it is not able to detect the interfaces between homogeneously textured image regions. This is because the gradient image highlights the variations within the textures rather than showing the change between textured regions, as shown in Figure 4 below. A Texture Gradient is therefore Volume 2, Issue 2 March April 2013
4(a) Original Texture Image 4(b) Intensity Gradient Fig: 4 Gradient of Texture Image A marker based method is used to control the oversegmentation. The various steps involved in marker controlled watershed segmentation are shown below. Step 1: The first step is to read the combined Texture and Intensity Gradient. Step 2: Next step is to compute the Foreground Markers. These are connected blobs of pixels within each of the objects in the image. A variety of procedures could be applied to find the Foreground Markers. In the present work, morphological techniques called "opening-byreconstruction" and "closing-by-reconstruction" are used to "clean" up the image. These operations will create flat maxima inside each object. Opening-by-reconstruction is erosion followed by a morphological reconstruction whereas closing-by-reconstruction is dilation followed by morphological reconstruction. These operations will remove small blemishes without affecting the overall shapes of the objects. Good Foreground Markers can be obtained by computing the regional maxima of the resulting Gradient Image. Step 3: Some of the mostly-covered and shadowed objects will not be marked in the previous step, which means that these objects will not be segmented properly in the end result. Also, the Foreground Markers in some objects go right up to the objects' edge. Hence it is necessary to clean the edges of the marker blobs and then shrink them a bit. This can be done by a closing followed by erosion. This procedure tends to leave some stray isolated pixels that must be removed. Step 4: Next the background locations need to be marked. In the cleaned-up image, the dark pixels belong to the background, so thresholding is a suitable operation to start with. Step 5: The background pixels will be in black, but ideally the background markers shouldnt be too close to the edges of the objects that are being segmented. So the next step is to "thin" the background by computing the "skeleton by influence zones", or SKIZ, of the foreground. This can be done by computing the watershed transform of the distance transform of thresholded image, and then looking for the watershed ridge lines of the result. Step 6: The next step is to modify the Gradient Image so that it has regional minima only in certain desired locations i.e. at the Foreground and Background Marker pixels. Step 7: The final step is to give this Modified Gradient Image as input to the Watershed Transform Algorithm. Page 91
4. RESULT
The Figure7 below shows the results of segmenting the Lena test image and the Peacock test image using the texture gradient based watershed segmentation technique. The results show that this technique produces effective intensity and texture based segmentation of natural images.
Figure: 7(b) Peacock Test Image Figure: 7 Result of segmenting the Lena and Peacock Test Images 4.1 Comparison of Watershed segmentation with Kmeans clustering using a football test image Figure: 5 Feature Database population 3.2 Image Retrieval : The steps involved in searching for images are: 1) Start the Region Based Image Retrieval program. A GUI appears as shown in Figure 6 (a). 2) Select a query image from the folder Image_Query. 3) The query image will be displayed Figure 6 (b) along with the 16 matches of the most similar images available in the database. Figure: 8(a) Football Test Image
Figure: 6(a)
Figure: 6(b)
Figure: 6 Region Based Image Retrieval Volume 2, Issue 2 March April 2013 Page 92
Figure: 8 (c) Regions obtained using Watershed Segmentation Figure: 8 Results of segmentation Football Test Image The experimental setup used was a PC with a 3.0 GHz Pentium 4 Processor and 512 MB of DDR 400 RAM running MATLAB 7 on Windows XP Professional.
Time Taken for Segmentation (seconds) K-means Watershed Clustering Segmentation 1.6410 (k=2) 7.0780 (k=2) 4.3590 24.3600
Figure: 10 Partial Match Quering 4.3 Scanned Queries If the query image is scanned, it may suffer artifacts such as color shift, poor resolution, dithering effects, and misregistration. To consider the effect of scanned images on the retrieval effectiveness, the query image was first printed and then subsequently scanned. The scanned image appeared fuzzier, darker and slightly misregistered compared to the original. Figures 11 (a) and (b) show the results obtained with the original query image and the scanned query image respectively. It can be observed that there is a slight degradation in the quality of the results obtained.
Image
Football Lena
To test the RBIR application, a database consisting of 180 general images, was used. The 180 images could roughly be categorized into 9 groups, each group consisting of 20 similar images. In addition 9 query images, each query corresponding to one of the groups were taken. Figure 9 shows an example of the results obtained with the RBIR application. From a semantic point of view, the results obtained are particularly good i.e. all the images in this particular example are of horses.
Figure: 9 RBIR Results 4.2 Partial Match Queries A partial match query is a query that specifies only part of the image. In Figure 10, the query image is obtained by cropping a database image. As the results show, the RBIR application gave the complete image as the very first match.
Figure: 11 (b) Result with Scanned Query Figure: 11 Scanned Queries 4.4 Difficult Queries
Page 93
The effectiveness of the RBIR application is confirmed when considering difficult queries, i.e. queries having a low number of similar images in the database. Figure 12 shows the results for a query having only two similar images in the database. The RBIR system is able to retrieves both of these images.
Figure: 12 Difficult Queries 4.4 Search Time For an image retrieval application, the time taken for retrieval is an extremely important parameter. On the other hand, the time taken for pre-processing is not as important since the pre-processing operations have to be carried out only once. The first entry in table below shows the average time taken to perform the pre-processing operations on the database of 180 images of size 128*192. The second entry shows the average time taken during the image retrieval phase. Here again, the query image was of size 128*192. The experimental setup consisted of a PC with a 3.0 GHz Pentium 4 processor and 512 MB of DDR 400 RAM running MATLAB 7 on Windows XP Professional.
Pre-processing Stage Image Retrieval Stage 25.2 seconds 1.7 seconds
5.
CONCLUSIONS
From the above experiment, it is clear that the watershed segmentation technique takes about three times the time taken by the k-means clustering technique. Although the HSV color space was found to give better results compared to the RGB color space in, in our experiments the RGB and HSV color spaces were found to give almost equivalent results. Eventually, it was decided to use the HSV color space because it gave better results than the RGB color space in case of difficult queries. The figure below shows that when using the RGB color space, only one of the two matches was retrieved. On the other hand, in the HSV color space, both the matches were retrieved. REFERENCES [1] D. Lowe, Object recognition from local scaleinvariant features, in ICCV, 1999, pp. 11501157. Volume 2, Issue 2 March April 2013 Page 94