Region Segmentation

Seed Pixel Selection

Since the color information is kept in 24 bits, there is the chance of obtaining  2^24   different color types. Because of such a large number, two main problems occurred:
i)     Number of colors is very large and finding the color that belongs to the  maximum number of pixels in the image (color that has the peak value in the histogram) requires very large memory block.
ii)     As the color range is very large (0 to  2^24 -1) very similar colors (i.e. 25,25,26 and 23,25,26 ) will be very apart in the histogram .
In order to solve these problems,  first of all, we tried to reduce this number. Hence, we shift each of the 8-bit RGB values by two bits to right in order to let colors have a closer representation. Then we can easily regard similar colors to belong to the same region.

We selected the color value corresponding to the peak element of the histogram of
2^18 color values. Calculating such an histogram requires:

(2^18)*sizeof(int) =  (2^18) * (2^2)  = 2^20 bytes = 1 MB memory

which is not very large but in order to reduce this number, instead of calculating the maximum by creating the histogram we performed several passes over the image and in each pass we count the number of  several color values.  In every iteration a maximum value is found. The overall maximum is the max. of these values. This process reduces the memory needed by (1/n) for n passes.
After selecting the color of seed pixel, next step is finding an appropriate place for the seed pixel. Choosing any pixel having the seed color would lead some error because that pixel could be a noise. We consider the colors of the neighbors of the candidate seed pixel as well. Pixels that fall into the 21 X 21 frame (having the candidate seed pixel in the center) are considered as neighbors.
While traversing a 21   21 frame over the entire image, we take the difference of color value of each pixel in the frame and the seed color value and sum these up. (The method of calculating the difference is explained later.) We determine the pixel, which has the minimum value of this sum as the seed pixel.
 

Similarity Criterion

Similarity criterion is the difference of two color values calculated as:

diff (( R1 ,G1 ,B 1),(R2,G2, B2 )) =sqrt( ( R1 - R2) ^2+ ( G1 - G2)^2 + ( B1 - B2) ^2  )
 

Preprocessing Procedure

First a 3x3 median filter is applied to the image in order to reduce the noise.  After performing noise reduction, we calculate the standard deviation of each color channel (RGB). Threshold value is calculated using these standard deviations. Threshold is proportional to the average of standard deviations of RBG channels. Constant of the proportion is determined by evaluating some candidate values. As described before, intensity values of RGB channels are shifted 2 bits right.
 

Appendix

1 0 -1
1 0 -1
1 0 -1
 Vertical Prewitt Filter Mask
 
 
1 1 1
0 0 0
-1 -1 -1
Horizontal Prewitt Filter Mask

Samples

Back to main page
 
 

Hosted by www.Geocities.ws

1