Image Processing Architecture, © 2001-2004 Oleh TretiakPage 1Lecture 4 ECE-C490 Winter 2004 Image Processing Architecture Lecture 4, 1/20/2004 Principles.

Slides:



Advertisements
Similar presentations
Image Compression. Data and information Data is not the same thing as information. Data is the means with which information is expressed. The amount of.
Advertisements

CSE 589 Applied Algorithms Spring 1999 Image Compression Vector Quantization Nearest Neighbor Search.
Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao.
1 Preprocessing for JPEG Compression Elad Davidson & Lilach Schwartz Project Supervisor: Ari Shenhar SPRING 2000 TECHNION - ISRAEL INSTITUTE of TECHNOLOGY.
2015/6/15VLC 2006 PART 1 Introduction on Video Coding StandardsVLC 2006 PART 1 Variable Length Coding  Information entropy  Huffman code vs. arithmetic.
SWE 423: Multimedia Systems Chapter 7: Data Compression (2)
Losslessy Compression of Multimedia Data Hao Jiang Computer Science Department Sept. 25, 2007.
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
2015/7/12VLC 2008 PART 1 Introduction on Video Coding StandardsVLC 2008 PART 1 Variable Length Coding  Information entropy  Huffman code vs. arithmetic.
SWE 423: Multimedia Systems Chapter 7: Data Compression (4)
Noise, Information Theory, and Entropy
Roger Cheng (JPEG slides courtesy of Brian Bailey) Spring 2007
Still Image Conpression JPEG & JPEG2000 Yu-Wei Chang /18.
Software Research Image Compression Mohamed N. Ahmed, Ph.D.
Lossy Compression Based on spatial redundancy Measure of spatial redundancy: 2D covariance Cov X (i,j)=  2 e -  (i*i+j*j) Vertical correlation   
Speech coding. What’s the need for speech coding ? Necessary in order to represent human speech in a digital form Applications: mobile/telephone communication,
©2003/04 Alessandro Bogliolo Background Information theory Probability theory Algorithms.
Computer Vision – Compression(2) Hanyang University Jong-Il Park.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
1 Section 3. Image Compression Xudong Ni Group Member: Wei Yan,Li Yang,Xudong Ni Computer Science Florida International University.
Klara Nahrstedt Spring 2011
CMPT 365 Multimedia Systems
Image Compression Supervised By: Mr.Nael Alian Student: Anwaar Ahmed Abu-AlQomboz ID: IT College “Multimedia”
8. 1 MPEG MPEG is Moving Picture Experts Group On 1992 MPEG-1 was the standard, but was replaced only a year after by MPEG-2. Nowadays, MPEG-2 is gradually.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 2 ECE-C490 Winter 2004 Image Processing Architecture Lecture 2, 1/8/2004 Lossless.
Digital Image Processing Image Compression
Image Compression – Fundamentals and Lossless Compression Techniques
Image Compression Fasih ur Rehman. Goal of Compression Reduce the amount of data required to represent a given quantity of information Reduce relative.
Compression video overview 演講者:林崇元. Outline Introduction Fundamentals of video compression Picture type Signal quality measure Video encoder and decoder.
Computer Vision – Compression(1) Hanyang University Jong-Il Park.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 3 ECE-C490 Winter 2004 Image Processing Architecture Lecture 3, 1/13/2004 Lossless.
Chapter 17 Image Compression 17.1 Introduction Redundant and irrelevant information  “Your wife, Helen, will meet you at Logan Airport in Boston.
Advances in digital image compression techniques Guojun Lu, Computer Communications, Vol. 16, No. 4, Apr, 1993, pp
Introduction to Digital Signals
Entropy Coding of Video Encoded by Compressive Sensing Yen-Ming Mark Lai, University of Maryland, College Park, MD
Lecture 4: Lossless Compression(1) Hongli Luo Fall 2011.
CS654: Digital Image Analysis
Image Processing Architecture, © Oleh TretiakPage 1Lecture 6 ECE-C453 Image Processing Architecture Lecture 6, 2/3/04 Lossy Video Coding Ideas.
JPEG - JPEG2000 Isabelle Marque JPEGJPEG2000. JPEG Joint Photographic Experts Group Committe created in 1986 by: International Organization for Standardization.
1 Source Coding and Compression Dr.-Ing. Khaled Shawky Hassan Room: C3-222, ext: 1204, Lecture 10 Rate-Distortion.
Digital Image Processing Lecture 22: Image Compression
ELE 488 F06 ELE 488 Fall 2006 Image Processing and Transmission ( ) Image Compression Quantization independent samples uniform and optimum correlated.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Image Processing Architecture, © Oleh TretiakPage 1Midterm 2 review ECEC 453 Image Processing Architecture Midterm Review February 24, 2003.
Chapter 8 Lossy Compression Algorithms. Fundamentals of Multimedia, Chapter Introduction Lossless compression algorithms do not deliver compression.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 7 ECEC 453 Image Processing Architecture Lecture 8, February 5, 2004 JPEG: A Standard.
By Dr. Hadi AL Saadi Lossy Compression. Source coding is based on changing of the original image content. Also called semantic-based coding High compression.
Entropy vs. Average Code-length Important application of Shannon’s entropy measure is in finding efficient (~ short average length) code words The measure.
Image Processing Architecture, © Oleh TretiakPage 1Lecture 5 ECEC 453 Image Processing Architecture Lecture 5, 1/22/2004 Rate-Distortion Theory,
Chapter 8 Lossy Compression Algorithms
JPEG Compression What is JPEG? Motivation
Digital Image Processing Lecture 20: Image Compression May 16, 2005
Distributed Compression For Still Images
IMAGE COMPRESSION.
CSI-447: Multimedia Systems
The Johns Hopkins University
Algorithms in the Real World
Analog to digital conversion
Image Compression The still image and motion images can be compressed by lossless coding or lossy coding. Principle of compression: - reduce the redundant.
Discrete Cosine Transform
Chapter 3 Sampling.
JPEG.
CH 8. Image Compression 8.1 Fundamental 8.2 Image compression models
Context-based Data Compression
Scalar Quantization – Mathematical Model
Objectives of Image Coding
CSE 589 Applied Algorithms Spring 1999
Image Transforms for Robust Coding
JPEG Still Image Data Compression Standard
Conceptual Representation of A/D Conversion
Presentation transcript:

Image Processing Architecture, © Oleh TretiakPage 1Lecture 4 ECE-C490 Winter 2004 Image Processing Architecture Lecture 4, 1/20/2004 Principles of Lossy Compression Oleh Tretiak Drexel University

Image Processing Architecture, © Oleh TretiakPage 2Lecture 4 Compression:  Input is a sequence of discrete symbols  Main theoretical tool: Entropy Technology: Coding Methods  Huffman codes  Variable length code words, high probability symbols get short code words  Ideally, length of code word should be -log 2 p i  Arithmetic codes  Many symbols translate to many code bits  Each input symbol produces -log 2 p i  Other codes: Golomb-Rice Review: Lossless Compression

Image Processing Architecture, © Oleh TretiakPage 3Lecture 4 Successful preprocessing can reduce per/symbol entropy  Example: Run-length encoding  Example: Prediction on the basis of past values Review: Coder Structures High entropy Low entropy

Image Processing Architecture, © Oleh TretiakPage 4Lecture 4 Review: Coder Design Strategies Fixed encoder  Example: ITU-T, Rec. T.4 (Group 3), Rec. T.6 (Group 4)  Excellent compression on text documents of fixed resolution  Simple system Adaptive encoder  Example: JBIG  Adaptive predictor on basis of context  Arithmetic coding with p estimated from documents  Superior performance over a large range of documents

Image Processing Architecture, © Oleh TretiakPage 5Lecture 4 Review: Coder Designs  Example: Lossless JPEG  Prediction on basis of context  8 prediction rules, choose the best one Prediction context Available Prediction Rules

Image Processing Architecture, © Oleh TretiakPage 6Lecture 4 This Lecture Lossy Compression  Tradeoff between quality and number of bits  Bit reduction  Resolution reduction  Quantizers Rate distortion theory

Image Processing Architecture, © Oleh TretiakPage 7Lecture 4 Review: Lossless Compression of Images Can get quite good compression of graphics images Lossless compression of gray-scale images (JPEG) is ~ 2 What to do?  Keep trying  Give up  Take another approach Lossy Compression

Image Processing Architecture, © Oleh TretiakPage 8Lecture 4 Lossy Compression Ideas Tradeoff between bits and quality  Name of the game: Large reduction in bits at virtually no loss in quality Theoretical tool  Shannon Rate-Distortion Theory

Image Processing Architecture, © Oleh TretiakPage 9Lecture 4 Quality - Rate Tradeoff Given: 512x512 picture, 8 bits per pixel  Bit reduction  Fewer bits per pixel  Fewer pixels  Both Issues:  How do we measure compression?  Bits/pixel — does not work when we change number of pixel  Total bits — valid, but hard to interpret  How do we measure quality?  RMS noise  Peak signal to noise ratio (PSR) in dB  Subjective quality

Image Processing Architecture, © Oleh TretiakPage 10Lecture 4 Reduced bits/pixel Keep b most significant bits Compression = 8/b Distortion: o(i, j) original picture, r(i, j) reduced picture, we define the noise as RMS error: Peak Signal to Noise Ratio (PSNR) = 20log 10 (255/  )

Image Processing Architecture, © Oleh TretiakPage 11Lecture 4 Reducing bits per pixel. Upper row, left to right: 8, 4, 3 bits per pixel. Lower row, left to right: 2, 1 bits per pixel. With 5, 6, and 7 bits per pixel the image is almost the same as 8 bits.

Image Processing Architecture, © Oleh TretiakPage 12Lecture 4 Loss vs. Bit Rate

Image Processing Architecture, © Oleh TretiakPage 13Lecture 4 Resolution Reduction Start with 512x512 8 bit image Sample over a WxW point grid, keep 8 bits per pixel r(i, j) is interpolated to a 512 x512 grid Compression = (512/W) 2 n(i, j) = r(i, j) - o(i, j) Compute RMS Noise and PSNR

Image Processing Architecture, © Oleh TretiakPage 14Lecture Resolution reduction. Upper left is full resolution (512x512 pixels). Lower right image has 1/8 of the pixels, Compression = 8.

Image Processing Architecture, © Oleh TretiakPage 15Lecture 4 Difference Between Compressed and Original Difference between 128x128 (16 fold compression) and original image

Image Processing Architecture, © Oleh TretiakPage 16Lecture 4 Quantitative Performance

Image Processing Architecture, © Oleh TretiakPage 17Lecture 4 Comparison, Bit and Pixel Reduction

Image Processing Architecture, © Oleh TretiakPage 18Lecture 4 Conclusion and Questions For this image, resolution reduction is a much more effective compression method than bit reduction  8-fold reduction in bits at 30 dB PSNR with subsamplng  2.67-fold reduction bits at 29 dB PSNR with bit reduction What is the best combination of sampling and bits? Can entropy coding help? Is there a theory that can guide us?

Image Processing Architecture, © Oleh TretiakPage 19Lecture 4 Theory Theory tells us that the data we encode should be statistically independent  In a picture, adjacent pixels are correlated. Shannon’s rate-distortion theory provides a way of finding the tradeoff between rate (total bits per image) and distortion (rms. error)  Image should be transformed (preprocessed) so that statistically independent samples are encoded  Correlated images (with low detail) can be compressed more than uncorrelated images.

Image Processing Architecture, © Oleh TretiakPage 20Lecture 4 Typical Rate-Distortion Functions Rate is in bits per image, or bits per time Distortion is 1/(rms. error)

Image Processing Architecture, © Oleh TretiakPage 21Lecture 4 Information Theory of Continuous Sources Quantizers Decorrelation and Bit Allocation Rate-Distortion Theory DCT (Discrete Cosine Transform)

Image Processing Architecture, © Oleh TretiakPage 22Lecture 4 Quantizer: The Basics Given: 8 bit gray value samples, 0 ≤ data ≤ 255 Task: Keep 4 bits per sample Method: Shift 4 bits to right (divide by 2 4 = 64)  This is called quantization  Quantization step S = 64  All values betwee 0 and 63 are mapped to 0, values from 64 to 127 are mapped to 1, etc Restoring data: Multiply by 2 4 = 64 and add 32  This is called dequantization  What used to be between 0 and 63 is now at 32, data values between 64 and 1

Image Processing Architecture, © Oleh TretiakPage 23Lecture 4 Example of quantization Quantization with S = 20. Note that the dequantizer output is typically not equal to the input!

Image Processing Architecture, © Oleh TretiakPage 24Lecture 4 Quantizer Performance Questions:  How much error does the quantizer introduce (Distortion)?  How many bits are required for the quantized values (Rate)? Rate:  1. No compression. If there are N possible quantizer output values, then it takes ceiling(log 2 N) bits per sample.  2(a). Compression. Compute the histogram of the quantizer output. Design Huffman code for the histogram. Find the average lentgth.  2(b). Find the entropy of the quantizer distribution  2(c). Preprocess quantizer output,.... Distortion: Let x be the input to the quantizer, x* the de-quantized value. Quantization noise n = x* - x. Quantization noise power is equal to D = Average(n 2 ).

Image Processing Architecture, © Oleh TretiakPage 25Lecture 4 Quantizer: practical lossy encoding Quantizer  Symbols x — input to quantizer, q — output of quantizer, S — quantizer step  Quantizer: q = round(x/S)  Dequantizer characteristic x* = Sq  Typical noise power added by quantizer- dequantizer combination: D = S 2 /12 noise standard deviation  = sqrt(D) = 0.287S Example: S = 8, D = 8 2 /12 = 5.3, rms. quatization noise = sqrt(D) = 2.3 If input is 8 bits, max input is 255. There are 255/8 ~ 32 quantizer output values PSNR = 20 log10(255/2.3) = 40.8 dB Quantizer characteristic Dequantizer characteristic

Image Processing Architecture, © Oleh TretiakPage 26Lecture 4 Rate-Distortion Theory Probabilistic theory, developed by Claude Shannon in 1949 Input is a sequence of independent random variables, output are lossy (distorted) reproduction Joint probability density function p(x, y) Distortion: D =E[(X–Y) 2 ] (mean squared error, noise power), Rate-distortion function

Image Processing Architecture, © Oleh TretiakPage 27Lecture 4 Rate-Distortion Theorem When long sequences (blocks) are encoded, it is possible to construct a coder-decoder pair that achieves the specified distortion whenever bits per sample are R(D) +  Formula: X ~ Gaussian random variable, Q = E[X 2 ] ~ signal power D = E[(X–Y) 2 ] ~ noise power

Image Processing Architecture, © Oleh TretiakPage 28Lecture 4 Rate-Distortion Function for Gaussian Distribution ‘Theoretical’ plot ‘Practical’ plot

Image Processing Architecture, © Oleh TretiakPage 29Lecture 4 Rate - Distortion, in words Q - actual signal power (size) D - specified distortion power D > Q (specified distortion bigger than signal)  R = 0, send nothing, actual distortion = received - sent  distortion power = Q D < Q (specified distortion less than signal  Coded bits per sample = 0.5 log 2 (Q/D) This formula applies for coding statistically independent symbols!

Image Processing Architecture, © Oleh TretiakPage 30Lecture 4 Rate-Distortion Theory: Correlated Data Pixel values are correlated Above formula does not apply to correlated values Solution: pre-process data so that new values are de-correlated! On the left we show the contour plot of the pdf of two correlated random variables X 1 and X 2. By taking linear combinations (preprocessing) we get two new random variables Y 1 and Y 2. Feature: X 1 and X 2 have the same power (standard deviation). Y 1 and Y 2 have different standard deviation.

Image Processing Architecture, © Oleh TretiakPage 31Lecture 4 Rate-distortion theory — correlated samples Given: x = (x 1, x 2,... x n ), a sequence of Gaussian correlated samples Preprocess: convert to y = (y 1, y 2,... y n ), y = Ax, A ~ an orthogonal matrix (A -1 = A T ) that de-correlates the samples. This is called a Karhunen-Loeve transformation Perform lossy encoding of (y 1, y 2,... y n ) - get y* = (y 1 *, y 2 *,... y n *) after decoding Reconstruct: x* = A -1 y*

Image Processing Architecture, © Oleh TretiakPage 32Lecture 4 Bit allocation Before pre-processing, all samples x i have the same variance (size) After pre-processing, de-correlated samples y i have different variances, and are encoded differently. What is the best coding of non-uniform samples? Typical de-correlated sequence powers. Q(i) is the variance of y i

Image Processing Architecture, © Oleh TretiakPage 33Lecture 4 Rate-distortion theory: non- uniform random variables Sequence of independent Gaussian variables (y 1, y 2,... y n ), Var[y i ] = Q i. Distortion allocation: allocate D i distortion to Q i Rate (bits) for i-th variable is R i = max[0.5 log 2 (Q i /D i ), 0] Total distortion Total rate (bits) We specify R. What are the values of D i to get minimum total distortion D?

Image Processing Architecture, © Oleh TretiakPage 34Lecture 4 Basic Solution If the total distortion is small,  Make D i = D/n  R i = 0.5 log 2 (Q i /D i ) = 0.5 log 2 (nQ i /D) This holds as long as Q i ≥ D/n for all i

Image Processing Architecture, © Oleh TretiakPage 35Lecture 4 General solution Implicit solution (water-filling construction) Choose  (parameter) D i = min(Q i,  )  If (Qi >  ) then D i = , else D i = Q i R i = max[0.5 log 2 (Q i /D i ), 0]  If (Qi >  ) then R i = 0.5 log 2 (Q i /  ), else R i = 0. Find value of  to get specified R

Image Processing Architecture, © Oleh TretiakPage 36Lecture 4 Sample Calculation Table on left shows rate and distortion calculation for  = 0.1. The plot was produced by varying  SNR = 10 log 10 (Q tot /D), where Q tot = sum(Q i )=4.831.

Image Processing Architecture, © Oleh TretiakPage 37Lecture 4 Rate Distortion: Summary Rate distortion theory gives a theoretical value of best bit-rate vs distortion tradeoff When source produces correlated data, it must be pre- processed to remove correlation Formula for independent source symbols: When symbols are correlated, the rate-distortion function can be computed by ‘water filling’ construction.