revised vq dct au journal

9
VQ-DCT Based Image Compression: A New Hybrid Approach S. Roy 1 , A. K. Sen 2 , N. Sinha 3 1 Department of Information Technology, Assam University, Silchar – 788011, Assam, India. 2 Department of Physics, Assam University, Silchar – 788011, Assam, India. 3 Department of Electrical Engineering, National Institute of Technology, Silchar – 788010, Assam, India. Correspondence : [email protected]  Abstract: A hybrid image compression method is proposed in this work based upon two compression techniques, namely Vector Quantization (VQ) and Discrete Cosine Transform (DCT). In this approach, the codebook is generated initially with t he help of ten different images using VQ. The final codebook is then generated using DCT matrix and is ready to be used. Any image can be compressed using this code book. Appropriate codewords are generated for the selected image and ultimately the compressed form of the image is obtained. The decompression can also be done to reconstruct the original image. Proposed approach is tested on standard images and performance of the approach is compared with standard VQ method. The performance of the proposed method is better as evidenced by higher PSNR with the hybrid method as compared to VQ method. Keywords: Image compression, decompression, vector quantization, discrete cosine transform, DCT matrix, PSNR. 1. Introduction: Image compression addresses the problem of reducing the amount of data required to represent a digital image. The underlying basis of the reduction process is the removal of redundant data. From a mathematical viewpoint, this amounts to transforming a 2-D pixel array into a statistically uncorrelated data set. The transformation is applied prior to storage or transmission of the image. Later the compressed image is decompressed to reconstruct the original image or an approximation of it (Gonzalez and Woods, 2006). The initial focus of research efforts in this field was on the development of analog methods for reducing video transmission bandwidth, a process called bandwidth compression. The advent of the digital computer and subsequent development of advanced integrated circuits caused the shift of interest from analog to digital compression approaches. With the relatively recent adoption of several key international image compression standards, the fi eld has undergone significant growth through the practical application of the theoretical work that began in the 1940s, when C. E. Shannon and others first formulated the probabilistic view of information and its representation, transmission, and compression (Gonzalez and Woods, 2006; Chanda and Dutta Majumder, 2000; Taubman and Marcellin, 2002). Currently, image compression is recognized as an enabling technology. It is the natural one for handling the increased spatial resolutions of today’s imaging sensors and evolving broadcast television standards. Furthermore, image compression plays a major role in many important and diverse applications, including tele-video-conferencing, remote sensing, document and medical imaging, facsimile transmission (FAX), and the control of remotely piloted vehicles in military, space and hazardous waste management applications. So, an ever-expanding number of applications depend on the efficient manipulation, storage, and transmission of binary, gray-scale and color images (http://www.data- compression.co m/vq.shtml).

Upload: nidul-sinha

Post on 13-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 19

VQ-DCT Based Image Compression A New Hybrid Approach

S Roy1

A K Sen2

N Sinha3

1

Department of Information Technology Assam University Silchar ndash 788011 Assam India2

Department of Physics Assam University Silchar ndash 788011 Assam India3

Department of Electrical Engineering National Institute of Technology Silchar ndash 788010

Assam India

Correspondence sudiptaitgmailcom

AbstractA hybrid image compression method is proposed in this work based upon two compressiontechniques namely Vector Quantization (VQ) and Discrete Cosine Transform (DCT) In this

approach the codebook is generated initially with the help of ten different images using VQ The finalcodebook is then generated using DCT matrix and is ready to be used Any image can be compressed

using this code book Appropriate codewords are generated for the selected image and ultimately thecompressed form of the image is obtained The decompression can also be done to reconstruct the

original image Proposed approach is tested on standard images and performance of the approach iscompared with standard VQ method The performance of the proposed method is better as evidenced

by higher PSNR with the hybrid method as compared to VQ method

KeywordsImage compression decompression vector quantization discrete cosine transform DCT matrix

PSNR

1 Introduction

Image compression addresses the problem of reducing the amount of data required torepresent a digital image The underlying basis of the reduction process is the removal of redundant

data From a mathematical viewpoint this amounts to transforming a 2-D pixel array into a

statistically uncorrelated data set The transformation is applied prior to storage or transmission of the

image Later the compressed image is decompressed to reconstruct the original image or anapproximation of it (Gonzalez and Woods 2006)

The initial focus of research efforts in this field was on the development of analog methodsfor reducing video transmission bandwidth a process called bandwidth compression The advent of

the digital computer and subsequent development of advanced integrated circuits caused the shift ofinterest from analog to digital compression approaches With the relatively recent adoption of several

key international image compression standards the field has undergone significant growth through thepractical application of the theoretical work that began in the 1940s when C E Shannon and others

first formulated the probabilistic view of information and its representation transmission andcompression (Gonzalez and Woods 2006 Chanda and Dutta Majumder 2000 Taubman and

Marcellin 2002)Currently image compression is recognized as an enabling technology It is the natural one

for handling the increased spatial resolutions of todayrsquos imaging sensors and evolving broadcast

television standards Furthermore image compression plays a major role in many important and

diverse applications including tele-video-conferencing remote sensing document and medicalimaging facsimile transmission (FAX) and the control of remotely piloted vehicles in military space

and hazardous waste management applications So an ever-expanding number of applications dependon the efficient manipulation storage and transmission of binary gray-scale and color images

(httpwwwdata-compressioncomvqshtml)

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 29

Compression techniques can be broadly classified into two categories namely loss-less compressionand lossy compression

The digital signal is represented by g and g represents the decompressed form of the

compressed digital signal g Hence any discrepancy between g and g is considered as errorintroduced by the compression technique Usually amount of error increases as amount of data

decreases So the objective of the compression technique is to achieve maximum compression

without introducing objectionable error (Chanda and Dutta Majumder 2000 Taubman and Marcellin2002) If amount of error introduced is zero we call it loss-less compression otherwise it is a lossycompression Loss-less compression is perfectly invertible That means original image can be exactly

recovered from its compressed representation Principal loss-less compression strategies are HuffmanCoding Run-length Coding Block Coding Quad Tree Coding Contour Coding In case of lossy

compression perfect recovery of original image is not possible but amount of data reduction is more

than loss-less compression Lossy compression is useful in applications in which a certain amount oferror is an acceptable trade-off for increased compression performance such as Broadcast television

Videoconferencing Facsimile transmission etc All the image compression techniques exploit the

common characteristic of most images is that the neighboring pixels are correlated and thereforecontain redundant information The foremost task then is to find less correlated representation of the

image Two fundamental components of compression are redundancy and irrelevancy reduction All

compression techniques attempt to remove the redundant information to the possible extent and derive

the less correlated representation of the image Principal Lossy compression strategies are TransformCompression Block Truncation Compression Vector Quantization (VQ) Compression (Chanda andDutta Majumder 2000 McGowan httpwwwjmcgowancomavialgohtml Linde and Gray 1980)

VQ is a powerful method for lossy compression of data like in sounds or images because

their vector representations often occupy only small fractions of their vector spaces Like in a 2Dgray scale image the vector space can be visualized as the [00]-[255255] square in the plane If taken

on two components of the vectors as XY coordinates and a dot can be plotted for each vector found inthe input image

In traditional coding methods based on the DCT (Kesavan

983144983156983156983152983098983087983087983159983159983159983086983146983149983139983143983151983159983137983150983086983139983151983149983087983137983158983145983137983148983143983151983086983144983156983149983148 Rao and Yip 1990 Cabeen and Gent Ponomarenko et al

2002) level of compression and amount of losses are determined by the quantization of DCTcoefficients Losses in images with DCT based compression results from quantization of DCT

coefficients And quantization is essential for compression of imageinformation The main advantageof the DCT is its energy compaction property that is the entire signal energy before applying DCT isconcentrated in only a few DCT coefficients after transforming Hence most of the other coefficients

become zero or negligibly small and hence can be ignored or truncated

Image compression research aims at reducing the number of bits needed to represent an image byremoving the spatial and spectral redundancies as much as possible

As DC components of DCT coefficients reflect average energy of pixel blocks and AC components

reflect pixel intensity changes it is conceivable to index and retrieve images directly based on DCTcoefficients However the index or representation would not be compact as the number of DCT

coefficients is equal to the number of pixels Therefore it is proposed to use coefficients of some

selected image windows But the choice of windows will affect the performance dramatically as the

objects of interest may be located anywhere in a image

Although VQ offers more compression yet is not widely implemented This is due to two things Thefirst is the time it takes to generate the codebook and the second is the speed of the search Manyalgorithms have been proposed to increase the speed of the search Some of them reduce the

mathematics used to determine the codeword that offers the minimum distortion other algorithmspreprocess the codewords

Hence it is felt to compress an image first using VQ method which will retain most of the

information of the image at the same time achieves compression and secondly the code book of VQmethod will be redefined by DCT matrix This way of hybridization of VQ and DCT will make use

of good subjective performance of VQ and high compression capability of DCT resulting into a moreefficient algorithm for compression of images than VQ alone

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 39

In view of the above the main objectives of the present work are1 To generate code book of images using VQ method

2 To redefine the code book using DCT matrix3 Compare the results with standard VQ based method

The rest of the paper is organized as follows In Section 2 the concept of vectors vector

quantization and formation of DCT matrix are introduced Hybridization is described in section 3 andsection 4 presents the results and discussions Conclusions are drawn in Section 5

2 Background Theory

21 Vector Quantization (VQ)

Vector quantization (VQ) is a lossy data compression method based on the principle of block codingIt is a fixed-to-fixed length algorithm A VQ is nothing more than an approximator The idea is

similar to that of ldquorounding-offrdquo (say to the nearest integer) (Taubman and Marcellin 2002 Kesavan

httpwwwjmcgowancomavialgohtml)

An example of a 1-dimensional VQ is shown in Figure 1

Figure 1 Codewords in 1-dimentional space

Here every number less than -2 is approximated by -3 All numbers between -2 and 0 are

approximated by -1 Every number between 0 and 2 are approximated by +1 Every number greaterthan 2 are approximated by +3 The approximate values are uniquely represented by 2 bits This is a

1-dimensional 2-bit VQ It has a rate of 2 bitsdimension In the above example the stars are called

codevectors

A vector quantizer maps k-dimensional vectors in the vector space Rk

into a finite set of vectors Y =

yi i = 1 2 N Each vector y

i is called a code vector or a codeword and the set of all the

codewords is called a codebook Associated with each codeword yi is a nearest neighbour regioncalled encoding region or Voronoi region [4] and it is defined by

= 983163 isin minus le minus ne 983165 (1)

The set of encoding regions partition the entire space Rk

such that

= = empty ne

Thus the set of all encoding regions is called the partition of the spaceAs an example we take vectors in the two-dimensional case without loss of generality in Figure 2 In

the figure Input vectors are marked with an x codewords are marked with solid circles and the

Voronoi regions are separated with boundary lines The figure shows some vectors in space

Associated with each cluster of vectors is a representative codeword Each codeword resides in itsown Voronoi region These regions are separated with imaginary boundary lines in figure 2 Given an

input vector the codeword that is chosen to represent it is the one in the same Voronoi region The

representative codeword is determined to be the closest in Euclidean distance from the input vectorThe Euclidean distance is defined by = minus (2)

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 49

where x j is the j

th

component of the input vector and yij is the j

th

component of the codeword yi In

Figure 2 there are 13 regions and 13 solid circles each of which can be uniquely represented by 4

Figure 2 Codewords in 2-dimensional space

bits Thus this is a 2-dimensional 4-bit VQ Its rate is also 2 bitsdimension

22 Workings of VQ in compression

A vector quantizer is composed of two operations The first is the encoder and the second is the

decoder (Gonzalez and Woods 2006)The encoder takes an input vector and outputs the index of the codeword that offers the lowest

distortion In this case the lowest distortion is found by evaluating the Euclidean distance between the

input vector and each codeword in the codebook Once the closest codeword is found the index of

that codeword is sent through a channel (the channel could be a computer storage communicationschannel and so on) When the decoder receives the index of the codeword it replaces the index with

the associated codeword Figure 3 shows a block diagram of the operation of the encoder and thedecoder

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 59

Figure 3 The Encoder and decoder in a vector quantizer

In Figure 3 an input vector is given the closest codeword is found and the index of the codeword issent through the channel The decoder receives the index of the codeword and outputs the codeword

23 DCT Process

The general overview of the DCT is as below

1 The image is broken into 8x8 blocks of pixels

2 Working from left to right top to bottom the DCT is applied to each block

3 Each block is quantized and codebook is generated using k-means algorithm

4 Using codebook and the procedure used in VQ the image is compressed

5 When desired the image is reconstructed through decompression a process that uses the

Inverse Discrete Cosine Transform

24 The DCT Equation

The DCT equation (Eq3) computes the (i jth

) entry of the DCT of an image

= (3)

= = 01 gt 0 4)

p(xy) is the (xy)th

element of the image represented by the matrix p N is the size of the block on that

the DCT is done The equation calculates one entry (ij)th

of the transformed image from the pixel

values of the original image matrix For the standard 8x8 block N equals 8 and x and y range from 0to 7 Therefore D(ij) would be as in equation 5 = (5)

Because the DCT uses cosine functions the resulting matrix depends on the horizontal diagonal andvertical frequencies Therefore an image black with a lot of change in frequency has a very random

looking resulting matrix while an image matrix of just one color has a resulting matrix of a largevalue for the first element and zeroes for the other elements

25 The DCT MatrixTo get the matrix form of equation(3) we may use the equation(6) as below

= = 0 gt 0 (6)

The DCT matrix for a block of size 8x8 is listed in Table 1

=

3536 4904 4619 4157 35362778 1913minus0975

3536 41571913minus0975minus3536minus4904minus4619minus2778

3536 2778minus1913 4904minus35360975 4619 4157

3536 0975minus4619minus2778 35364157minus1913minus4904

3536minus0975minus4619 2778 3536minus4157minus1913 4904

3536minus2778minus1913 4904minus3536minus0975 4619minus4157

3536minus4157 1913 0975minus35364904minus4619 2778

3536minus4904 4619minus4157 3536minus2778 1913minus0975

Table 1 DCT matrix

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 69

The first row (i = 0) of the matrix has all the entries equal to of equation (6)

The columns of T form an orthogonal set so T is an orthogonal matrix When doing the inverse DCT

the orthogonality of T is important as the inverse of T is prime which is easy to calculate

26 Doing the DCT on an 8x8 BlockThe pixel values of a black-and-white image range from 0 to 255 in steps of 23 where pure black is

represented by 0 and pure white by 255 Thus it can be seen how a photo illustration etc can beaccurately represented by the 256 shades of graySince an image comprises hundreds or even thousands of 8x8 blocks of pixels the procedure is

happened to one 8x8 block and is done to all of them in the earlier specified orderThe DCT is designed to work on pixel values ranging from -128 to 127 the original block is leveled

off by subtracting 128 from each entryWe are now ready to perform the Discrete Cosine Transform which is accomplished by matrixmultiplication

D = TMT prime (7)In equation (7) matrix M is first multiplied on the left by the DCT matrix T from the previous section

This operation transforms the rows The columns are then transformed by multiplying on the right bythe transpose of the DCT matrix This yields D

This block matrix now consists 64 DCT coefficients Cij where i and j range from 0 to 7 The top-leftcoefficient C00 correlates to the low frequencies of the original image block As we move away from

C00 in all directions the DCT coefficients correlate to higher and higher frequencies of the imageblock and C77 corresponds to the highest frequency Human eye is most sensitive to low frequencies

and results from quantization step will reflect this fact

27 QuantizationOur 8x8 block of DCT coefficients is now ready for compression by quantization A remarkable and

highly useful feature is that in this step varying levels of image compression and quality areobtainable through selection of specific quantization matrices This enables the user to decide on

quality levels ranging from 1 to 100 where 1 gives the poorest image quality and highest compression

and quality are obtainable through selection of specific quantization matricesQuantization is achieved by dividing each element in the transformed image matrix D by the

corresponding element in the quantization matrix and then rounding to the nearest integer value28 Measurement of performance

To judge the performance of a lossy compression technique we need to decide upon using the errorcriterion The error criteria commonly used may be classified into two broad groups

bull Objective criteria andbull Subjective criteria

The first group of measures need mathematical formulation and restricted to statistical sense only

while it is very difficult to standardize the second group of measures as it involves human observersbull Objective criteria

For objective measurement we can use Mean Squared Error (MSE) and Peak Signal to Noise Ratio

(PSNR)MSE may be defined by equation(8)

= minus (8)

where M is the number of elements in the imageFor 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

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 2: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 29

Compression techniques can be broadly classified into two categories namely loss-less compressionand lossy compression

The digital signal is represented by g and g represents the decompressed form of the

compressed digital signal g Hence any discrepancy between g and g is considered as errorintroduced by the compression technique Usually amount of error increases as amount of data

decreases So the objective of the compression technique is to achieve maximum compression

without introducing objectionable error (Chanda and Dutta Majumder 2000 Taubman and Marcellin2002) If amount of error introduced is zero we call it loss-less compression otherwise it is a lossycompression Loss-less compression is perfectly invertible That means original image can be exactly

recovered from its compressed representation Principal loss-less compression strategies are HuffmanCoding Run-length Coding Block Coding Quad Tree Coding Contour Coding In case of lossy

compression perfect recovery of original image is not possible but amount of data reduction is more

than loss-less compression Lossy compression is useful in applications in which a certain amount oferror is an acceptable trade-off for increased compression performance such as Broadcast television

Videoconferencing Facsimile transmission etc All the image compression techniques exploit the

common characteristic of most images is that the neighboring pixels are correlated and thereforecontain redundant information The foremost task then is to find less correlated representation of the

image Two fundamental components of compression are redundancy and irrelevancy reduction All

compression techniques attempt to remove the redundant information to the possible extent and derive

the less correlated representation of the image Principal Lossy compression strategies are TransformCompression Block Truncation Compression Vector Quantization (VQ) Compression (Chanda andDutta Majumder 2000 McGowan httpwwwjmcgowancomavialgohtml Linde and Gray 1980)

VQ is a powerful method for lossy compression of data like in sounds or images because

their vector representations often occupy only small fractions of their vector spaces Like in a 2Dgray scale image the vector space can be visualized as the [00]-[255255] square in the plane If taken

on two components of the vectors as XY coordinates and a dot can be plotted for each vector found inthe input image

In traditional coding methods based on the DCT (Kesavan

983144983156983156983152983098983087983087983159983159983159983086983146983149983139983143983151983159983137983150983086983139983151983149983087983137983158983145983137983148983143983151983086983144983156983149983148 Rao and Yip 1990 Cabeen and Gent Ponomarenko et al

2002) level of compression and amount of losses are determined by the quantization of DCTcoefficients Losses in images with DCT based compression results from quantization of DCT

coefficients And quantization is essential for compression of imageinformation The main advantageof the DCT is its energy compaction property that is the entire signal energy before applying DCT isconcentrated in only a few DCT coefficients after transforming Hence most of the other coefficients

become zero or negligibly small and hence can be ignored or truncated

Image compression research aims at reducing the number of bits needed to represent an image byremoving the spatial and spectral redundancies as much as possible

As DC components of DCT coefficients reflect average energy of pixel blocks and AC components

reflect pixel intensity changes it is conceivable to index and retrieve images directly based on DCTcoefficients However the index or representation would not be compact as the number of DCT

coefficients is equal to the number of pixels Therefore it is proposed to use coefficients of some

selected image windows But the choice of windows will affect the performance dramatically as the

objects of interest may be located anywhere in a image

Although VQ offers more compression yet is not widely implemented This is due to two things Thefirst is the time it takes to generate the codebook and the second is the speed of the search Manyalgorithms have been proposed to increase the speed of the search Some of them reduce the

mathematics used to determine the codeword that offers the minimum distortion other algorithmspreprocess the codewords

Hence it is felt to compress an image first using VQ method which will retain most of the

information of the image at the same time achieves compression and secondly the code book of VQmethod will be redefined by DCT matrix This way of hybridization of VQ and DCT will make use

of good subjective performance of VQ and high compression capability of DCT resulting into a moreefficient algorithm for compression of images than VQ alone

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 39

In view of the above the main objectives of the present work are1 To generate code book of images using VQ method

2 To redefine the code book using DCT matrix3 Compare the results with standard VQ based method

The rest of the paper is organized as follows In Section 2 the concept of vectors vector

quantization and formation of DCT matrix are introduced Hybridization is described in section 3 andsection 4 presents the results and discussions Conclusions are drawn in Section 5

2 Background Theory

21 Vector Quantization (VQ)

Vector quantization (VQ) is a lossy data compression method based on the principle of block codingIt is a fixed-to-fixed length algorithm A VQ is nothing more than an approximator The idea is

similar to that of ldquorounding-offrdquo (say to the nearest integer) (Taubman and Marcellin 2002 Kesavan

httpwwwjmcgowancomavialgohtml)

An example of a 1-dimensional VQ is shown in Figure 1

Figure 1 Codewords in 1-dimentional space

Here every number less than -2 is approximated by -3 All numbers between -2 and 0 are

approximated by -1 Every number between 0 and 2 are approximated by +1 Every number greaterthan 2 are approximated by +3 The approximate values are uniquely represented by 2 bits This is a

1-dimensional 2-bit VQ It has a rate of 2 bitsdimension In the above example the stars are called

codevectors

A vector quantizer maps k-dimensional vectors in the vector space Rk

into a finite set of vectors Y =

yi i = 1 2 N Each vector y

i is called a code vector or a codeword and the set of all the

codewords is called a codebook Associated with each codeword yi is a nearest neighbour regioncalled encoding region or Voronoi region [4] and it is defined by

= 983163 isin minus le minus ne 983165 (1)

The set of encoding regions partition the entire space Rk

such that

= = empty ne

Thus the set of all encoding regions is called the partition of the spaceAs an example we take vectors in the two-dimensional case without loss of generality in Figure 2 In

the figure Input vectors are marked with an x codewords are marked with solid circles and the

Voronoi regions are separated with boundary lines The figure shows some vectors in space

Associated with each cluster of vectors is a representative codeword Each codeword resides in itsown Voronoi region These regions are separated with imaginary boundary lines in figure 2 Given an

input vector the codeword that is chosen to represent it is the one in the same Voronoi region The

representative codeword is determined to be the closest in Euclidean distance from the input vectorThe Euclidean distance is defined by = minus (2)

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 49

where x j is the j

th

component of the input vector and yij is the j

th

component of the codeword yi In

Figure 2 there are 13 regions and 13 solid circles each of which can be uniquely represented by 4

Figure 2 Codewords in 2-dimensional space

bits Thus this is a 2-dimensional 4-bit VQ Its rate is also 2 bitsdimension

22 Workings of VQ in compression

A vector quantizer is composed of two operations The first is the encoder and the second is the

decoder (Gonzalez and Woods 2006)The encoder takes an input vector and outputs the index of the codeword that offers the lowest

distortion In this case the lowest distortion is found by evaluating the Euclidean distance between the

input vector and each codeword in the codebook Once the closest codeword is found the index of

that codeword is sent through a channel (the channel could be a computer storage communicationschannel and so on) When the decoder receives the index of the codeword it replaces the index with

the associated codeword Figure 3 shows a block diagram of the operation of the encoder and thedecoder

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 59

Figure 3 The Encoder and decoder in a vector quantizer

In Figure 3 an input vector is given the closest codeword is found and the index of the codeword issent through the channel The decoder receives the index of the codeword and outputs the codeword

23 DCT Process

The general overview of the DCT is as below

1 The image is broken into 8x8 blocks of pixels

2 Working from left to right top to bottom the DCT is applied to each block

3 Each block is quantized and codebook is generated using k-means algorithm

4 Using codebook and the procedure used in VQ the image is compressed

5 When desired the image is reconstructed through decompression a process that uses the

Inverse Discrete Cosine Transform

24 The DCT Equation

The DCT equation (Eq3) computes the (i jth

) entry of the DCT of an image

= (3)

= = 01 gt 0 4)

p(xy) is the (xy)th

element of the image represented by the matrix p N is the size of the block on that

the DCT is done The equation calculates one entry (ij)th

of the transformed image from the pixel

values of the original image matrix For the standard 8x8 block N equals 8 and x and y range from 0to 7 Therefore D(ij) would be as in equation 5 = (5)

Because the DCT uses cosine functions the resulting matrix depends on the horizontal diagonal andvertical frequencies Therefore an image black with a lot of change in frequency has a very random

looking resulting matrix while an image matrix of just one color has a resulting matrix of a largevalue for the first element and zeroes for the other elements

25 The DCT MatrixTo get the matrix form of equation(3) we may use the equation(6) as below

= = 0 gt 0 (6)

The DCT matrix for a block of size 8x8 is listed in Table 1

=

3536 4904 4619 4157 35362778 1913minus0975

3536 41571913minus0975minus3536minus4904minus4619minus2778

3536 2778minus1913 4904minus35360975 4619 4157

3536 0975minus4619minus2778 35364157minus1913minus4904

3536minus0975minus4619 2778 3536minus4157minus1913 4904

3536minus2778minus1913 4904minus3536minus0975 4619minus4157

3536minus4157 1913 0975minus35364904minus4619 2778

3536minus4904 4619minus4157 3536minus2778 1913minus0975

Table 1 DCT matrix

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 69

The first row (i = 0) of the matrix has all the entries equal to of equation (6)

The columns of T form an orthogonal set so T is an orthogonal matrix When doing the inverse DCT

the orthogonality of T is important as the inverse of T is prime which is easy to calculate

26 Doing the DCT on an 8x8 BlockThe pixel values of a black-and-white image range from 0 to 255 in steps of 23 where pure black is

represented by 0 and pure white by 255 Thus it can be seen how a photo illustration etc can beaccurately represented by the 256 shades of graySince an image comprises hundreds or even thousands of 8x8 blocks of pixels the procedure is

happened to one 8x8 block and is done to all of them in the earlier specified orderThe DCT is designed to work on pixel values ranging from -128 to 127 the original block is leveled

off by subtracting 128 from each entryWe are now ready to perform the Discrete Cosine Transform which is accomplished by matrixmultiplication

D = TMT prime (7)In equation (7) matrix M is first multiplied on the left by the DCT matrix T from the previous section

This operation transforms the rows The columns are then transformed by multiplying on the right bythe transpose of the DCT matrix This yields D

This block matrix now consists 64 DCT coefficients Cij where i and j range from 0 to 7 The top-leftcoefficient C00 correlates to the low frequencies of the original image block As we move away from

C00 in all directions the DCT coefficients correlate to higher and higher frequencies of the imageblock and C77 corresponds to the highest frequency Human eye is most sensitive to low frequencies

and results from quantization step will reflect this fact

27 QuantizationOur 8x8 block of DCT coefficients is now ready for compression by quantization A remarkable and

highly useful feature is that in this step varying levels of image compression and quality areobtainable through selection of specific quantization matrices This enables the user to decide on

quality levels ranging from 1 to 100 where 1 gives the poorest image quality and highest compression

and quality are obtainable through selection of specific quantization matricesQuantization is achieved by dividing each element in the transformed image matrix D by the

corresponding element in the quantization matrix and then rounding to the nearest integer value28 Measurement of performance

To judge the performance of a lossy compression technique we need to decide upon using the errorcriterion The error criteria commonly used may be classified into two broad groups

bull Objective criteria andbull Subjective criteria

The first group of measures need mathematical formulation and restricted to statistical sense only

while it is very difficult to standardize the second group of measures as it involves human observersbull Objective criteria

For objective measurement we can use Mean Squared Error (MSE) and Peak Signal to Noise Ratio

(PSNR)MSE may be defined by equation(8)

= minus (8)

where M is the number of elements in the imageFor 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

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 3: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 39

In view of the above the main objectives of the present work are1 To generate code book of images using VQ method

2 To redefine the code book using DCT matrix3 Compare the results with standard VQ based method

The rest of the paper is organized as follows In Section 2 the concept of vectors vector

quantization and formation of DCT matrix are introduced Hybridization is described in section 3 andsection 4 presents the results and discussions Conclusions are drawn in Section 5

2 Background Theory

21 Vector Quantization (VQ)

Vector quantization (VQ) is a lossy data compression method based on the principle of block codingIt is a fixed-to-fixed length algorithm A VQ is nothing more than an approximator The idea is

similar to that of ldquorounding-offrdquo (say to the nearest integer) (Taubman and Marcellin 2002 Kesavan

httpwwwjmcgowancomavialgohtml)

An example of a 1-dimensional VQ is shown in Figure 1

Figure 1 Codewords in 1-dimentional space

Here every number less than -2 is approximated by -3 All numbers between -2 and 0 are

approximated by -1 Every number between 0 and 2 are approximated by +1 Every number greaterthan 2 are approximated by +3 The approximate values are uniquely represented by 2 bits This is a

1-dimensional 2-bit VQ It has a rate of 2 bitsdimension In the above example the stars are called

codevectors

A vector quantizer maps k-dimensional vectors in the vector space Rk

into a finite set of vectors Y =

yi i = 1 2 N Each vector y

i is called a code vector or a codeword and the set of all the

codewords is called a codebook Associated with each codeword yi is a nearest neighbour regioncalled encoding region or Voronoi region [4] and it is defined by

= 983163 isin minus le minus ne 983165 (1)

The set of encoding regions partition the entire space Rk

such that

= = empty ne

Thus the set of all encoding regions is called the partition of the spaceAs an example we take vectors in the two-dimensional case without loss of generality in Figure 2 In

the figure Input vectors are marked with an x codewords are marked with solid circles and the

Voronoi regions are separated with boundary lines The figure shows some vectors in space

Associated with each cluster of vectors is a representative codeword Each codeword resides in itsown Voronoi region These regions are separated with imaginary boundary lines in figure 2 Given an

input vector the codeword that is chosen to represent it is the one in the same Voronoi region The

representative codeword is determined to be the closest in Euclidean distance from the input vectorThe Euclidean distance is defined by = minus (2)

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 49

where x j is the j

th

component of the input vector and yij is the j

th

component of the codeword yi In

Figure 2 there are 13 regions and 13 solid circles each of which can be uniquely represented by 4

Figure 2 Codewords in 2-dimensional space

bits Thus this is a 2-dimensional 4-bit VQ Its rate is also 2 bitsdimension

22 Workings of VQ in compression

A vector quantizer is composed of two operations The first is the encoder and the second is the

decoder (Gonzalez and Woods 2006)The encoder takes an input vector and outputs the index of the codeword that offers the lowest

distortion In this case the lowest distortion is found by evaluating the Euclidean distance between the

input vector and each codeword in the codebook Once the closest codeword is found the index of

that codeword is sent through a channel (the channel could be a computer storage communicationschannel and so on) When the decoder receives the index of the codeword it replaces the index with

the associated codeword Figure 3 shows a block diagram of the operation of the encoder and thedecoder

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 59

Figure 3 The Encoder and decoder in a vector quantizer

In Figure 3 an input vector is given the closest codeword is found and the index of the codeword issent through the channel The decoder receives the index of the codeword and outputs the codeword

23 DCT Process

The general overview of the DCT is as below

1 The image is broken into 8x8 blocks of pixels

2 Working from left to right top to bottom the DCT is applied to each block

3 Each block is quantized and codebook is generated using k-means algorithm

4 Using codebook and the procedure used in VQ the image is compressed

5 When desired the image is reconstructed through decompression a process that uses the

Inverse Discrete Cosine Transform

24 The DCT Equation

The DCT equation (Eq3) computes the (i jth

) entry of the DCT of an image

= (3)

= = 01 gt 0 4)

p(xy) is the (xy)th

element of the image represented by the matrix p N is the size of the block on that

the DCT is done The equation calculates one entry (ij)th

of the transformed image from the pixel

values of the original image matrix For the standard 8x8 block N equals 8 and x and y range from 0to 7 Therefore D(ij) would be as in equation 5 = (5)

Because the DCT uses cosine functions the resulting matrix depends on the horizontal diagonal andvertical frequencies Therefore an image black with a lot of change in frequency has a very random

looking resulting matrix while an image matrix of just one color has a resulting matrix of a largevalue for the first element and zeroes for the other elements

25 The DCT MatrixTo get the matrix form of equation(3) we may use the equation(6) as below

= = 0 gt 0 (6)

The DCT matrix for a block of size 8x8 is listed in Table 1

=

3536 4904 4619 4157 35362778 1913minus0975

3536 41571913minus0975minus3536minus4904minus4619minus2778

3536 2778minus1913 4904minus35360975 4619 4157

3536 0975minus4619minus2778 35364157minus1913minus4904

3536minus0975minus4619 2778 3536minus4157minus1913 4904

3536minus2778minus1913 4904minus3536minus0975 4619minus4157

3536minus4157 1913 0975minus35364904minus4619 2778

3536minus4904 4619minus4157 3536minus2778 1913minus0975

Table 1 DCT matrix

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 69

The first row (i = 0) of the matrix has all the entries equal to of equation (6)

The columns of T form an orthogonal set so T is an orthogonal matrix When doing the inverse DCT

the orthogonality of T is important as the inverse of T is prime which is easy to calculate

26 Doing the DCT on an 8x8 BlockThe pixel values of a black-and-white image range from 0 to 255 in steps of 23 where pure black is

represented by 0 and pure white by 255 Thus it can be seen how a photo illustration etc can beaccurately represented by the 256 shades of graySince an image comprises hundreds or even thousands of 8x8 blocks of pixels the procedure is

happened to one 8x8 block and is done to all of them in the earlier specified orderThe DCT is designed to work on pixel values ranging from -128 to 127 the original block is leveled

off by subtracting 128 from each entryWe are now ready to perform the Discrete Cosine Transform which is accomplished by matrixmultiplication

D = TMT prime (7)In equation (7) matrix M is first multiplied on the left by the DCT matrix T from the previous section

This operation transforms the rows The columns are then transformed by multiplying on the right bythe transpose of the DCT matrix This yields D

This block matrix now consists 64 DCT coefficients Cij where i and j range from 0 to 7 The top-leftcoefficient C00 correlates to the low frequencies of the original image block As we move away from

C00 in all directions the DCT coefficients correlate to higher and higher frequencies of the imageblock and C77 corresponds to the highest frequency Human eye is most sensitive to low frequencies

and results from quantization step will reflect this fact

27 QuantizationOur 8x8 block of DCT coefficients is now ready for compression by quantization A remarkable and

highly useful feature is that in this step varying levels of image compression and quality areobtainable through selection of specific quantization matrices This enables the user to decide on

quality levels ranging from 1 to 100 where 1 gives the poorest image quality and highest compression

and quality are obtainable through selection of specific quantization matricesQuantization is achieved by dividing each element in the transformed image matrix D by the

corresponding element in the quantization matrix and then rounding to the nearest integer value28 Measurement of performance

To judge the performance of a lossy compression technique we need to decide upon using the errorcriterion The error criteria commonly used may be classified into two broad groups

bull Objective criteria andbull Subjective criteria

The first group of measures need mathematical formulation and restricted to statistical sense only

while it is very difficult to standardize the second group of measures as it involves human observersbull Objective criteria

For objective measurement we can use Mean Squared Error (MSE) and Peak Signal to Noise Ratio

(PSNR)MSE may be defined by equation(8)

= minus (8)

where M is the number of elements in the imageFor 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

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 4: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 49

where x j is the j

th

component of the input vector and yij is the j

th

component of the codeword yi In

Figure 2 there are 13 regions and 13 solid circles each of which can be uniquely represented by 4

Figure 2 Codewords in 2-dimensional space

bits Thus this is a 2-dimensional 4-bit VQ Its rate is also 2 bitsdimension

22 Workings of VQ in compression

A vector quantizer is composed of two operations The first is the encoder and the second is the

decoder (Gonzalez and Woods 2006)The encoder takes an input vector and outputs the index of the codeword that offers the lowest

distortion In this case the lowest distortion is found by evaluating the Euclidean distance between the

input vector and each codeword in the codebook Once the closest codeword is found the index of

that codeword is sent through a channel (the channel could be a computer storage communicationschannel and so on) When the decoder receives the index of the codeword it replaces the index with

the associated codeword Figure 3 shows a block diagram of the operation of the encoder and thedecoder

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 59

Figure 3 The Encoder and decoder in a vector quantizer

In Figure 3 an input vector is given the closest codeword is found and the index of the codeword issent through the channel The decoder receives the index of the codeword and outputs the codeword

23 DCT Process

The general overview of the DCT is as below

1 The image is broken into 8x8 blocks of pixels

2 Working from left to right top to bottom the DCT is applied to each block

3 Each block is quantized and codebook is generated using k-means algorithm

4 Using codebook and the procedure used in VQ the image is compressed

5 When desired the image is reconstructed through decompression a process that uses the

Inverse Discrete Cosine Transform

24 The DCT Equation

The DCT equation (Eq3) computes the (i jth

) entry of the DCT of an image

= (3)

= = 01 gt 0 4)

p(xy) is the (xy)th

element of the image represented by the matrix p N is the size of the block on that

the DCT is done The equation calculates one entry (ij)th

of the transformed image from the pixel

values of the original image matrix For the standard 8x8 block N equals 8 and x and y range from 0to 7 Therefore D(ij) would be as in equation 5 = (5)

Because the DCT uses cosine functions the resulting matrix depends on the horizontal diagonal andvertical frequencies Therefore an image black with a lot of change in frequency has a very random

looking resulting matrix while an image matrix of just one color has a resulting matrix of a largevalue for the first element and zeroes for the other elements

25 The DCT MatrixTo get the matrix form of equation(3) we may use the equation(6) as below

= = 0 gt 0 (6)

The DCT matrix for a block of size 8x8 is listed in Table 1

=

3536 4904 4619 4157 35362778 1913minus0975

3536 41571913minus0975minus3536minus4904minus4619minus2778

3536 2778minus1913 4904minus35360975 4619 4157

3536 0975minus4619minus2778 35364157minus1913minus4904

3536minus0975minus4619 2778 3536minus4157minus1913 4904

3536minus2778minus1913 4904minus3536minus0975 4619minus4157

3536minus4157 1913 0975minus35364904minus4619 2778

3536minus4904 4619minus4157 3536minus2778 1913minus0975

Table 1 DCT matrix

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 69

The first row (i = 0) of the matrix has all the entries equal to of equation (6)

The columns of T form an orthogonal set so T is an orthogonal matrix When doing the inverse DCT

the orthogonality of T is important as the inverse of T is prime which is easy to calculate

26 Doing the DCT on an 8x8 BlockThe pixel values of a black-and-white image range from 0 to 255 in steps of 23 where pure black is

represented by 0 and pure white by 255 Thus it can be seen how a photo illustration etc can beaccurately represented by the 256 shades of graySince an image comprises hundreds or even thousands of 8x8 blocks of pixels the procedure is

happened to one 8x8 block and is done to all of them in the earlier specified orderThe DCT is designed to work on pixel values ranging from -128 to 127 the original block is leveled

off by subtracting 128 from each entryWe are now ready to perform the Discrete Cosine Transform which is accomplished by matrixmultiplication

D = TMT prime (7)In equation (7) matrix M is first multiplied on the left by the DCT matrix T from the previous section

This operation transforms the rows The columns are then transformed by multiplying on the right bythe transpose of the DCT matrix This yields D

This block matrix now consists 64 DCT coefficients Cij where i and j range from 0 to 7 The top-leftcoefficient C00 correlates to the low frequencies of the original image block As we move away from

C00 in all directions the DCT coefficients correlate to higher and higher frequencies of the imageblock and C77 corresponds to the highest frequency Human eye is most sensitive to low frequencies

and results from quantization step will reflect this fact

27 QuantizationOur 8x8 block of DCT coefficients is now ready for compression by quantization A remarkable and

highly useful feature is that in this step varying levels of image compression and quality areobtainable through selection of specific quantization matrices This enables the user to decide on

quality levels ranging from 1 to 100 where 1 gives the poorest image quality and highest compression

and quality are obtainable through selection of specific quantization matricesQuantization is achieved by dividing each element in the transformed image matrix D by the

corresponding element in the quantization matrix and then rounding to the nearest integer value28 Measurement of performance

To judge the performance of a lossy compression technique we need to decide upon using the errorcriterion The error criteria commonly used may be classified into two broad groups

bull Objective criteria andbull Subjective criteria

The first group of measures need mathematical formulation and restricted to statistical sense only

while it is very difficult to standardize the second group of measures as it involves human observersbull Objective criteria

For objective measurement we can use Mean Squared Error (MSE) and Peak Signal to Noise Ratio

(PSNR)MSE may be defined by equation(8)

= minus (8)

where M is the number of elements in the imageFor 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

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 5: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 59

Figure 3 The Encoder and decoder in a vector quantizer

In Figure 3 an input vector is given the closest codeword is found and the index of the codeword issent through the channel The decoder receives the index of the codeword and outputs the codeword

23 DCT Process

The general overview of the DCT is as below

1 The image is broken into 8x8 blocks of pixels

2 Working from left to right top to bottom the DCT is applied to each block

3 Each block is quantized and codebook is generated using k-means algorithm

4 Using codebook and the procedure used in VQ the image is compressed

5 When desired the image is reconstructed through decompression a process that uses the

Inverse Discrete Cosine Transform

24 The DCT Equation

The DCT equation (Eq3) computes the (i jth

) entry of the DCT of an image

= (3)

= = 01 gt 0 4)

p(xy) is the (xy)th

element of the image represented by the matrix p N is the size of the block on that

the DCT is done The equation calculates one entry (ij)th

of the transformed image from the pixel

values of the original image matrix For the standard 8x8 block N equals 8 and x and y range from 0to 7 Therefore D(ij) would be as in equation 5 = (5)

Because the DCT uses cosine functions the resulting matrix depends on the horizontal diagonal andvertical frequencies Therefore an image black with a lot of change in frequency has a very random

looking resulting matrix while an image matrix of just one color has a resulting matrix of a largevalue for the first element and zeroes for the other elements

25 The DCT MatrixTo get the matrix form of equation(3) we may use the equation(6) as below

= = 0 gt 0 (6)

The DCT matrix for a block of size 8x8 is listed in Table 1

=

3536 4904 4619 4157 35362778 1913minus0975

3536 41571913minus0975minus3536minus4904minus4619minus2778

3536 2778minus1913 4904minus35360975 4619 4157

3536 0975minus4619minus2778 35364157minus1913minus4904

3536minus0975minus4619 2778 3536minus4157minus1913 4904

3536minus2778minus1913 4904minus3536minus0975 4619minus4157

3536minus4157 1913 0975minus35364904minus4619 2778

3536minus4904 4619minus4157 3536minus2778 1913minus0975

Table 1 DCT matrix

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 69

The first row (i = 0) of the matrix has all the entries equal to of equation (6)

The columns of T form an orthogonal set so T is an orthogonal matrix When doing the inverse DCT

the orthogonality of T is important as the inverse of T is prime which is easy to calculate

26 Doing the DCT on an 8x8 BlockThe pixel values of a black-and-white image range from 0 to 255 in steps of 23 where pure black is

represented by 0 and pure white by 255 Thus it can be seen how a photo illustration etc can beaccurately represented by the 256 shades of graySince an image comprises hundreds or even thousands of 8x8 blocks of pixels the procedure is

happened to one 8x8 block and is done to all of them in the earlier specified orderThe DCT is designed to work on pixel values ranging from -128 to 127 the original block is leveled

off by subtracting 128 from each entryWe are now ready to perform the Discrete Cosine Transform which is accomplished by matrixmultiplication

D = TMT prime (7)In equation (7) matrix M is first multiplied on the left by the DCT matrix T from the previous section

This operation transforms the rows The columns are then transformed by multiplying on the right bythe transpose of the DCT matrix This yields D

This block matrix now consists 64 DCT coefficients Cij where i and j range from 0 to 7 The top-leftcoefficient C00 correlates to the low frequencies of the original image block As we move away from

C00 in all directions the DCT coefficients correlate to higher and higher frequencies of the imageblock and C77 corresponds to the highest frequency Human eye is most sensitive to low frequencies

and results from quantization step will reflect this fact

27 QuantizationOur 8x8 block of DCT coefficients is now ready for compression by quantization A remarkable and

highly useful feature is that in this step varying levels of image compression and quality areobtainable through selection of specific quantization matrices This enables the user to decide on

quality levels ranging from 1 to 100 where 1 gives the poorest image quality and highest compression

and quality are obtainable through selection of specific quantization matricesQuantization is achieved by dividing each element in the transformed image matrix D by the

corresponding element in the quantization matrix and then rounding to the nearest integer value28 Measurement of performance

To judge the performance of a lossy compression technique we need to decide upon using the errorcriterion The error criteria commonly used may be classified into two broad groups

bull Objective criteria andbull Subjective criteria

The first group of measures need mathematical formulation and restricted to statistical sense only

while it is very difficult to standardize the second group of measures as it involves human observersbull Objective criteria

For objective measurement we can use Mean Squared Error (MSE) and Peak Signal to Noise Ratio

(PSNR)MSE may be defined by equation(8)

= minus (8)

where M is the number of elements in the imageFor 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

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 6: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 69

The first row (i = 0) of the matrix has all the entries equal to of equation (6)

The columns of T form an orthogonal set so T is an orthogonal matrix When doing the inverse DCT

the orthogonality of T is important as the inverse of T is prime which is easy to calculate

26 Doing the DCT on an 8x8 BlockThe pixel values of a black-and-white image range from 0 to 255 in steps of 23 where pure black is

represented by 0 and pure white by 255 Thus it can be seen how a photo illustration etc can beaccurately represented by the 256 shades of graySince an image comprises hundreds or even thousands of 8x8 blocks of pixels the procedure is

happened to one 8x8 block and is done to all of them in the earlier specified orderThe DCT is designed to work on pixel values ranging from -128 to 127 the original block is leveled

off by subtracting 128 from each entryWe are now ready to perform the Discrete Cosine Transform which is accomplished by matrixmultiplication

D = TMT prime (7)In equation (7) matrix M is first multiplied on the left by the DCT matrix T from the previous section

This operation transforms the rows The columns are then transformed by multiplying on the right bythe transpose of the DCT matrix This yields D

This block matrix now consists 64 DCT coefficients Cij where i and j range from 0 to 7 The top-leftcoefficient C00 correlates to the low frequencies of the original image block As we move away from

C00 in all directions the DCT coefficients correlate to higher and higher frequencies of the imageblock and C77 corresponds to the highest frequency Human eye is most sensitive to low frequencies

and results from quantization step will reflect this fact

27 QuantizationOur 8x8 block of DCT coefficients is now ready for compression by quantization A remarkable and

highly useful feature is that in this step varying levels of image compression and quality areobtainable through selection of specific quantization matrices This enables the user to decide on

quality levels ranging from 1 to 100 where 1 gives the poorest image quality and highest compression

and quality are obtainable through selection of specific quantization matricesQuantization is achieved by dividing each element in the transformed image matrix D by the

corresponding element in the quantization matrix and then rounding to the nearest integer value28 Measurement of performance

To judge the performance of a lossy compression technique we need to decide upon using the errorcriterion The error criteria commonly used may be classified into two broad groups

bull Objective criteria andbull Subjective criteria

The first group of measures need mathematical formulation and restricted to statistical sense only

while it is very difficult to standardize the second group of measures as it involves human observersbull Objective criteria

For objective measurement we can use Mean Squared Error (MSE) and Peak Signal to Noise Ratio

(PSNR)MSE may be defined by equation(8)

= minus (8)

where M is the number of elements in the imageFor 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

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 7: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 79

The PSNR may be defined by equation (9)

= 10 (9)

where n is the number of bits per symbolAs an example if we want to find the PSNR between two 256 gray level images then we set n to 8

bitsbull Subjective criteria

For subjective measurement the original image and the reconstructed image are shown to a largegroup of examiners Each examiner assigns a grade to the reconstructed image with respect to the

original image These grades may be drawn from a subjective scale and may be divided as excellent

good reasonable poor unacceptable Based on grades assigned by examiners an overall grade isassigned to the reconstructed image Complement of this grade gives an idea of the subjective error

3 The Hybrid Approach VQ-DCT based Compression

We are performing Discrete Cosine Transformation with VQ and the new approach may be

considered as VQ-DCT based image compression

31 Designing of the codebook

Designing a codebook that best represents the set of input vectors is NP-hard This means that it

requires an exhaustive search for the best possible codewords in space and the search increasesexponentially as the number of codewords increases We therefore resort to sub optimal codebook

design schemes and the one we consider here is the simplest one

The way we have designed codebook is as below

Here we have considered ten images of size 512x512 as the basic consideration Pixel values of theimages are concatenated one after another to form a matrix of size 512x5120 and divided into blocks

of 8x8 pixels and they will be subsequently processed from left to right and top to bottom Then theblocks are stored as vectors Each of which is a 64 elements array So for the obtained matrix of ten

input images of size 512x5120 we get one file of size 40960x64 pixels or 40960 vectors

Now the initial codebook has been initialized with some arbitrary values The resultant codebook isdifferent for different choices Size depends on the number of the codewords in the codebook

Considering the first vector of the initial codebook the Euclidean distance of that vector with all the

other vectors of the initial codebook is found out and stored in a single dimension array with elementnumber equal to number of codewords in the codebook The minimum value from the array is found

out and the vector of the initial codebook will be within that vector region These operations are

performed till the end of the initial codebookCalculate the average of the vectors in a particular region of the codebook are calculated and stored

into the codebookFollowing these procedures all the codewords are modified and this process continues till the two

consecutive operations do not change the codewords in a significant manner or the changes are withinthe limit of the considered tolerance

The DCT matrix along with its transpose matrix is considered now to generate the final codebook

The first 8x8 block from the generated codebook is considered and DCT of the data is made and keptin another transformation array of size 8x8 Now the transformation array is written to dctcodebook

All the data of the codebook are processed following the above and the codebook with DCT values is

ready for use

32 Compression and Decompression of the images The image to be compressed is considered and divided into 8x8 blocks The 8x8 blocks are thentransformed into the transformation array using DCT The transformation array is now converted into

an array of size 4096 x 64 which contains the DCT values with 4096 vectors Each vector of this file

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 8: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 89

is now compared with the codewords of dctcodebook and the index value of the dctcodebook is storedwhich belongs to minimum Euclidean distance The index array is the compressed value of the image

To decompress the image the index value of that image is used From the index we can get thevalues for the corresponding vectors in the dctcodebook But the original one is the ultimate desire

To do that we can transform the dctcodebook vectors into their original values by using inverse DCTfunctions or in a simpler manner we can reconstruct the image from the codebook with the help of the

index array Thus the ultimate decompressed image is reconstructed Then the performance criterion

PSNR is calculated

4 PerformanceThe performance of the VQ based compression and the new VQ-DCT based compression approach isevaluated in terms of PSNR

The output results of the images considered are presented below in the Table 2 with the size of the

image size of the block number of codewords in the codebookThe results of the algorithms on different images with the block size 8x8 are presented in Table 2

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 8x8 256 25899132 27276513

Baboon 512x512 8x8 256 20858301 22302915

Barb 512x512 8x8 256 23168871 25725581

Boat 512x512 8x8 256 25358310 27576528

Couple 512x512 8x8 256 25910507 27983451

Kiel 512x512 8x8 256 21531078 24938610

Lake 512x512 8x8 256 22300915 25625083

Lena 512x512 8x8 256 25925383 28076503

Man 512x512 8x8 256 24933610 25925388

Peppers 512x512 8x8 256 25875566 27276513

Zelda 512x512 8x8 256 28670153 29929355

Table 2 Performance in terms of PSNR with block size 8x8

And the results of the algorithms on different images with the block size 4x4 are presented in Table 3

It can be observed from tables 2 and 3 that performance of both the algorithms is better with smaller

block size as compared to that with larger block size When the performance of the proposedalgorithm is compared with standard VQ based method it can be observed the PSNR values for all the

images with proposed method is quite better than that with standard VQ based method implying that

the retrieved image quality with proposed method is superior

Image Size of

the

Image

Block

Size

Number

of

Vectors

PSNR of VQ

based

compression

PSNR of the

proposed

approach

Airplane 512x512 4x4 256 25911146 27566214

Baboon 512x512 4x4 256 20867771 22675425

Barb 512x512 4x4 256 23907484 25729589

Boat 512x512 4x4 256 25272032 27546538

Couple 512x512 4x4 256 25953247 27883403

Kiel 512x512 4x4 256 21953107 24969231

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland

Page 9: Revised Vq Dct Au Journal

7272019 Revised Vq Dct Au Journal

httpslidepdfcomreaderfullrevised-vq-dct-au-journal 99

Lake 512x512 4x4 256 22277294 25547823

Lena 512x512 4x4 256 26312237 28476073

Man 512x512 4x4 256 24189133 25763429

Peppers 512x512 4x4 256 26082239 27276513

Zelda 512x512 4x4 256 28725544 29776512

Table 3 Performance in terms of PSNR with block size 4x4

5 ConclusionStandard images are compressed using both the standard VQ method and proposed method with

different block sizes and the PSNR as performance index is obtained for each case for comparison It

is observed that using the proposed image compression method the PSNR is improved for all theimages which is vivid from the tables 2 amp 3 Thus the quality of the image is enhanced as PSNR isincreased So the new approach may be considered as the superior one and can be used for the further

development of the compression and decompression tools

References

1 R C Gonzalez and R E Woods (2006) Digital Image Processing Pearson Education

Second Impression2 httpwwwdata-compressioncomvqshtml

3 C Christopoulos A Skodras T Ebrahimi (2000) ldquoThe JPEG2000 still image coding

system an Overviewrdquo IEEE Trans on Consumer Electronics Vol 46 Issue 4 pp1103-1127

4 B Chanda and D Dutta Majumder (2000) ldquoDigital Image Processing and AnalysisrdquoPrentice Hall Pvt Ltd

5 D Taubman M Marcellin (2002) ldquoJPEG 2000 Image Compression FundamentalsStandards and Practicerdquo Boston Kluwer

6 John McGowan ldquoAVI Overview Video Compression Technologies rdquo available at

httpwwwjmcgowancomavialgohtml

7 Hareesh Kesavan ldquoChoosing a DCT Quantization Matrix for JPEG Encodingrdquo available atwwwjmcgowancomavialgohtml

8 K Rao K P Yip (1990) ldquoDiscrete Cosine Transform Algorithms Advantages

Applicationsrdquo Academic Press

9 John McGowan ldquoAVI Overview Video Compression Technologiesrdquo available athttpwwwjmcgowancomavialgohtml

10 K Cabeen and P Gent ldquoImage Compression and the Discrete Cosine Transformrdquo available

at httponlineredwoodscccausinstructdarnoldLAPROJFall98 PKendctpdf

11 A B Y Linde and R M Gray (1980) An algorithm for vector quantization designrdquo IEEE

Transactions on Communicatinos Vol COM-28 pp 84-95

12 N Ponomarenko V Lukin K Egiazarian J Astola (2002) ldquoPartition Schemes in DCTBased Image Compressionrdquo Technical Report 3-2002 ISBN 952-15-0811-6 Tampere

University of Technology Finland