You are on page 1of 5

Uniform Color Quantization

Pi19404
February 12, 2013

Contents

Contents
Uniform Color Quantization
0.1 Abstract . . . . 0.2 Uniform Color 0.3 Code . . . . . . References . . . . . . . . . . . . . . Quantization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
3 3 5 5

2 | 5

Uniform Color Quantization

Uniform Color Quantization


0.1 Abstract
In Image processing Color Quantization reducing the number of distinct colors distorting the original image . Color for purposes of image compression or segmentation applications. refers to the process of used in the image without Quantization can be used is the first step in image

0.2 Uniform Color Quantization


We will work with 8 bit images.Each pixel is represented by a value between 0 and 256.Uniform Color quantizations reduces the number of colors such the interval (0; 255) is divided into equal segments . Each segment defines a color region and pixels than fall within the interval are assigned to the color region. For example if we are required to reduce the number of levels to 4 the following intervals are obtained 0 63; 64 127; 128 191; 192 255 . This any pixel in the input image with value between 0-63 is assigned to region 1 any pixel in input image with value between 64-127 is assigned to region 2 and so on. A simple way to perform this mapping is to divide the pixel values by 256/4. and floor the floating point values. all the pixels in range 0-63 will produce value 0 ,all the pixels in the range 64-127 will produce value 1 ,128-191 will produce value 2 and 192-255 will produce a value 3.If we again mutiply these labeled values by 64 we get an image with pixel values 0,64,128,192. If Number of Distinct Colors Requires are N (Interval Length) div= = 255 N (Transformation) Output = f loor(I 255 ) div N
(1)

The disadvantage of uniform quantization is that some pixels near some color levels may be largely represented in image than other pixels. For example if image contains only pixel values in the range 0-64. The interval levels will be still configured as 0,64,128,192. Another option is to choose the largest integral multiple of number

3 | 5

Uniform Color Quantization

(a) Image

(b) Quantized

(c) Image

(d) Quantized
Figure 1: Uniform Color Quantized 1

of division greater than of equal to the largest pixel value present in the image. If Number of Distinct Colors Requires are N (Interval Length) div= = ceil(max(Image)=N )N N (Transformation) Output = f loor(I 25 ) div N
(2)

(a) Image

(b) Quantized

(c) Image

(d) Quantized
Figure 2: Uniform Color Quantized 2

4 | 5

Uniform Color Quantization

0.3 Code
OpenCV libraries are used for image processing . Code is available in repository https://code.google.com/p/m19404/source/browse/ ColorQuantization/

5 | 5