Document 13546843

advertisement
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 Haar Wavelet 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 quanitzation
level 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 integrable
functions
 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
Input
Current String
Seen this?
LZW Example
Encoded Output
New 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
yes
1,0,3,6,0,4,5,3,2,8
none
banana_bandana ana
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
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)
 Compression based on repetition
 Addressing must be limited
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
Results
JPEG Image
Original Image
JPEG‐2000 Image
Results
Results
Artificial
JPEG
JPEG 2000
GIF
PNG
CR
24.7 : 1
7.5 : 1
5.0 : 1
8.7 : 1
RMSE
0.0098
0.0011
0
0
Cathedral
PSNR
64.28
83.08
inf
inf
Flower
CR
JPEG
30.4 : 1
JPEG 2000 6.9 : 1
GIF
3.1 : 1
PNG
4.1 : 1
RMSE
0.0081
0.0016
0
0
CR
JPEG
15.3 : 1
JPEG 2000 2.5 : 1
GIF
1.3 : 1
PNG
2.0 : 1
RMSE
0.012
0.002
0
0
Fireworks
PSNR
62.51
78.05
inf
inf
Food
PSNR
65.93
79.82
inf
inf
CR
JPEG
38.9 : 1
JPEG 2000 6.4 : 1
GIF
1.8 : 1
PNG
3.1 : 1
RMSE
0.0056
0.0022
0
0
CR
JPEG
31.7 : 1
JPEG 2000 5.6 : 1
GIF
1.7 : 1
PNG
2.9 : 1
RMSE
0.0066
0.0022
0
0
PSNR
67.71
77.33
inf
inf
Cameraman
PSNR
69.09
77.34
inf
inf
JPEG
JPEG 2000
GIF
PNG
CR
73.1 : 1
14.6 : 1
9.3 : 1
13.5 : 1
RMSE
0.0259
0.0019
0
0
PSNR
55.81
78.62
inf
inf
Results
Compression Ratio for Different Pictures
0.9
0.8
Compression Ratio
0.7
0.6
0.5
JPEG
JPEG‐2000
0.4
GIF
0.3
PNG
0.2
0.1
0
0
1
2
3
4
Test
5
6
7
Results
RMSE for Different Pictures
0.03
0.025
RMSE
0.02
0.015
JPEG
JPEG‐2000
0.01
0.005
0
0
1
2
3
4
Test
5
6
7
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?
Download