Outline of Vector Quantization of Images

Post on 20-Feb-2016

64 views 0 download

Tags:

description

Outline of Vector Quantization of Images. VQ Coding Outline. Divide data (signal) into non-overlapping vectors (Each vector contains ‘n’ elements (pixels/samples)) For each image vector : Find closest vector in codebook Get its index in codebook Encode indices. VQ Decoding Outline. - PowerPoint PPT Presentation

Transcript of Outline of Vector Quantization of Images

S.R.Subramanya 1

Outline of Vector Quantization of Images

S.R.Subramanya 2

VQ Coding Outline

• Divide data (signal) into non-overlapping vectors

• (Each vector contains ‘n’ elements (pixels/samples))

• For each image vector :

• Find closest vector in codebook

• Get its index in codebook

• Encode indices

S.R.Subramanya 3

VQ Decoding Outline

• Entropy decode the indices

• Lookup codebook for each index and retrieve vector

• Combine vectors to reconstruct image (data)

S.R.Subramanya 4

VQ Terminology

• Vector : Group of ‘n’ elements (pixels/samples)

• Codebook : (Final) set of codevectors

• Training set : (Initial) set of codevectors

• Codevector : Vector derived from image/group of images

S.R.Subramanya 5

Why VQ is better than scalar Quantization

• Scalar Quantizer : Treats each pixel independently Does not use correlation between neighboring pixels

• Vector Quantizer:

• Image (data) divided into vectors (blocks)• Correlation among pixels in vectors is exploited• Block size should be appropriate:

• Too large block : correlation is lost• Too small block : More code vectors

• If no interpixel correlation, then no gain

S.R.Subramanya 6

VQ Bitrate

• Vector size : n (say, n = p x p) pixels

• Codebook size : L vectors

• Codebook index size : bits

• Bit Rate of VQ : bits/pixel

L2log

nL2log

S.R.Subramanya 7

Distortion Measures

xk

Image

closest matching code vector

Image vectors : Xj

Codebook

codevectors : Vi , V1

V2

Vk

VL

2

1

))()((1),( iViXn

VXdn

ikjKj

2

1

))()(((1),( iViXWn

VXdn

ikjiKj

Mean Square Error (MSE) (Euclidean Distance)

Weighted MSE

Li1

S.R.Subramanya 8

Two Basic Kinds of Codebook

• Local Codebook

One codebook for each image

Codebook derived from vectors of one image

Good performance (Quality of reconstruction)

More overhead :

(1) computation

(2) Transmission of CB to decoder

S.R.Subramanya 9

Two Basic Kinds of Codebook

• Global Codebook

One codebook for a class of images

Codebook derived from vectors of all images in the class

Less overhead (compared to local codebook)

Lower performance

S.R.Subramanya 10

Major Issues in VQ

• Generation (construction) of codebook

concerns what needs to be included in the codebook

• Design of codebook

concerns structuring codebook entries to minimize search time

S.R.Subramanya 11

Codebook Generation

• Generate codebook from a Training set

• Training Set: Set of vectors derived from image vectors

• Codevectors should minimize distortion

• Most commonly used algorithm : LBG algorithm

• LBG : Linde–Buzo–Gray algorithm

S.R.Subramanya 12

LBG Algorithm Outline

S.R.Subramanya 13

Codebook Initialization

Three basic schemes:

• Random

• Perturb and Split (Bottoming)

• Pairwise Nearest Neighbor (PNN) clustering (PNN)

S.R.Subramanya 14

Codebook Design

• Basic objective : Minimize search time for codevector

• Full (Exhaustive) Search : very expensive

• Design emphasis : Organization of codebook

S.R.Subramanya 15

•Tree-structured codebook

• Product codebook

• Mean/Residual VQ

• Interpolative/Residual VQ

• Gain/Shape VQ

• Classified VQ

• Finite State VQ

Codebook Organizations

S.R.Subramanya 16

Tree – Structured Codebook

• Codebook organized as M–ary tree• Number of Levels :• Code vectors stored at the leaves• Intermediate node : ‘average’ of ‘codevectors’ of children• Improved search time• Increased Storage cost• Performance inferior to full search

Llogm

S.R.Subramanya 17

Variations of Tree – Structured VQ

• Tapered trees: Non – Uniform number of branches at nodes Branches per node increases going down the tree ( Ex: 2 branches at level 1, 3 at level 2 etc.)

• Pruned Trees Start with (full) large initial tree Remove code vectors that do not reduce distortion

S.R.Subramanya 18

Product Codebook

• Codebook : Cartesian product of many smaller codebooks

• Vector characterized by many independent features:f1,f2...,fN

• Separate codebook for each feature

• Smaller codebook sizes : L1,L2...,LN

• Effective codebook size : L1,L2...,LN

• Actual storage + search complexity O(L1+L2+...+LN)

S.R.Subramanya 19

Prediction/Residual Class VQ

• Predict Original Image

• Derive Residual Image

• Data used in prediction: Scalar Quantization + Encoding

• Residual Image : Vector Quantization

• Major Types:

Mean/Residual VQ

Interpolative/Residual VQ

S.R.Subramanya 20

Mean/Residual VQ

• Image Vectors have similar variations about different mean/ends

• Remove mean from vectors fewer code vectors

S.R.Subramanya 21

Mean/Residual VQ

• Scheme :

• Compute ‘mean’ of image vectors : M={m1,m2...,mN}

• Quantize M using scalar quantization :

• (Apply DPCM before Quantization further bitrate reduction)

• Subtract Quantized means from vector elements

Residual vectors

• Quantize Residual vectors using VQ

M~

S.R.Subramanya 22

Interpolative/Residual VQ

• Subsample original image by l in each dimension (typically, l=8)

• Quantize subsampled value

• Upsample using Quantized subsampled values (typically, bilinear interpolation is used)

• Form Residual : (Original – Upsampled)

• Segment Residual to form 4 x 4 vectors

• Quantize Residual vectors using VQ

S.R.Subramanya 23

Classified VQ

• Several codebooks

• Each codebook for a specific feature

ex. edges, smooth areas, etc.

• Codebooks could be of different sizes

What is the measure of performance VQ?

How does one rate the performance of a compressed image or sound using VQ? 

There is no good way to measure the performance of VQ. 

This is because the distortion that VQ incurs will be evaluated by us humans and that is a subjective measure. 

What is the measure of performance VQ? We can always resort to good old Mean

Squared Error (MSE) and Peak Signal to Noise Ratio (PSNR). 

MSE is defined as follows:

where M is the number of elements in the signal, or image.

What is the measure of performance VQ? For example, if we wanted to find

the MSE between the reconstructed and the original image, then we would take the difference between the two images pixel by pixel, square the results, and average the results.

What is the measure of performance VQ? The PSNR is defined as follows:

where n is the number of bits per symbol.  As an example, if we want to find the

PSNR between two 256 gray level images, then we set n to 8 bits.