Segmentation using Codebook Index Statistics for Vector Quantized Images

In this paper, the segmentation using codebook index statistics (SUCIS) method is proposed for vector-quantized images. Three different codebooks are constructed according to the statistical characteristics (mean, variance, and gradient) of the codewords. Then they are employed to generate three different index images, which can be used to analyze the image contents including the homogeneous, edge, and texture blocks. An adaptive thresholding method is proposed to assign all image blocks in the compressed image to several disjoint regions with different characteristics. In order to make the segmentation result more accurate, two post-processing methods: the region merging and boundary smoothing schemes, are proposed. Finally, the pixel-wise segmentation result can be obtained by partitioning the image blocks at the single-pixel level. Experimental results demonstrate the effectiveness of the proposed SUCIS method on image segmentation, especially for the applications on object extraction. Keywords—image segmentation; vector quantization; index image; adaptive thresholding; codebook statistics


INTRODUCTION
Vector quantization (VQ) has been a simple, efficient and attractive image compression scheme since the past three decades [1], [2].The basic VQ scheme partitions an image into small blocks (vectors) and each vector is assigned by an index of the codeword in the codebook for encoding [3].If the indices of the codewords are arranged in a specific form, they can effectively represent the image characteristics in terms of image blocks.For example, Yeh proposed a content-based image retrieval algorithm for VQ images by analyzing the indices of codewords [4].Moreover, the correlations among these indices can be used to develop an efficient image segmentation scheme.Most of previous studies performed segmentation operations in the pixel level [5], [6].However, block-based image segmentation schemes can provide several advantages [7], [8].The block-based scheme is very suitable for the VQ-based image segmentation because VQ techniques usually divide an image into non-overlapping image blocks.Block-based segmentation schemes segment an image with blocks rather than pixels by considering the relative information of the neighboring image blocks.Large homogeneous regions can be detected by means of this technique.Moreover, the computational complexity can be saved by segmenting an image in the block level rather than in the pixel level.
In this paper, the segmentation using codeword index statistics (SUCIS) method is proposed for the vector quantized images.First, an image of size NN is divided into nonoverlapping image blocks of size BB.A training set of images is first used to generate an image codebook based on the wellknown Linde-Buzo-Gray (LBG) algorithm [1].The codewords in the image codebook are then sorted in an incremental order according to their mean, variance, and gradient to obtain three different codebooks.For a vector quantized image, the corresponding index from the sorting results is treated as a pixel's grayscale value to obtain the index image.Therefore, three corresponding index images can be obtained.An index image intrinsically demonstrate the correlations among image blocks, which can be used as the features to label image blocks into homogeneous, edge, or texture blocks.Several imagedependent threshold values are adaptively determined for region labeling.Then, a region number is assigned to all connected homogeneous blocks with the same label to obtain disjoint regions.Finally, the pixel-based image segmentation result can be obtained by partitioning the size of edge blocks further into the pixel level.
The rest of this paper is organized as follows: Section 2 deals with the proposed SUCIS method for VQ-coded images.Section 3 shows the experimental results for various test images.Conclusions are finally drawn in Section 4.  In the boundary-smoothing process, the boundaries of the image segmentation result can be more refined by smoothing the boundaries of regions of special interest.In the fifth stage, the result of boundary detection will be obtained by extracting the edge blocks in the image segmentation result.The final stage describes how to partition and assign the edge blocks from the block level to the pixel level.The segmentation results under the three different pixel levels will be obtained through assigning the edge blocks continuously.

A. Codeword Index Assignment and Index Image Generation
VQ is a generalization of scalar quantization to quantize a vector and a mapping of q-dimensional positive Euclidean space R q into a finite subset C of R q .Suppose that there are L codewords in the codebook.Let c i and C denote the codewords and codebook in VQ, respectively, where C={ c i | c i R q , for i = 0,1,…, L-1}.The subscript i is the index of the codeword and is represented as a b-bit (2 b = L) binary word.It is usually written as a decimal integer for notational brevity.
Figure 3 shows the flowchart of the proposed scheme for codebook generation.If the codeword c i is considered as a discrete random sequence X i =(c i,1 , c i,2 , …, c i,L ) and every random variable c i,k , k=1,2,…, L in X i is uniform distributed between 0 and 255 (because of the 8-bit resolution in digital images), then the J th moment of the random sequence X i is expressed by [9] where p(c i,k ) is the probability density function of the random variable c i,k [7].The codewords c i can be sorted in an incremental order based on their J th moment (where J=1, 2) to obtain c j(J) where j(J) is the rank of c i based on its J th moment.From a given image codebook C, two mapping functions between indices i and j(J) for mean J=1 and variance (J=2) are created.The first mapping function f 1 computes the mean value of the codewords in the codebook, where f 1 is a linear function.The second mapping function f 2 computes the variance value of the codewords, where f 2 is a nonlinear function.Moreover, the third mapping function f 3 computes the edge density of the codewords.Here, the edge density  i represents the texture feature of the i th 44 codeword.The edge density is defined as [10]: where T denotes the average gradient magnitude of all codewords.First, the mapping function f 1 is a straight line with unit slope because the codewords in the codebook C have been already sorted in the incremental order with mean.Alternatively, the codebooks C F1 , C F2 , and C F3 are directly derived from image codebook C if codewords are sorted according to their mean, variance, and gradient, respectively.The codewords in the three codebooks represent the different meanings.In the first codebook C F1 , the indices of the codewords distribute from low mean values to high mean values.In other two codebooks C F2 , and C F3 , the high indices of the codewords represent the edge and texture blocks in the test image, respectively.We utilize the codewords in the codebook to label the total homogeneous blocks in the test image.
If the index of the codeword is treated as the grayscale value of a pixel, then an NN image can be quantized into N/BN/B indices and be converted into the index images F 1 , F 2 and F 3 of size N/BN/B by the use of the codebooks C F1 , C F2 , and C F3 , respectively, based on the three different mapping functions f 1 , f 2 and f 3 .For the codebook whose size is larger than 256, to make the indices fall into the range between 1 and 256, the codewords in the codebook must be uniformly divided into 256 classes according to their incremental order.Therefore, numerous codewords can be represented by the same index.The characteristics of all image blocks in a test image can be classified into three typical image blocks.According to the characteristics in three index images F 1 , F 2 and F 3 , the regions and boundary of objects of our interest are extracted.The index image F 1 is a thumbnail version of the original image.It reveals the mean order of image blocks and is used to label all corresponding image blocks.The label of the image block is indeed the corresponding pixel value in the index image F 1 .Both the index images F 2 and F 3 strongly reveal the structural www.ijacsa.thesai.orgarrangement (edge and texture information) in the image blocks and are used to determine whether the image blocks belong to the homogeneous blocks or not.The larger values in the index images F 2 and F 3 represent that the gray-level distribution of an image block is closer to the edge or texture block.If the index image F 1 is used to label all image blocks and a region number is assigned to all connected image blocks to obtain disjoint regions, the rough segmentation result can be obtained and can be used as the initial segmentation result for the following pixel-based image segmentation problem.

B. Adaptive Thresholding for Block Labeling
To classify the image blocks in a VQ-coded image, the threshold values are employed.Here, two threshold values T M and T F for the mean and fused index images, respectively, are determined at first.The histogram of the index image F 1 is used to determine the initial threshold value T M .On the other hand, the histogram of fused index image (the fusion of index images F 2 and F 3 ) is used to determine the initial threshold value T F .In the image fusion method, the pixel values with the same position in two index images F 2 and F 3 are compared.Then, the larger value in the two pixels is chosen as the pixel value of the fused index image.The image fusion equation is given by Finally, the fused index image can be created by combining two index images F 2 and F 3 .The overall procedure of the parameter setting for the index image F 1 is as follows: Step 1: Compute the histogram of index image F 1 and its average value as the initial threshold value T M which is determined by Step 2: Determine the accumulated distribution of the histogram by gradually accumulating every five percent of total pixels in the index image.
Step 3: In order to obtain four regions with different grayscale distributions, two more threshold values T ML and T MH are calculated as follows: . 2 255 ; 2 Step 4: Calculate the difference values between the three average values T M , T ML , and T MH and every grayscale level in the accumulated distribution, respectively.
Step 5: Separately update these average values by using the grayscale levels that have the minimum difference among them, Step 6: Compute the differences between first and last three grayscale levels.Set T L and T H are equal to the first and last second grayscale levels, respectively, if the difference is the smallest.
If the pixel values are greater than T MH , these pixel values in the index image F 1 represent the light homogeneous blocks, On the other hand, if they are smaller than T ML , they represent the dark homogeneous blocks.The threshold values T H and T L are used to label the lightest and darkest homogeneous blocks, respectively.As mentioned above, we can employ these threshold values to label all homogeneous blocks in a VQcoded image.After all the homogeneous blocks in a VQ-coded image are labeled, some similar image blocks can be merged into the same region.Thus, we find that many different homogeneous regions spread over a VQ-coded image.Finally, the rough image segmentation result can be obtained.
In order to make the segmentation result more accurate, it must distinguish the edge and texture blocks separately from all image blocks in a test image.The index images F 2 and F 3 are employed to determine which image blocks belong to the edge and texture blocks, respectively.Finally, the edge blocks in the index image F 2 and the texture blocks in the index image F 3 are fused and used to generate a new index image F f by using Eq. ( 3).These pixel values in the index image F f represent the bright texture blocks, if the pixel values are greater than T F .On the other hand, they represent the dark texture blocks and are smaller than T F .After all texture blocks in a test image are labeled, some similar image blocks can be merged into the same region.The overall procedure of the parameter setting for the fused index image is similar to that used for the mean index image except that two threshold values T MH and T ML are not used here.
After we remove the labels of these image blocks in the rough segmentation result and mark them as edge or texture labels, the rest of image blocks which have labels in the rough segmentation result are called the homogeneous blocks.Finally, all image blocks in a test image are classified into three classes including the homogeneous, edge, and texture image blocks.In the post-processing, the region-merging process and boundary smoothing will be used to modify the rough image segmentation result.The region-merging process can avoid the over-segmentation for a test image.More accurate contours of the objects can be obtained by means of boundary smoothing.

C. Region Merging and Boundary Smoothing
As a result of the block classification and labeling shown above, the labels for all image blocks can be obtained.A region number can be assigned to all connected blocks [11].In numbering the connected blocks, we must check whether a candidate block and its neighboring blocks have the same label.In order to reduce the number of regions, the small-size and non-interested regions should be ignored such that the complete and large regions are left.For a given block, if the number of connected image blocks is less than a defined smallest region (SR) in a region, it will be merged into one of its neighboring regions.At the same time, the mean difference between a candidate region and one of its neighboring regions is also checked based on their corresponding codewords.A candidate region will be assigned to the neighboring region which has the smallest mean difference with the candidate region.Since only the large regions in a VQ-coded image are left, the number of regions can be reduced.Therefore, the www.ijacsa.thesai.orgrough segmentation result can be obtained and the oversegmentation problem can be avoided.
After the operation of region merging has been finished, we find that the boundaries of the large and interested regions in a VQ-coded image are unsmoothed, which may lead to the erroneous segmentation.The final segmentation result might not be accurate.Thus, to obtain the higher accurate segmentation result, the operation of boundary smoothing is used to refine the boundaries of the large and interested regions.The procedure of boundary smoothing is described as follows: First, all regions in a VQ-coded image are divided into two different type regions.If a region whose label of the only neighboring region is different from that of it, it is called the independent region.On the other hand, if a region whose labels of many neighboring regions are different from that of it, it is called the dependent region.Let a mask of size 33 be mapped to all regions in a VQ-coded image.Then, the ratio of every image blocks in a mask is computed.If a number of image blocks of objects in a mask of size 33 are smaller than that of its neighboring regions, then the image blocks that lies in the center position of a mask are merged into one of its neighboring regions.Otherwise, the image blocks will not be changed.The above steps are repeatedly executed until the image blocks of all regions in a VQ-coded image are never changed again.Finally, the boundary smoothing results can be obtained.

D. Assignments of Edge Blocks
Here we describe how to assign the edge blocks and to refine the segmentation results from the block level to pixel level.There are many homogeneous and texture regions in a test image and the image blocks in their boundaries are labeled as the edge blocks.Figure 4(a) shows two different regions, where Region I and Region II stand for the object region and the background region, respectively.Figure 4(b) shows the boundaries in the object region that is labeled as the edge blocks, where every edge block is of size 44.After all edge blocks have been labeled, they are partitioned into half size and assigned to one of its neighboring regions.The procedure of assignments of edge blocks is described as follows: First, the mean difference between a candidate edge block and each of its neighboring (4-connected neighbors [12]) regions is examined based on their corresponding codewords.Then, a candidate edge block will be assigned to the neighboring region which has the smallest mean difference with it.The size of edge blocks can be reduced to be its sub-level.As the size of edge blocks is reduced, the contour of objects can be more accurate.
Finally, the refined image segmentation result can be obtained when none of the edge block is left.The segmentation results for three different levels from the block level to the pixel level can be obtained.The basic units for assignment in the Level-0, Level-1, and Level-2 segmentation results are the blocks of size 44, 22, and single pixel, respectively.The proposed SUCIS method is compared with the benchmark watershed method [13] to verify the effectiveness especially for the foreground object segmentation.Four test images downloaded from the Berkeley Segmentation Dataset [14] are utilized in our experiments.Figures 12(a

IV. CONCLUSIONS
In this paper, the SUCIS method is proposed based on the index statistics of VQ-coded images to perform the image segmentation especially for the VQ-coded images.The SUCIS method uses three different index images to label and classify image blocks in a VQ-coded image and distinguish them into homogeneous, edge, and texture blocks to obtain disjoint regions such that the result can be obtained.Although our SUCIS method segments an image in terms of blocks rather than pixels, the pixel-based segmentation result can be obtained by partitioning the edge blocks into the half size and assigning to one of their neighbor regions until to the pixel level.Moreover, the computational complexity can be reduced by segmenting images in the compressed domain and with blocks rather than pixels.In summary, the proposed SUCIS method is effective and efficient for image segmentation and the results can be applied on VQ-based image/video coding schemes.Our future work may focus on extracting the objects from the segmented results and/or describing the semantic meanings in the processed images.The proposed method may be extended by cooperating the local robust statistics [15] or the machine leaning methods based on the artificial neural network [16] and fuzzy theory [17].The effectiveness of applying the proposed SUCIS method onto the medical image processing [16], [18] can be investigated as well.

Fig. 1 .Figure 1
Fig. 1.The schematic diagram of the proposed SUCIS method II.THE PROPOSED METHOD Figure1shows the block diagram of the overall image segmentation system by using the proposed SUCIS method.The overall system consists of six stages: (1) codebook generation, (2) VQ encoding, (3) index image generation, (4) region labeling, merging, and boundary smoothing,(5)

Fig. 9 .Fig. 10 .Fig. 11 .
Fig. 9. Boundary detection results for the (a) Lena and (b) Tower images ), 12(c), 12(e), and 12(g) show the segmentation results of the proposed SUCIS method.By using the watershed function provided in MATLAB, Figs.12(b), 12(d), 12(f), and 12(h) show the segmentation results of the watershed method.As shown in both figures, the foreground objects can be successfully segmented.In Figs.12(a) and 12(b), the proposed method also segments the tree branches in addition to the mother bird.The most difference results are shown in Figs.12(e) and 12(f).The proposed method segment the foreground only in one region, while the watershed method can segment the more detail shapes for the owls.www.ijacsa.thesai.org

Fig. 12 .
Fig. 12.Comparison of the segmentation results between the proposed SUCIS and the watershed methods: (a), (c), (e), (g) are the level-2 results of the proposed SUCIS method and (b), (d), (f), (h) are the results of the watershed method

TABLE I .
THE PARAMETER LIST FOR TWO TEST IMAGES