Proc. of Int. Conf. on Control, Communication and Power Engineering 2010

Mean-Removed Constrained Vector Quantization as Applied to Image Sneha A. Pandya1, Arun B. Nandurbarkar2, Prof. S. M. Joshi3 1

Department of Electronics & Communication Engineering, VVP Engineering College of Technology – Vajdi Virda, Rajkot - Gujarat, India 360005 E-mail: sneha_80@yahoo.com Ph: +91 0281 2783394 2 Department of Electronics & Communication Engineering, government engineering college – Bharuch, Gujarat, India 392012 E-mail: arunnandurbarkar@yahoo.com Ph: +91 02642 227054. 3 Department ofElectrical Engineering in Faculty of Engineering & Technology, M.S. University, Baroda., India 390002 E-mail: sri_smj@yahoo.com Abstract—Vector quantization (VQ) is a powerful method based on the principle of block coding, for lossy compression of data such as sound or image. Vector quantization is used with sophisticated digital signal processing, where in most cases the input signal already has some form of digital representation and the desired output is a compressed version of the original signal. VQ is usually used for the purpose of data compression. VQ exploits the statistical redundancy between pixels in image within a block and between segments in audio stream to reduce the bit rate. So for the given bit rate the codebook search complexity increases exponentially with the increase in block size. There always exists a high correlation among neighboring blocks. This inner block correlation can be exploited by incorporating the memory into the VQ. VQ can be viewed as a form of pattern recognition where an input pattern is “approximated” by one of a predetermined set of standard patterns. Direct use of VQ or the above mentioned un-constrained VQ is severely limited to rather modest vector dimension and codebook sizes for practical problems. Reducing the dimension of a vector often sacrifices the possibility of effectively exploiting the statistical dependency known to exist in a set of samples or signal parameters. By applying constraint to the structure of the VQ codebook, there can be a correspondingly altered algorithm and design technique. The method of mean-removed constrained VQ method generally compromise the performance achievable with unconstrained VQ, but often provide very useful and favorable trade-offs between performance and complexity. Keywords – GLA algorithm, MSE, PSNR, Code book optimization, Mean – removed VQ.

I. INTRODUCTION With scalar quantization, there exists one-to-one mapping between the samples. To the given data, scalar quantization is uniformly applied and that does not target the use of correlation existing in the data. From a multidimensional point of view, using a scalar quantizer for each input restricts the output points to a rectangular grid [2]. Observing several source output values at once allows us to move the output points around. Another way of looking at this is that in one dimension the quantization intervals are restricted to be intervals, and

© 2009 ACEEE

the only parameter that we can manipulate is the size of these intervals. When we divide the input into vectors of some length n, the quantization regions are no longer restricted to be rectangles or squares. We have the freedom to divide the range of the inputs in an infinite number of ways. Following figures 1, 2, 3 & 4 demonstrates these conclusions. With Fig 1 we have the image of Lena, for which the distribution of gray scales is given in fig 2. fig 3 & 4 represents the application of scalar and vector quantization on the same respectively.

Fig. 1 Lena.jpg

Fig. 3 Scalar quantization

Fig. 2 Distribution of pixels

Fig. 4 Vector quantization

II BASICS OF VECTOR QUANTIZATION A. Definition & some important terms A vector quantizer Q of dimension k and size N is a mapping from a vector (or a “point”) in k-dimension Euclidean space, Rk, into a finite set C containing N output or reproduction points Called code vectors or codewords. Thus, Q : Rk ﾮ C

where C={y1, y2... . yN} is the set of N reconstruction vectors, called a codebook of size N , meaning it has N distinct elements, each a vector in R k. Where, yi ∈ Rk for each, i ∈ J ≡ { 1, 2, - - -, N}. Each yi Є C is called a code vector. C = number of code words in the codebook, i.e. the size of the codebook. N = number of input vectors obtained from the input image.[1]

296

Proc. of Int. Conf. on Control, Communication and Power Engineering 2010

For each yi,,iЄI={1,2...N} is called the index of code vector and I is the index set. Encoding a data k k vector x Є R Where X = { x1 , x2 ,..., xN } ﾮ R and involves finding the index j of the code vector y j Є C. Associated with each codeword, yi, is a nearest neighbor region called Voronoi region, and it is defined by: (2.1) The decoder uses the index j to look up the codebook and generates the reconstruction vector yj corresponding to x. The distortion measures used in VQ is the Euclidean distance [1]. 2

d (x, yj ) = || x - yj ||

(2.2)

(2.3) The resolution, code rate, or, simply, rate of a vector quantizer is r = log 2 N / k , (2.4) which measures the number of bits per vector component used to represent the input vector and gives an indication of the accuracy or precision that is achievable with a vector quantizer if the codebook is well-designed. 2.2 performance analysis two important parameters which are helpful in determining the performance of VQ are MEAN SQUARE ERROR and PSNR [1]. The equation of these two are as given below. The results obtained by the simulation of VQ contain the comparison on basis of these two parameters.

(2.5) Where M is the number of elements in the signal, or mage. For example, if we wanted to find the MSE between the reconstructed and the original image, then we would take the difference between the two images pixel by pixel, square the results and average the results. The PSNR is defined as follows:

quantizer.[3] Although each of these steps of optimization a partition for a codebook and a codebook for a partition is simple and straightforward, the simultaneous satisfaction of both conditions is not easy to achieve. There are no known closed-form solutions to the problem of optimal quantization. The repeated application of the improvement step, however, yields an iterative algorithm which at least reduces (or leaves unchanged) the average distortion at each step [7]. The Generalized Lloyd Algorithm (GLA) iteratively generates the codebook as given in Fig 5. [3][6]. C. Code Book Optimization Step 1: Initialization: Select a threshold value ε ﾮ0 , set n=0, (here n is currently zero, but will be incremented in each iteration). D−1 = +ﾮ and initial codebook Y0 .[6][5]. Step 2: For each code vector find the set of all training vectors. It will determine the voronoi regions and give partition of entire region of R k .Repeat for all values of i. It may happen that some cells will be empty [Empty Cell Problem]. Step 3: Calculate the distortion Dn between each code vector and the set of training vectors using equation (2.3). [8][6]. Step 4 : If ( Dn −1 − Dn ) / Dn −1 < ε , then the optimization ends and Yn is the final returned codebook. Else the new codebook Yn +1 is calculated. After, the counter n is increased by one and the procedure follows from step 2.The Empty Cell Problem is dominant if it occurs at the early stages of GLA (i.e. for small values of n). Since the unused code vectors are doubled in every further step. Such doubling might result in final codebook with many unused code vectors.

(2.6) Where n is the number of bits per symbol. As an example, if it’s needed to find the PSNR between two 256 gray level images, then set n to 8 bits [1].

B. code book generation The necessary conditions for optimality provide the basis for iteratively improving a given vector quantizer. If the iteration continues to convergence, a good (hopefully close to optimal) quantizer can be found. The iteration begins with a vector quantizer consisting of its codebook and the corresponding optimal (NN) partition and then finds the new codebook which is optimal for that partition. This new codebook and its NN partition are then a new vector quantizer with average distortion no greater (and usually less) than the original

© 2009 ACEEE

Fig. 5 Flow chart of GLA Algorithm

297

Proc. of Int. Conf. on Control, Communication and Power Engineering 2010

III. CONSTRAINED VECTOR QUANTIZATION Direct use of VQ or the above mentioned unconstrained VQ is severely limited to rather modest vector dimension and codebook sizes for practical problems.[1] Reducing the dimension of a vector often sacrifices the possibility of effectively exploiting the statistical dependency known to exist in a set of samples or signal parameters. By applying various constraints to the structure of the VQ codebook, there can be a correspondingly altered algorithm and design technique. A. Mean Removed Vector Quantization: If a codebook is to be generated from an image, differing amounts of background illumination would result in vastly different codebooks. This effect can be significantly reduced if we remove the mean from each vector before quantization. The mean and the meanremoved vector can then be quantized separately. The mean can be quantized using a scalar quantization scheme, while the mean-removed vector can be quantized using a vector quantizer.[2] The algorithm makes use of a mean-removed vector's features (edge and texture strengths) to reject many unlikely code-words and it has the same image quality as the full search method. Experimental results show that algorithm is much better than the full search method in terms of computing time and the number of distortion calculations.

Fig. 6 Block diagram for implementation of mean- removed VQ.

Hence, X can be represented as the sum of a mean vector m1 and the residual vector R according to:

X = m1 + R

(3.3).

II. SIMULATION RESULTS The performance of Vector Quantization is evaluated in terms of peak signal to noise ratio (PSNR) and mean squared error (MSE).[1]. The performance of vector quantization is measured and analyzed and compared on basis of various dimension of quantization and various size of codebooks. The training image taken is CAMERAMAN.TIF of size 256 x 256 and the code book is optimized for the test image of LENA.JPG. Lena image is evaluated in terms of peak signal to noise ratio (PSNR) and mean squared error (MSE). For all the images the bit rate (or bit per pixel ) r is kept equal to 0.4. Figure 7 is original Lena image.

B. Basic definition & block diagram of mean removed VQ : The average amplitude of the components of a vector can differ widely from one vector to another and often this average value can be regarded as statistically independent of the variations of the vector that is the components vary about this average. Furthermore, many vectors such as sampled image intensity rasters have only non-negative components and hence have non zero means. Basic block diagram is as shown in fig.6. [1][2] [5]. The mean m, of X is itself a scalar random variable given by (3.1)

t Where 1 = (1,1,1,....,1) , the k-dimensional vector with all components equal to unity.[1] The mean removed residual, R, of the random variable X is defined as

R= X−

© 2009 ACEEE

1 t ( 1 X ) 1 = X − m1 k

Fig. 7 Original lena image

The performance of the vector quantizers for the test image is summarized in Table I.

(3.2)

298

Proc. of Int. Conf. on Control, Communication and Power Engineering 2010

VQ PERFORMANCE

Fig 8(a) 4 x 4, CB ge

Fig 8(b) 5 x 5, CB 32

Fig 8(c) 6 x 6, CB 32

Fig 8(d) 7 x 7, CB 32

Code book size 16 32 64 128

Here code book size is kept fixed at 32 and dimensions of the VQ are changed i.e. 4x4, 5x5, 6x6 & 7x7. The corresponding results of reconstructed images are as shown in figure 8(a) to 8(d) respectively. Table II gives the result where dimension of VQ is fixed at 4x4 but the codebook sizes are changed i.e. 16, 32, 64 and 128. The corresponding results of reconstructed images are as shown in figure 9(a) to 9(d) respectively. It can be seen that as dimension of the VQ are increased, the images are demonstrating inferior reconstruction as compared to the original image. That means that there is decrement in PSNR and increment in MSE with increasing dimension for a given code book size. On the contrary, It can be seen that as the size of the codebook increases, the images are demonstrating better reconstruction. That means that there is increment in PSNR and decrement in MSE with increasing code book size for a given dimension of VQ. In the image lena.jpg fig. 11 gives basic VQ and fig.12 is MRVQ. From these images it can be seen that the blocking that plagued the original VQ Figure 12 has been seriously diminished. The edges are much more defined as can be seen from the close up of the face. However, the edges still suffer from some raggedness [4]. VQ PERFORMANCE

Dimension 4x4 5x5 6x6 7x7

ÂŠ 2009 ACEEE

TABLE I.

MEASURMENT FOR IMAGE (WITH FIX

32)

PSNR(dB) 26.3865 25.0493 24.0278 23.5125

TABLE II.

MEASURMENT FOR IMAGE (WITH FIX

Fig. 9 (a) CB :16 4 x 4

Fig. 9 (c) CB: 64; 4 x 4

Fig. 10 Basic VQ

DIMENSION : 4 X 4)

PSNR(dB)

MSE

24.7647 26.3865 27.9454 29.1116

217.0750 149.3058 104.3614 79.7846

Fig. 9 (b) CB :32 ; 4 x 4

Fig. 9 (d) CB :128; 4 x 4

Fig. 11 MRVQ

Table III gives the performance of the mean-remove vector quantizer for the test image of cameraman.tif where code book size is kept fixed at 32 and dimensions of the MRVQ are changed i.e. 3x3, 4x4, 5x5, 6x6. The results are as shown in figure 12 (a) to Fig. 12 (d) respectively.

CODE BOOK SIZE :

MSE 149.3058 202.41 257.2180 289.62

299

Proc. of Int. Conf. on Control, Communication and Power Engineering 2010

TABLE III. MRVQ PERFORMANCE MEASURED FOR IMAGE WITH VARIOUS DIMENSIONS (CODE BOOK SIZE : 32)

Dimension 4x4 5x5 6x6 7x7

PSNR(dB) 24.3259 23.2251 22.7718 22.2323

Fig. 12 (a) 4 x 4,CB 32

Fig 12 (c) 6 x 6, CB 32

LBG algorithm is then forced to make matches based on the energy associated with the shape and texture of the blocks and not the overall luminance. A universal codebook is created which enables the coder to make superior pattern matches as shapes and textures are more prone to be repeated over a wide variety of images when the mean is removed.

MSE 240.1418 309.4344 343.4821 388.8198

REFRENCES

Fig. 12 (b) 5 x 5,CB 32

Fig. 12 (d) 7 x 7, CB 32

V. CONCLUSION Basic VQ: It can be seen that as dimension of the VQ are increased, the images are demonstrating inferior reconstruction. On the contrary, It can be seen that as the size of the codebook increases, the images are demonstrating better reconstruction. Mean Removed VQ : With mean removed VQ we get over with the unwanted blocky effect, associated with basic VQ employed. This method basically performs the function its title entails by removing and storing the mean of each training vector before performing VQ. By doing this the

© 2009 ACEEE

300

[1]. A.Gresho and R.M.Gray,"Vector Quantization and signal compression", Norwell M.A; Kluwer, 1992. [2]. Khalid Sayood, “Introduction to Data Compression”, Harcourt India Private Limited, New Delhi, 2nd edition, 2000. [3]. Y.Linde, A.Buzo and R.M.Gray, "An algorithm for vector quantizer design", IEEE trans. communication Vol.28 pp 84-95 Jan. 1980. [4]. Robert gray, “vector quantization” APRIL 1984 IEEE ASSP MAGAZINE. [5]. Mrs.V.S.Jayanthi, K.Swapnil Marothi, T.M.Ishaq Mohammed Abbas,Dr.A.Shanmugam, “Performance Analysis of Vector Quantizer using Modified Generalized Lloyd Algorithm.” IJISE,GA,USA,ISSN:19349955,VOL.1,NO.1, JANUARY 2007. [6]. Giuseppe patane, Marco Russo, “The enhanced LBG algorithm” ,Neural Networks 14 (2001) 1219-1237. [7]. H.B. Kekre and T.K. Sarode, “ Fast codebook search algorithm for vector quantization using sorting technique”, Intrnl. Conf. on advances in computing, communication and control, (ICAC3’09), pp. 317- 325, Mumbai, India, 23-24, Jan. 2009. [8]. J.K. Han and H.M. Kim, “ Optimization of requantization codebook for VQ”, IEEE Trans IP, vol.15, pp. 1057-1061, May 2006.

Advertisement