Performance Analysis of Lossy Image Compression Algorithms
Total Page:16
File Type:pdf, Size:1020Kb
Bachelor Project Czech Technical University in Prague Faculty of Electrical Engineering F3 Department of Radioelectronics Performance Analysis of Lossy Image Compression Algorithms Jan Ošťádal Supervisor: Ing. Karel Fliegel, Ph.D. August 2020 ii BACHELOR‘S THESIS ASSIGNMENT I. Personal and study details Student's name: Ošťádal Jan Personal ID number: 474444 Faculty / Institute: Faculty of Electrical Engineering Department / Institute: Department of Radioelectronics Study program: Electronics and Communications II. Bachelor’s thesis details Bachelor’s thesis title in English: Performance Analysis of Lossy Image Compression Algorithms Bachelor’s thesis title in Czech: Analýza účinnosti algoritmů ztrátové komprese obrazu Guidelines: Provide an overview of current image codecs, including a comparison of the compression methods used and available implementations. For the selected application scenario, analyze and compare the performance of the selected codecs on suitable image data. Bibliography / sources: [1] Wu, H. R., Rao, K. R., Digital Video Image Quality and Perceptual Coding, CRC Press, 2006. [2] Gonzalez, R. C., Woods, R. E., Digital image processing, Pearson, 2018. Name and workplace of bachelor’s thesis supervisor: Ing. Karel Fliegel, Ph.D., Department of Radioelectronics, FEE Name and workplace of second bachelor’s thesis supervisor or consultant: Date of bachelor’s thesis assignment: 12.02.2020 Deadline for bachelor thesis submission: 14.08.2020 Assignment valid until: 30.09.2021 ___________________________ ___________________________ ___________________________ Ing. Karel Fliegel, Ph.D. doc. Ing. Josef Dobeš, CSc. prof. Mgr. Petr Páta, Ph.D. Supervisor’s signature Head of department’s signature Dean’s signature III. Assignment receipt The student acknowledges that the bachelor’s thesis is an individual work. The student must produce his thesis without the assistance of others, with the exception of provided consultations. Within the bachelor’s thesis, the author must state the names of consultants and include a list of references. Date of assignment receipt Student’s signature CVUT-CZ-ZBP-2015.1 © ČVUT v Praze, Design: ČVUT v Praze, VIC iv Acknowledgements Declaration I would like to thank my supervisor Ing. I hereby declare that all information in Karel Fliegel, Ph.D. for his patience with this document has been obtained and pre- me in the challenging times this work was sented in accordance with academic rules created in and also to my friends from and ethical conduct. I also declare that, VV Art Production for providing me some as required by these rules and conduct, I photographs used in this work. have fully cited and referenced all mate- rial and results that are not original to this work. Place: Date: Signature: v Abstract Abstrakt The goal of this work is to examine com- Cílem této práce je prozkoumat kvalitu pression quality and efficiency of 5 differ- komprese a efektivitu 5 různých obrazo- ent image formats and their lossy compres- vých formátů a jejich ztrátových kompresí. sion. For this purpose from a database of Pro tento účel bylo z databáze stovky fo- hundreds high resolution photographs, 20 tografií s vysokým rozlišením vybráno 20 images were chosen based on their com- obrázků na základě jejich komplexity a plexity and based on to what extent those toho, v jaké míře tyto obrázky reprezen- images represent the typical image content tují typický obrazový obsah na internetu, on the internet, mainly on the social me- zejména na sociálních sítích. Poté byly dia. Those images were then compressed tyto obrázky komprimovány buď do spe- either into specific file size with the use of cifické velikosti souboru pomocí skriptu v a Matlab script that was written for this Matlabu, který byl pro tuto práci vytvo- work or by using a quality option that was řen, nebo pomocí nastavení kvality, které a part of a codec. To describe the quality bylo součástí konkrétního kodeku. K po- differences between the formats, several pisu rozdílů v kvalitě mezi kodeky bylo objective quality assessment metrics were použito několik metrik hodnocení kvality. used. As the last step those differences Jako poslední krok byly tyto rozdíly mezi between individual metrics and file for- jednotlivými metrikami a mezi formáty mats were described and compared be- porovnány pomocí Bjøntegaardovy met- tween each other for specific images with riky. the use of Bjøntegaard metric. Klíčová slova: Bjøntegaardova metrika, Keywords: Bjøntegaard’s metric, BPG, BPG, HEIC, Hodnocení kvality, JPEG, HEIC, JPEG, JPEG 2000, Quality JPEG 2000, WebP assessmen, WebP Překlad názvu: Analýza účinnosti Supervisor: Ing. Karel Fliegel, Ph.D. algoritmů ztrátové komprese obrazu Katedra radioelektroniky FEL, Technická 2, 166 27 Praha 6 vi Contents Introduction 1 3.3.5 BPG . 30 1 Basic principles 3 4 Conclusion 33 1.1 Transform coding . 3 Bibliography 35 1.1.1 Discrete cosine transform . 3 1.1.2 Discrete wavelet transform . 3 Attachments 39 1.2 Chroma subsampling . 4 Tables . 39 1.3 Compression formats . 4 MS-SIM . 39 1.3.1 JPEG . 5 SSIM. 40 1.3.2 JPEG 2000. 5 FSIM . 40 1.3.3 Better Portable Graphics . 5 FSIMc . 41 1.3.4 WebP . 6 MSE . 42 1.3.5 HEIF/HEIC . 6 PSNR . 42 1.4 Related research . 6 Plots . 43 Electronic attachments . 58 2 Compression and evaluation methodology 7 2.1 Image selection . 7 2.2 Complexity . 8 2.3 Typical internet content . 8 2.4 Reference Images . 10 2.5 Compression testing . 11 2.6 Compression process . 11 2.7 Quality Metrics . 13 2.7.1 SSIM . 13 2.7.2 FSIM and FSIMc . 14 2.7.3 MS-SIM . 14 2.7.4 Bjøntegaard’s metric . 14 2.8 Matlab implementation . 14 2.8.1 Complexity based image selection . 16 2.8.2 Characteristics . 17 2.8.3 Compression . 17 2.8.4 BPP change . 18 2.8.5 BPP compare . 18 2.8.6 Main Data . 18 2.8.7 MS SSIM and MSSIM Plots . 19 2.8.8 Plots . 19 2.8.9 Bjøntegaard . 19 3 Results 21 3.1 Image 4 . 23 3.2 Image 14 . 26 3.3 Overall results . 28 3.3.1 JPEG . 29 3.3.2 WebP . 29 3.3.3 J2K . 30 3.3.4 HEIC . 30 vii Figures Tables 2.1 Compression diagram for WebP, 1.1 Image lossy file formats . 5 BPG, J2K, JPEG . 13 2.2 Matlab implementation diagram 16 2.1 BPG Settings . 12 2.3 Image selection diagram . 17 2.2 HEIC Settings . 12 2.3 JPEG Settings . 12 3.1 Bitrate comparison. 23 2.4 JPEG 2000 Settings . 12 3.2 FSIM and FSIMc plots for Image 2.5 WebP Settings . 12 4 ............................. 24 3.3 MS-SIM and SSIM plots . 26 3.1 Complexity of reference images . 22 3.4 FSIM and FSIMc plots for Image 3.2 Bjontegaard’s bitrate saving . 25 14 ............................ 27 3.3 Bjontegaard’s metric improvement 25 3.5 MS-SIM and SSIM plots . 28 3.4 Bjøntegaard’s bitrate improvement . 28 3.5 Bjøntegaard’s metric improvement 28 4.1 MS-SIM dsnr Part 1 . 39 4.2 MS-SIM dsnr Part 2 . 39 4.3 MS-SIM rate Part 1 . 39 4.4 MS-SIM rate Part 2 . 40 4.5 SSIM dsnr Part 1 . 40 4.6 SSIM dsnr Part 2 . 40 4.7 SSIM rate Part 1 . 40 4.8 SSIM rate Part 2 . 40 4.9 FSIM dsnr Part 1 . 40 4.10 FSIM dsnr Part 2 . 41 4.11 FSIM rate Part 1 . 41 4.12 FSIM rate Part 2 . 41 4.13 FSIMc dsnr Part 1 . 41 4.14 FSIMc dsnr Part 2 . 41 4.15 FSIMc rate Part 1 . 41 4.16 FSIMc rate Part 2 . 42 4.17 MSE dsnr Part 1 . 42 4.18 MSE dsnr Part 2 . 42 4.19 MSE rate Part 1 . 42 4.20 MSE rate Part 2 . 42 4.21 PSNR dsnr Part 1 . 42 4.22 PSNR dsnr Part 2 . 43 4.23 PSNR rate Part 1. 43 4.24 PSNR rate Part 2. 43 viii Introduction Capturing moments was always a part of the human nature. Since the begin- ning of the human age humans have the need to record their achievements, important events or the beauty of their surroundings. In the modern era this purpose is bestowed upon photographs. With the development of digital cam- eras there is also a need for storing and reading the images on the computers and later on the internet and smartphones. The most common and known image format is JPEG which was created in 1992. Since then it has become the most common lossy compression format. However, today it is not the only format available for use whenever one is making a photo album, creating website or uploading images onto social media as Facebook or Instagram. People can choose from a large variety of formats and codecs and it is not always an easy task to choose the optimal codec/format for one’s need. The goal of this work is to extend current awareness about modern compression formats and compare the efficiency and compression quality of those modern formats. This work should act as a recommendation on which file format is optimal for one’s use. The first chapter describes basic principles used in lossy image compression and represents file formats that are subject for testing. Second chapter explains how the reference images are chosen based on their complexity and how are those images processed with used codecs. It also describes which quality metrics are used and how the Matlab implementation of the assessment works. The results are discussed in the last chapter with examples of 2 particular reference images. 1 2 Chapter 1 Basic principles The resulting product of lossy image compression contains less data then the original image and therefore saving capacity demand is reduced.