12
ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION USING DCT ALGORITHM Tushar Gupta 1 , A NithyaKalyani 2 , Utkarsh Rahim 3 , 1,2,3 Department of Computer Science and Engineering, SRM Institute of Science and Technology, Chennai July 24, 2018 Abstract Image compression is a method in general used to change the size of an original image and convert it into an image of reduced size yet maintaining the visibility of the content the image has. However, depending upon ones requirement im- ages might require compression at a high rate which might take time in order to produce the result and also the image might lose its content to a good extent post compression. To deal with such flaws in image compression, various algo- rithms have been devised which help to reduce the time or maintain the content post compression or even both. These algorithms are therefore categorized into two different types based on quality of image regained post compression, mainly named as, lossy and lossless compression. Lossy algorithms based compression is mostly used when the required com- pression rate is high. However, when algorithms such as DCT are used then the quality of the compressed image degrades to a large extent and the time taken for the exe- cution of the process also increases as the compression rate increases. Thus, this results in various researches in the field of lossy image compression using DCT to mitigate the time taken and also achieve respectable content of the im- age as the compression rate increases. The main aim of 1 International Journal of Pure and Applied Mathematics Volume 120 No. 6 2018, 10311-10322 ISSN: 1314-3395 (on-line version) url: http://www.acadpubl.eu/hub/ Special Issue http://www.acadpubl.eu/hub/ 10311

ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

ANALYSIS AND IMPROVEMENT OFDIGITAL IMAGE COMPRESSION

USING DCT ALGORITHM

Tushar Gupta1, A NithyaKalyani2,Utkarsh Rahim3,

1,2,3Department of Computer Science and Engineering,SRM Institute of Science and Technology, Chennai

July 24, 2018

Abstract

Image compression is a method in general used to changethe size of an original image and convert it into an image ofreduced size yet maintaining the visibility of the content theimage has. However, depending upon ones requirement im-ages might require compression at a high rate which mighttake time in order to produce the result and also the imagemight lose its content to a good extent post compression.To deal with such flaws in image compression, various algo-rithms have been devised which help to reduce the time ormaintain the content post compression or even both. Thesealgorithms are therefore categorized into two different typesbased on quality of image regained post compression, mainlynamed as, lossy and lossless compression. Lossy algorithmsbased compression is mostly used when the required com-pression rate is high. However, when algorithms such asDCT are used then the quality of the compressed imagedegrades to a large extent and the time taken for the exe-cution of the process also increases as the compression rateincreases. Thus, this results in various researches in thefield of lossy image compression using DCT to mitigate thetime taken and also achieve respectable content of the im-age as the compression rate increases. The main aim of

1

International Journal of Pure and Applied MathematicsVolume 120 No. 6 2018, 10311-10322ISSN: 1314-3395 (on-line version)url: http://www.acadpubl.eu/hub/Special Issue http://www.acadpubl.eu/hub/

10311

Page 2: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

this paper is to implement a strategy which allows us tocompress the image at user defined specific rate and yetproduce results at the output such that there is minimaldifference in the quality of the image as well as keeping theexecution time at control while increasing the compressionrate when compared to implementation using a simple DCTalgorithm. The paper deals with the implementation of aDCT algorithm by directly using the lookup cosine table forcompression rather than calculating it so that the compres-sion happens at a faster rate compared to a normal DCTimplementation and also helps in reducing any unnecessaryarithmetic calculations. The performance of the image com-pression considering the time for execution as the parameterincreases for different sizes of image and the content of theimage does not get lost in the process therefore producingusable results when compared to a simple DCT algorithm.

Key Words:Normalisation, Direct Cosine Transform(DCT), Cosine Lookup Table, Padding.

1 Introduction

Digital images are now widely used for various applications suchas in defense, forensics, and medicines and also are in regular usefor the common man. However, the digital images formed containpixels and therefore range from being files in KB to MB. Therefore,as per ones requirement one can process the image either to com-press it or to transform it from one type to another. In general,image compression refers to the minimization of the size of an im-age, video or any other graphic file without degrading its quality toa level where it cannot be accepted. This minimization of the sizeoccurs in bytes. This minimization of the size helps to store moredata in a smaller amount of space. It also means to reduce the re-dundant and irrelevant data in the image so as to store it efficiently.For the purpose of compression, many compression techniques liketransform coding, scalar/vector quantization [1], differential codinghas been introduced. But, when it comes to low bit rate, transformcoding is more efficient than the others. There are two major imagecompression schemes. These are:1. Lossless Image Compression

2

International Journal of Pure and Applied Mathematics Special Issue

10312

Page 3: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

2. Lossy Image Compression

Lossless Image compression -In lossless image compression, the compression occurs in such away that the original image can be recovered from the compressedimage perfectly. Since, there is no addition to noise in this com-pression scheme, it is also called noiseless image compression. Thisscheme uses decomposition techniques to eliminate the redundantdata. This scheme is widely used in medical imaging. The tech-niques that are included in lossless compression are Run lengthencoding, Huffman encoding, LZW coding[10] and Area coding.Lossy Image Compression -In lossy image compression, the compression ratios are higher ascompared to the lossless image compression. This is a more widelyused scheme due to the adequacy for most users on the quality ofthe image. In this scheme, the compressed image and the originalimage are not identical, but quite close. In this, the transformationis completely reversible. It also uses processes like quantization toresult in the loss of information and entropy encoding. Then, thescheme applies decoding and de-quantization and thereby get thefinal reconstructed image. The techniques that re included in lossyimage compression are Vector quantization, Transformation cod-ing, Subband coding, Fractal coding and Block Truncation Coding[6].

Figure 1. Comparison between Lossless and Lossy image

3

International Journal of Pure and Applied Mathematics Special Issue

10313

Page 4: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

Thus, image compression eventually helps in compressing the im-age as per ones requirement however at the same time trying tokeep as much important information intact as possible so that allnecessary important information related to image is visible to theuser even after compressing the image. In this paper, we add arather more user friendly application to compress the Digital imagethrough DCT algorithm. To improve the application, we implementa strategy which allows us to compress the image at our own spec-ified rate and yet produce similar results at the output such thatthere is minimal difference in the quality of the image while com-pressing it by a greater rate. Such a task also helps us maintain ananalysis of different images obtained along-with their PSNR ratiowhen compared for different compression rates in comparison to asimple image compressed with DCT but without any experimentalimplementation.

2 Image Compression in Discrete Co-

sine Theorem

Figure 2. Architecture of image compression

Direct Cosine Theorem or DCT is a lossy image compressionalgorithm that transforms an image into separate parts of differ-ing importance. It is basically a Fourier related transform withthe main difference that it uses only real numbers. It transforms

4

International Journal of Pure and Applied Mathematics Special Issue

10314

Page 5: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

an image from spatial to frequency domain. It represents the im-age as sinusoids of different frequencies. It has a property thatfor a normal image, most of the information that holds visual im-portance is concentrated in just few coefficients of DCT. In lossyimage compression, the normalization is done after applying theforward DCT[8] or DCT-II . The forward DCT is done by usingthe formula:-

Where, the N real numbers x0, ..., xN-1 are transformed into the Nreal numbers X0, ..., XN-1. In normalization [7] after forward DCT,the image gets converted to a spatial image which basically consistsof a black image with white strands in the top left corner. These areattained by converting the values to 0 and 255 where 0 is black and255 is white. Thus, the top left coefficients are the ones that holdthe visual importance. This image is then requantized to elevenbits so that the data can be stored in eleven bit twos complementformat. Although the re-quantized data is never actually stored inan eleven-bit integer format, this process should create the samere-quantization noise that would be experienced if the data wereactually stored in eleven bits. After this process, inverse DCT isapplied on the image using the formula

This then produces the reconstructed image with some loss of in-formation due to DCT being a lossy image compression algorithm[10]. The below table shows the forward DCT implementation ona sample of values and the resultant coefficient values:

5

International Journal of Pure and Applied Mathematics Special Issue

10315

Page 6: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

Table 1. Input matrix

Table 2. Output Matrix

Thus, as seen from Table 2, the output matrix has the highestDC coefficient value of 186 which is of a high intensity and as onemoves away from this value, the AC terms becomes lower in theirmagnitude. Thus, it can be inferred that on performing DCT on acertain set of data, the image to be represented or the importantinformation from a certain data set is concentrated in the upperleft coefficients of the DCT output matrix [11], and the less usefulcontent is accumulated in the lower right coefficients of the outputmatrix. In the following step, the coefficients are normalised [12] sothat the unnecessary values or the less useful data is discarded andtherefore compresses the image data to give a compressed image as

6

International Journal of Pure and Applied Mathematics Special Issue

10316

Page 7: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

the result.

3 Results and Discussion

Image compression initially requires an image to be converted froma digital image[13] into a spectral image. During this process, theotherwise coloured or colourless image is converted into a grayscaleimage. After this conversion, the image is disintegrated into the re-spective planes of Red, Green and Blue. Once the individual planesare extracted, they are processed one by one by converting into 8X8blocks[14] structures such that the forward DCT is applied on ev-ery such block of the respective plane on their 1-D array producingcoefficient data. This data is normalized such that the unneces-sary coefficients are eliminated and only the required coefficientsare retained. On this data inverse DCT is applied to obtain the8X8 pixel blocks and the planes are combined to form a compositeimage. Also, zero padding[15] is applied to the top and bottom ofthe image to make the dimensions of the image to be multiple of 8pixels. This padding[15,16] is trimmed from the resulting spectralplanes and the resulting composite image before the final image iscomposed.

Table 3. Comparison table between general implementation andimproved method

7

International Journal of Pure and Applied Mathematics Special Issue

10317

Page 8: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

Figure 3. Comparison of DCT with improved method

4 Conclusion

As compared to the time-taking DCT implementation, the im-proved version breaks the image into blocks of 8x8. It then performsforward DCT producing a spectral coefficient data of 8x8 blocks. Itthen performs inverse DCT[17] on the spectral 8x8 blocks, therebyproducing an 8x8 pixel data. The image is basically constituted bythe composites of all the images. In the earlier version, the forwardDCT and inverse DCT [18] wasnt applied to the 8x8 blocks. Theimproved version is faster than the earlier version due to the rea-son that in the earlier version, the image is not broken down intoblocks, but rather performs the forward DCT on the entire image.Since the basic process in a DCT algorithm is the computing ofthe cosine value, the improved version looks for the cosine value in8x8 cosine table instead of computing it, which makes the programrun faster and thus affects the code. Also, the improvised systemimplements zero padding. This is a process that is applied to theright and bottom part of the image so that it forces each dimensionof the image to be a multiple of the number 8. This zero padding iscut short or trimmed from the spectral planes that is provided as aresult and the image that is a result of returning the processed im-

8

International Journal of Pure and Applied Mathematics Special Issue

10318

Page 9: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

age to the calling method. Another major factor that improves thespeed of the program is basically the fact the amount of arithmeticthat is required to do the transform when the image is divided intoblocks and then transforming each and every block as compared tousing transform on the entire image as a whole.

References

[1] Messaoudi and K. Srairi, Colour image compression algorithmbase on the DCT transform using difference lookup table, inIEEE Vol. 52 No. 20 pp. 16851686, 2016.

[2] Navpreet Saroya, Prabhpreet Kaur, Analysis of IMAGE COM-PRESSION Algorithm Using DCT and DWT Transforms, inISSN:2277 128X, Volume 4, Issue 2, IJARCSSE, February2014.

[3] Anurag Bhatt, Dr. Ashutosh Kumar Bhatt, Image Compres-sion Algorithms under JPEG with Lapped Orthogonal Trans-form and Discrete Cosine Transformation, e-ISSN: 2278-067X,p-ISSN: 2278-800X, Volume 7, Issue 3 (May 2013), PP. 06-10,IJERD, 2013.

[4] Boucetta, A., and Melkemi, K.E.: DWT based-approachfor color image compression using genetic algorithm, Imageand Signal Processing Springer Berlin Heidelberg, 2012, pp.476484.

[5] Deshlahra, Archana, G. S. Shirnewar, and A. K. Sahoo. ”AComparative Study of DCT, DWT Hybrid (DCT-DWT)Transform.” (2013).

[6] Delp, E.J., and Mitchell, O.R.: Image compression usingblock truncation coding, IEEE Trans Commun., 1979, 27, pp.13351342.

[7] Douak, F., Benzid, R., and Benoudjit, N.: Color image com-pression algorithm based on the DCT transform combinedto an adaptive block scanning, AEU-International Journal ofElectronics and Communications. 2011, 65, pp. 1626.

9

International Journal of Pure and Applied Mathematics Special Issue

10319

Page 10: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

[8] Sugreev Kaur and Rajesh Mehra, High Speed and Area Effi-cient 2d Dwt Processor Based Image Compression, Signal Im-age Processing: An International Journal (SIPIJ) Vol.1, No.2,December 2010.

[9] Pearlman, W., Islam, A., Nagaraj, N., and Said, Efficient,low-complexity image coding with a set partitioning embed-ded block coder, IEEE Transactions on Circuits and Systemsfor Video Technology., 2004, 14, pp. 12191235.

[10] Andrew B. Watson, Image Compression Using the DiscreteCosine Transform, Mathematical Journal, 4(1), 1994, p. 81-88.

[11] Anitha s, Image Compression Using Discrete Cosine TransformDiscrete Wavelet Transform, International Journal of ScientificEngineering Research Volume 2, Issue 8, August-2011 1 ISSN2229-5518.

[12] Salam Benchikh and Michael Corinthios, A Hybrid ImageCompression Technique Based on DWT and DCT Transforms,International Conference on Advanced Infocom Technology,IEEE Xplore June 2012

[13] R. Gonzalez, R. Woods, ”Digital image processing,” 2nd edi-tion, prentice Hall, New jersey, 2002.

[14] Y. Q. SHi, H. Sun, ”Image and video compression for multi-media engineering,” 2nd edition, CRC press, Taylor Francisgroup, 2008.

[15] M. Rabbani, R. Joshi, ”An overview of the JPEG 2000 still im-age compression standard,” Elsevier, Signal processing: ImageCommunication, pp. 3-48, 2002.

[16] Amanjot Kaur , Jaspreet Kaur , Comparision of Dct and Dwtof Image Compression Techniques, International Journal ofEngineering Research and Development ISSN: 2278-067X, Vol-ume 1, Issue 4 (June 2012), PP.49-52.

[17] Rafael C. Gonzalez, Richard Eugene; Digital image processing,Edition 3, 2008, page 466.

10

International Journal of Pure and Applied Mathematics Special Issue

10320

Page 11: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

[18] NageswaraRao Thota, Srinivasa Kumar Devireddy. ”ImageCompression Using Discrete Cosine Transform.” GeorgianElectronic Scientific Journal: Computer Science and Telecom-munications 3 (2008).

11

International Journal of Pure and Applied Mathematics Special Issue

10321

Page 12: ANALYSIS AND IMPROVEMENT OF DIGITAL IMAGE COMPRESSION ... · niques that are included in lossless compression are Run length encoding, Hu man encoding, LZW coding[10] and Area coding

10322