Post on 06-Apr-2018
8/3/2019 FIT 2011 Gradient
1/20
Gradient Adjusted Predictor with
Pseudo-distance Technique forLossless Compression
of Color-mapped Imagesby Basar KOC & Ziya ARNAVUT
SUNY Fredonia
8/3/2019 FIT 2011 Gradient
2/20
What are digital colors?
Human beings perceive colors by the nature of the lightreflected from an object!
Achromatic Color: means literally without color
Only intensities (amount of light)
Gray levels as seen on black/white TV-monitor Ranges from black to white
Chromatic Color: All colors other than neutral colors(white, black, and the pure grays), are chromatic.
The word color in ordinary language is often used torefer exclusively to chromatic colors, e.g., color vs.black-and-white television.
2
8/3/2019 FIT 2011 Gradient
3/20
RGB Color Theory
RGB stands for Red, Green, BlueRGB color is in use in many devices,
Televisions, computer screens, digital cameras.
When the visible color spectrum wavelength (400-700nm) is broken into thirds,
RGB colors are the predominant colors.
Three types of cone cells exist in human eye.
Each cell is more sensitive to either short ( S ), medium( M ), or long( L ) wavelength light.
These curves are often also referred as the tri-stimulus
functions.
3
8/3/2019 FIT 2011 Gradient
4/20
RGB Color Space
A single pixel consists of three components each inrange of [0,255].
Each pixel is a triplet
128 251 60 =
Pixel vector
in memory
Final pixel in
the image
Caution! Sometimes pixelsare not stored as vectors.Instead, first is stored thecomplete red component,then the complete green,then blue.
4
8/3/2019 FIT 2011 Gradient
5/20
Example RGB
5
8/3/2019 FIT 2011 Gradient
6/20
Size consideration in an RGB image
The lowest resolution for a monitor
Displaying a Windows desktop is 640 x 480 pixels.
In a bitmap of this resolution, then, there would be 3
bytes per pixel, For a total of 640 x 480 x 3, or about 900 kilobytes.
6
8/3/2019 FIT 2011 Gradient
7/20
Bit-Depth = Color-Depth
Number of Colors = 2^(Bit-depth)Bit-depth is the number of bits.
It is also called Color resolution.
Bit depthBit depth Color resolutionColor resolution CalculationCalculation1-bit 2 colors 2^1 = 2
2-bits 4 colors 2^2 = 4
3-bits 8 colors 2^3 = 8
4-bits 16 colors 2^4 = 16
8-bits 256 colors 2^8 = 256
16-bits 65,536 colors 2^16 = 65536
24-bits 16,777,215 colors 2^24 = 16.7 million
7
8/3/2019 FIT 2011 Gradient
8/20
Color Palettes
Images look best If theyre stored with as RGB images with 16,777,216
colors.
However, file seizes may be very large.
For practical purposes,
we would like to reduce the number of colors from16,777,216 to 256 colors.
Such files are referred to as using palette-color. The colors in a palette-color file are derived from a
potential palette of 16,777,216 colors, but no more than256 of them can be used in any one image.
8
8/3/2019 FIT 2011 Gradient
9/20
Graphics Interchange Format (GIF)
The GIF is one of the most commonly used graphic fileformats, especially on the Internet.
an indexed color image format.
The color of the image is indexed in a palette. (a color-table)
The GIF is only capable of supporting a maximum of256 colors.
Uses lossless compression algorithm.
9
8/3/2019 FIT 2011 Gradient
10/20
Structure of a BMP
Color-Palette Image
Information 56 bytes
Size
Dimensions Width, height
Bit per pixel 8, 4, 2, 1
Color Table 3 x 256 bytes at most
The color-mapped table of an image
Index R G B
0 28 0 1
1 19 2 5
2 34 1 1
3 39 2 3
4 44 0 2
.. .. .. ..
254 193 211 223
255 206 212 222
10
8/3/2019 FIT 2011 Gradient
11/20
Euclidean Distance Metric
Let E[a,b] be the Euclidean distance between two colorindices a and b.
(0 a, b 255)
where,
E[a,b]: Distance between index a and index b. eR: Difference between R values of a and b indices.
eG: Difference between G values of a and b indices.
eB: Difference between B values of a and b indices.
11
8/3/2019 FIT 2011 Gradient
12/20
Euclidean and Pseudo Distance
matrices
Pseudo-distance matrix
Distance matrixcreated from the color palette
converted
12
Index R G B
0 28 0 1
1 19 2 5
2 34 1 1
3 39 2 3
4 44 0 2
.. .. .. ..
254 193 211 223255 206 212 222
Color-map table
8/3/2019 FIT 2011 Gradient
13/20
Encoding
Reference pixel x and its neighbors Ranking with pseudo-distance matrix
X is the index value to be predicted. a, b, c are neighboringindices.
Using (a, x) we determine ranking value, or error e.
13
Pseudo-distance matrix
8/3/2019 FIT 2011 Gradient
14/20
Decoding
In error matrix E,
the index number of the first pixel at the top-left corner,call it a, is copied to I. Later we apply the following:
Receive the error signal e of the next pixel from the encodedimage.
In row a of the pseudo-distance matrix search the error signalvalue e. Emit the corresponding column valuexas the originalindex value of the image.
Letxbe a and repeat the process until we reach to the end offile.
Clearly, in decoding process, we obtain original indexvalues without any loss.
14
8/3/2019 FIT 2011 Gradient
15/20
a1 x1 x2e11 e12 e13 e14 e15 ..
e21
e22
e23
e24
..
..
ei1
..
15
.. x12
.. x13
..
.. .. .. .. .. ..
a1 .. e12 .. .. ..
.. .. .. .. ..
a2
.. .. .. e13
..
. .. .. .. .. ..
Copy e11 to I(1,1)
Let a1 e11Determine x12 by searching e12 in row a1.
I(1,2) x12
Let a2 x12Determine x13 by searching e13 in row a2.
I(1,3) x13We repeat the process similarly.
1
2
3
Decoding (cont.)
E: Encoded image P: Pseudo-distance matrix I: Image
8/3/2019 FIT 2011 Gradient
16/20
Why do we use the pseudo-distance
transformation?
16
0%
10%
20%
30%
40%
50%
60%70%
80%
90%
100%
01
2
3Sunset Serrano Sea_dusk Yahoo
0%
10%
20%
30%
40%
50%
60%70%
80%
90%
100%
01
2
3Sunset Serrano Sea_dusk Yahoo
Before transformation After transformation
8/3/2019 FIT 2011 Gradient
17/20
Distribution of Music.bmp (n = 8) before and after transformation
17
Distribution of Serrano.bmp (n = 256) before and after transformation
Why do we use the pseudo-distance
transformation?
8/3/2019 FIT 2011 Gradient
18/20
Binary Arithmetic Coder
We observed that after the pseudo-distance metric isapplied to indices of various color-mapped images, onsome images percentage of 0s varies from 72-90.
Hence, we applied context-adaptive binary arithmeticcoder which includes run length coding and contextmodeling.
This yields better compression gain than Huffman coder,which was originally proposed by Kuroki et al.
18
8/3/2019 FIT 2011 Gradient
19/20
Images #Colors Size GIF Huffman SAC Proposed
Benjerry 48 28,326 1.239 1.789 1.218 1.207
Books 7 29,338 3.046 3.901 3.447 3.248
Clegg 256 719,158 3.623 3.161 2.808 2.784
Cwheel 256 481,078 1.492 1.915 0.984 0.941
Descent 122 64,542 2.928 3.153 2.765 2.676
Fractal 256 389,190 6.923 5.72 5.335 5.267
Frymire 256 1,238,678 1.485 2.089 1.373 1.392Gate 84 61,302 2.939 2.987 2.471 2.367
Ghouse 256 481,078 3.713 3.802 3.219 2.962Music 8 6,302 2.482 2.885 2.305 2.373
Netscape 32 61,382 2.113 2.297 1.922 1.936Party8 12 75,606 0.854 2.273 0.778 0.802
Pc 6 1,721,858 1.694 2.605 1.723 1.603
Sea_dusk 46 157,538 0.323 1.025 0.052 0.054
Serrano 256 502,886 1.629 2.07 1.389 1.289
Sunset 204 308,070 2.601 2.197 1.59 1.547Winaw 10 148,894 0.997 2.47 0.98 0.959
Yahoo 229 28,110 1.983 2.498 1.818 1.747
Average 361,296 2.337 2.713 2.01 1.953
W. Avg. 2.328 2.695 1.974 1.904
Normalized 1.223 1.415 1.037 1.000
Experimental Results
19
8/3/2019 FIT 2011 Gradient
20/20
Thank you!
Questions?
20