beauty and the beast - university of manitobaece.eng.umanitoba.ca/undergraduate/ece3740/lecture...
TRANSCRIPT
1 of ?
Image CompressionUsing Learned Vector Quantization
Prof. K. Ferens, Ph.D., P.Eng.29 November 2013
ECE 3740 SeminarFaculty of Engineering, University of Manitoba
Beauty and the Beast
2 of ?
BEAUTY AND THE BEAST
3 of ?
The Beast
4 of ?
What do you get when you Squeeze An Android?
Data Compression
5 of ?
Image (Gray Scale)
• Color: RGB, CYMK, and probably others• Grayscale: A grayscale image is one in which the only
colors are shades of gray• Example: 512 pixels x 512 pixels, each pixel is 8-bit
6 of ?
LVQ Image Compression Main Idea
+ Many others (100s)
Feature Extraction: Example: find 256 common features
Create a codebook (palette) using these features from which face images can be constructed
CommunicationsChannel
1
256
4, 200, 5, 1, ……
Encoder (Transmitter)1
256
4, 200, 5, 1, … …
Decoder (Receiver)
7 of ?
IMAGE COMPRESSION?
• The original image is represented by a sequence of indices of codewords from a codebook.
• Both transmitter and receiver have copies of same codebook.• Receiver decodes the sequence of indices by replacing each
index by a codeword from the codebook • Data compression is achieved: 512x512x8bit : 256x8bit = 1024:1• How do we measure the quality of the reconstructed image?
CommunicationsChannel
1
256
4, 200, 5, 1, ……
Original Image1
256
4, 200, 5, 1, … …
Decoded ImageSequence of Indices
Codebook Codebook
Find BestMatchingCodeword
Lookup theCodeword
512x512x8 bits
8 of ?
How can we Measure the Error?
Lena reconstructed using Baboon’s prototypes Baboon reconstructed using Lena’s prototypes
OriginalImages
CompressedImages
9 of ?
Metric Determination
• What is the best measure of similarity and difference to use in this application? (comparing the original image with the reconstructed image)
• Using a measure, such as the Euclidean distance is misleading sometimes• Humans do not use Euclidean distance when comparing images.
= 123 ED Units
= 123 ED Units
10 of ?
Image Vector Space LVQ MappingImage Vector Space
Vector i: 16x4, 8-bit Pixels128-bit Vectors
2128 Total Vectors in Space
PV1
PVi
PV256
Map
Partition of Vector Space256 Regions
Equivalence Subsets
11 of ?
How Big is 2128 ?
• Consider the number of possible keys you would have to test one at a time to find the correct key to break an encrypted message which used a 128-bit key.• 2128 possible keys
• Imagine a computer that is the size of a grain of sand that can test 128-bit encryption keys.
• Assume that this computer can test a key in the amount of time it takes light to cross it.
• Then consider a cluster of these computers, so many that if you covered the earth with them, they would cover the whole planet to the height of 1 meter.
• Using this cluster of computers, it would take an average of 1,000 years to find the correct 128-bit key.
12 of ?
Learning PrototypesInput sub-image
IV, 16x8-bit Pixels
PV1
PV256
PrototypeSub-image
1
2
256
255Winner PVj = min(j)Distance(IVi – PVj)
ColumnFormat
IVi
-Training Set…
Update PVj = PVj + LRate*(IVi – PVj)
13 of ?
Learning Vector Quantization for Image Compression
14 of ?
LVQ Encoder
…
…
Search forBest Matching
Prototype
12
255256
IndexCodewords
Codebook
239
• Encoder• Sequence of codeword indices: 239, 4, 6, 34, …• Each index refers to a codeword (prototype)
• Decoder• For each index lookup codeword and use that codeword (prototype to
15 of ?
Results(2 Different Codebooks are learned)
• Prototypes are being learned from the Lena image only• Similarly, a codebook is learned using only the Baboon image
Column representation of the prototypes
Input Vector
Best matchingPrototype
16 of ?
Results
• The Baboon image being represented by a codebook learned from just the Lena image.
Codebook of 256 Prototypes learned from
the Lena Image
17 of ?
Beauty or Beast?
Lena reconstructed using Baboon’s prototypes Baboon reconstructed using Lena’s prototypes
18 of ?
Beauty or Beast?
Lena reconstructed using Baboon’s prototypes Baboon reconstructed using Lena’s prototypes
OriginalImages
CompressedImages