david chernyak image compression presentation - inside...
TRANSCRIPT
Introduction Image compression – reducing the amount of data required to represent an image
Motivation: Interest in how files can be represented so compactly Necessary for storage purposes
A 2 hour movie at 30 fps with 720 x 480 pixels/frame would require 224 GB of storage uncompressed
Motivation Applications
Movie compression Digital camera photos Web page images Televideo conferencing Medical imaging Many more
Project Goals Discuss several common file formats
JPEG JPEG‐2000 GIF PNG
Implement algorithms on sets of test images Compare and contrast important compression statistics: CR, SNR, RMSE
Previous Work Two main resources
Performance Analysis of Various Image Compression Techniques Discusses techniques such as Huffman Coding, DCT, etc Applies algorithms on a set of test images Compares using common image compression statistics
Digital Image Processing (Class Textbook) Large amounts of information on compression techniques
Previous Work Active Field Deanna Needell – Robust image recovery via total‐variation minimization (10/22/12) Importance of compression to store more data Discussed techniques for image compression Tries to minimize L1 norm Compares HaarWavelet Basis and Gradients
File Format Summary JPEG
Joint Photographic Experts Group standard for photographic quality images
Lossy coding system most common (Lossless exists) Uses discrete cosine transforms on 8 x 8 image blocks, Huffman coding, run‐length coding
One of the most popular methods for compressing images
File Format Summary JPEG‐2000
Follow‐on to JPEG to try to increase compression of photographic quality images
Arithmetic coding and discrete wavelet transforms (DWT) are used.
Compression can be lossy or lossless
File Format Summary GIF
Graphic Interchange Format Uses lossless LZW (Lempel‐Ziv‐Welch) coding 1‐8 bit images Frequently used to make small animations and low resolution films
File Format Summary PNG
Portable Network Graphics Lossless Compression of full color images Predictive Coding – difference between pixel values
Why not use TIFF? File format that operates as a container Can hold many different compression standards
JPEG
Block Transform Coding Map subimages into transform coefficients, encode
Lossy JPEG 8 x 8 subimages DCT Quantize coefficients Huffman and run‐length coding
DCT
DCT 8x8 Basis Functions
Quantization JPEG committee suggests matrix with quanitzationlevel 50
Entropy Coding JPEG algorithm optimizes encoding based on transform properties DC encoded as difference between subimages
Large, variable, but often close to previous value
AC component: Run length coding Has lots of zeros Encode as # of zeros followed by value of next non‐zero
Use Huffman coding to encode entire list Table generated in advance
JPEG‐2000
Main differences between JPEG‐2000 and JPEG DCT replaced with discrete wavelet transform (DWT)
Based on multi‐resolution image representation Purpose to obtain approximations of a function at different levels of resolution
Replaces Huffman coder with arithmetic coder Mathematically superior, slower to encode Typically makes file 5‐7% smaller
Discrete Wavelet Transform A function ψ is called a wavelet if it can be used to define a Hilbert basis Orthogonal basis for the space of square integrablefunctions
Hilbert basis:
Representation:
JPEG 2000 Wavelet Cohen‐Daubechies‐Feauveau wavelets (CDF) For ever positive integer A,
Lossless compression CDF 5/3 wavelet (A = 2)
Lossy compression CDF 9/7 wavelet (A = 4)
GIF LZW Coding
Lossless Replaces strings of characters with codes Requires no knowledge of the probability of occurrence For 8‐bit images, first 256 codes are assigned 0,1,…255 Then, sequences not in the dictionary are added
Example Assume dictionary a = 0 b = 1 d = 2 n = 3 _ = 4
LZW ExampleInput Current
StringSeen this? Encoded
OutputNew Dictionary Entry
b b yes nothing none
ba ba no 1 ba/5
ban an no 1,0 an/6
bana na no 1,0,3 na/7
banan an yes no change none
banana ana no 1,0,3,6 ana/8
banana_ a_ no 1,0,3,6,0 a_/9
banana_b _b no 1,0,3,6,0,4 _b/10
banana_ba ba yes no change none
banana_ban ban no 1,0,3,6,0,4,5 ban/11
banana_band nd no 1,0,3,6,0,4,5,3 nd/12
banana_banda da no 1,0,3,6,0,4,5,3,2 da/13
banana_bandan an yes no change none
banana_bandana ana yes 1,0,3,6,0,4,5,3,2,8 none
LZW Coding LZW dictionary created while data is being encoded. Builds an identical decompression dictionary Long sequences for one code and repeated sequences optimize compression
Possible issues: Dictionary Overflow
Flush when full Flush when compression performance becomes poor
PNG Deflate compression algorithm
Lossless compression LZ77 algorithm
Replaces recurring patterns in data with a short code Maintains history buffer, tries to match to next part
Huffman coding
LZ77 Example String in look‐ahead buffer is searched for in history Longest match used, distance and length are recorded
Compression based on repetition Addressing must be limited
search look‐up output
abracadabra (0,0,a)
a bracadabra (0,0,b)
ab racadabra (0,0,r)
abr acadabra (3,1,c)
abrac adabra (2,1,d)
abracad abra (7,4,null)
Advantages JPEG
Can specify quality Useful for real images, photos Exploits properties that our eyes see best
JPEG‐2000 Multi‐resolution Arithmetic Coding Wavelets
GIF Supports animation LZW one of the best general purpose algorithms
PNG Designed as improvement to GIF Better compression, more options
Disadvantages JPEG
Not well suited to flat‐color or sharp‐edged images Compression effects are cumulative
JPEG‐2000 Resource intensive Does poorly at very high compression ratios (25 : 1)
GIF Maximum of 8 bits, 256 colors Doesn’t work well with bilevel or true color images
PNG No animation
ResultsJPEG ImageOriginal Image
JPEG‐2000 Image
Results
ResultsCR RMSE PSNR
JPEG 24.7 : 1 0.0098 64.28JPEG 2000 7.5 : 1 0.0011 83.08
GIF 5.0 : 1 0 infPNG 8.7 : 1 0 inf
CR RMSE PSNRJPEG 15.3 : 1 0.012 62.51
JPEG 2000 2.5 : 1 0.002 78.05GIF 1.3 : 1 0 infPNG 2.0 : 1 0 inf
CR RMSE PSNRJPEG 30.4 : 1 0.0081 65.93
JPEG 2000 6.9 : 1 0.0016 79.82GIF 3.1 : 1 0 infPNG 4.1 : 1 0 inf
CR RMSE PSNRJPEG 38.9 : 1 0.0056 69.09
JPEG 2000 6.4 : 1 0.0022 77.34GIF 1.8 : 1 0 infPNG 3.1 : 1 0 inf
CR RMSE PSNRJPEG 31.7 : 1 0.0066 67.71
JPEG 2000 5.6 : 1 0.0022 77.33GIF 1.7 : 1 0 infPNG 2.9 : 1 0 inf
Artificial Cathedral Fireworks
Flower FoodCR RMSE PSNR
JPEG 73.1 : 1 0.0259 55.81JPEG 2000 14.6 : 1 0.0019 78.62
GIF 9.3 : 1 0 infPNG 13.5 : 1 0 inf
Cameraman
Results
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0 1 2 3 4 5 6 7
Com
pres
sion Ratio
Test
Compression Ratio for Different Pictures
JPEG
JPEG‐2000
GIF
PNG
Results
0
0.005
0.01
0.015
0.02
0.025
0.03
0 1 2 3 4 5 6 7
RMSE
Test
RMSE for Different Pictures
JPEG
JPEG‐2000
References [1] D. O. Kukreja, S.R. Suralkar, A.H. Karode, “Performance Analysis of
Various Image Compression Techniques,” Pratibha: International Journal of Science, Spirituality, Business, and Technology (IJSSBT), Vol. 1, No.1, March 2012 pp. 98‐109
[2] R. Gonzalez, R. Woods. Digital Image Processing, third edition. Pearson Education International, 2007, pp. 547‐644.
[3] T. Lee, P. Wu “Other Still Image Compression Standards” Internet: disp.ee.ntu.edu.tw/tutorial, Dec. 19, 2010 [Dec. 2012].
Questions?