IMAGE CODING Motivation
• Large amount of data in images
Color video: 200Mb/sec
Landsat TM multispectral satellite image: 200MB
• High potential for compression
Redundancy (aka correlation) in images – spatial, temporal, spectral storage versus transmission applications
source source source coder source coder channel coder image image
storage channel
retrieved retrieved image source decoder image source decoder channel decoder
ECE/OPTI533 Digital Image Processing class notes 288 Dr. Robert A. Schowengerdt 2003
IMAGE CODING • High correlation for close neighbors Joint probability plots (scattergrams) between pixels with given horizontal spacing • As pixel separation increases, correlation decreases
∆ = 1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
ECE/OPTI533 Digital Image Processing class notes 289 Dr. Robert A. Schowengerdt 2003
IMAGE CODING Lossy coding
• Some acceptable loss of data, without loss of “information”
• Error measures ˆ Mean Square Error MSE() DN = Variance() f – f
Root Mean Square Error RMSE() DN = MSE
Normalized Mean Square Error NMSE()% = 100()MSE ⁄ Variance()f
Signal-to-Noise Ratio SNR() dB = 10log() 100 ⁄ NMSE () []()2 ⁄ Peak-to-peak SNR PSNR dB = 10log fmax – fmin MSE
• Problems
Error measures don’t emphasize visually important features such as contrast edges
• Can improve correlation of any of these error measures with visual quality by restricting to “edge pixels” only
How to define and quantify “image quality?”
ECE/OPTI533 Digital Image Processing class notes 290 Dr. Robert A. Schowengerdt 2003
IMAGE CODING example with JPEG coding 1/8 RMSE = 2.91 DN NMSE = 0.16% SNR = 27.9dB
1/16 RMSE = 4.63 DN NMSE = 0.42% SNR = 23.8dB
1/32 RMSE = 7.37 DN NMSE = 1.05% SNR = 19.8ddB
ECE/OPTI533 Digital Image Processing class notes 291 Dr. Robert A. Schowengerdt 2003
IMAGE CODING Run-Length Coding typical behavior (image dependent)
• Simple, image domain, lossy compression ratio compression algorithm
• Exploits neighboring pixel
correlation, line-by-line 0 T
Works best for simple, low-frequency content, near-binary images, e.g. faxes number of runs • DN threshold controls quality loss and compression rate
T • Look for “runs” 0
contiguous pixels with similar values (within threshold of starting pixel value) average runlength
• Code starting pixel value (Q bits) and length of line (≤ logN/log2 “intrinsic” runlength T bits) 0
ECE/OPTI533 Digital Image Processing class notes 292 Dr. Robert A. Schowengerdt 2003
IMAGE CODING Lossless Coding
• No data loss
• Minimal compression (typically 2:1)
• Example algorithms
Run-Length (with zero threshold)
Lempel-Ziv-Welsh (LZW)
Huffman Coding
ECE/OPTI533 Digital Image Processing class notes 293 Dr. Robert A. Schowengerdt 2003
IMAGE CODING Components of source coder
• Data transformation
waveform coder
transform coder
image model coder
• Quantization
bits, transform coefficients, or model parameters
• Codeword Assignment
unique bit string for each quantized parameter
ECE/OPTI533 Digital Image Processing class notes 294 Dr. Robert A. Schowengerdt 2003
IMAGE CODING Waveform Coding
• Pulse Code Modulation (PCM)
Image intensity quantized by uniform quantizer
At low bit rates (typically less than 4 bits/ pixel), quantization noise appears as false contours in areas of low intensity 16 levels slope
8 levels
4 levels
ECE/OPTI533 Digital Image Processing class notes 295 Dr. Robert A. Schowengerdt 2003
IMAGE CODING
Example 2-bit uniform quantizer ∆ =1
out in codeword out error 11 3∆/2 1.2 11 1.5 -0.3
10 1.5 11 1.5 0 ∆/2 in -2 00 -1.5 -0.5 −∆ 01 +∆ -0.5 01 -0.5 0 −∆/2 0.5 10 0.5 0 bits 00 −3∆/2 0.6 10 0.5 0.1 -0.75 01 -0.5 -0.25 1.2 11 1.5 -0.3
MSE = 0.0628 Alternate representation:
bits 00 01 10 11 mid-rise uniform quantizer −3∆/2 −∆ −∆/2 ∆/2+∆ 3∆/2
bits 000 001 010 100 101 mid-tread uniform quantizer −3∆/2−∆ −∆/2 0 ∆/2+∆ 3∆/2
ECE/OPTI533 Digital Image Processing class notes 296 Dr. Robert A. Schowengerdt 2003
IMAGE CODING
• PCM with Nonuniform Quantization
Assign quantization levels according to image intensity distribution
Small improvement for typical images
• Depends on nonuniformity of image histogram
For example, use CDF as nonlinear transform, i.e. histogram equalization
• Assigns more levels where there are more pixels
source nonlinear nonlinear coded uniform PCM image transform transform-1 image
ECE/OPTI533 Digital Image Processing class notes 297 Dr. Robert A. Schowengerdt 2003
IMAGE CODING PCM with Pseudo-noise
• Add random noise to image before PCM
• Subtract same random noise after PCM
source decoded uniform PCM image image
η(m,n)
• Removes spatial correlation of quantization noise
ECE/OPTI533 Digital Image Processing class notes 298 Dr. Robert A. Schowengerdt 2003 IMAGE CODING example with 3 bits/pixel and uniform random noise add noise PCM (3bits/pixel)
uniform PCM (3bits/pixel)
minus noise
ECE/OPTI533 Digital Image Processing class notes 299 Dr. Robert A. Schowengerdt 2003 IMAGE CODING Delta Modulation example row-by-row image scan pattern
• Code difference of neighboring pixels with 1 bit
Assume some “scan” pattern in image
• Reduces spatial correlation before coding
ECE/OPTI533 Digital Image Processing class notes 300 Dr. Robert A. Schowengerdt 2003 IMAGE CODING
Example
image: in difference codeword out error 6 788 66 11-0.3 5910 8 71 170 81 18-0.5 6 897 80 190 7911 9 10 2 1 0 9-10 0.1 differences: 5-40 -0.25 6 110 61 1 -0.3 82 1 -4 -1 2 0 91 1
12 1 -2 7-20 92 1 -2 -2 2 2 11 2 1 9-20 difference ≥ 0: codeword = 1 7-20 difference < 0: codeword = 0
ECE/OPTI533 Digital Image Processing class notes 301 Dr. Robert A. Schowengerdt 2003