MMC UNIT 1 Part1 - Chapter 3
MMC UNIT 1 Part1 - Chapter 3
Chapter 3
Chapter 3
Graphics and Image Data
Representations
3.1 Graphics/Image Data
Types 3.2 Popular File
Formats
3.1.1 1-Bit
Images
•Each pixel is stored as a single bit (0 or 1),
so also referred to as binary image.
•Suchan image is also called a 1-bit
monochrome
image since it contains no color.
•Fig. 3.1 shows a 1-bit monochrome image
(called “Lena” by multimedia scientists — this
is a standard image used to illustrate many
algorithms).
Li, D3rew, & Liu 2
Fundamentals of Multimedia, 2nd ed.
Chapter 3
Ditherin
g Dithering
• is used to calculate patterns of dots such
that values from 0 to 255 correspond to patterns that
are more and more filled at darker pixel values, for
printing on a 1-bit printer.
we can first re-map (each pixel value in) image values in 0..255
into the new range 0..4 by (integer) dividing by 256/5. Then,
e.g., if the pixel value is 0 we print nothing, in a 2 x 2 area of
printer output. But if the pixel value is 4 we print all four dots.
(so 5 different modes 0 – 4)
• Fig.
3.4 (a) shows a grayscale image of “Lena”. The
ordered- dither version is shown as Fig. 3.4 (b), with a
detail of Lena's right eye in Fig. 3.4 (c).
Li, 1D3rew, & 13
Liu
Fundamentals of Multimedia, 2nd ed. Chapter 3
(a) (b)
(c) (d)
satellite imaging).
Fundamentals of Multimedia, 2nd ed.
Chapter 3
• Fig.
3.7 shows the resulting 8-bit image, in GIF
format.
• Note the great savings in space for 8-bit images, over 24-
bit ones: a 640 x 480 8-bit color image only requires
300KB(0.3M) of storage, compared to 921.6KB (0.92M)
for a color image (again, without any compression
applied).
Li, 2D3rew, & 23
Liu
Fundamentals of Multimedia, 2nd ed.
Chapter 3
(a) (b)
(c)
for i=0..(MAX_Y-1)
for j=0..(MAX_X-1)
R = image[x][y].red;
G = image[x][y].green;
B = image[x][y].blue;
hist[R][G][B]++;
entries)
Fundamentals of Multimedia, 2nd ed.
Chapter 3
32
Li, 3D2rew, &
Liu
Fundamentals of Multimedia, 2nd ed.
Chapter 3
Fig. 3.11: Histogram of R bytes for the 24-bit color image “forestfire.bmp”
results in a “0” bit or “1” bit label for every pixel. For the second bit of the
color table index being built, we take R values less than the R median and label
just those pixels as “0” or “1” according as their G value is less than or greater
than the median of the G value, just for the “0” Red bit pixels. Continuing over
R, G, B for 8 bits gives a color LUT 8-bit index.
Li, 3D5rew, & 35
Liu
Fundamentals of Multimedia, 2nd ed.
Chapter 3
Median-Cut Algorithm to
Select LUT colors
Find the smallest box containing all the colors in the
1.
image
2. Sort the color codes of all the pixels in the longest
dimension (here for example, R dimension)
3. Split the box by median of R: if box < median
R= 0 else R=1
4.For R=0, Split the box by
median of G: if box <
median then 00 else 01
(the bit code is an index
value for each box whose
Centroid is LUT color)
Do the same for R=1
5.Repeat step 1, 2, 3, 4 until
find 256 boxes (regions) (or
through
r
e
c
u
r
Fundamentals of Multimedia, 2nd ed.
Chapter 3
GIF8
• For the standard specification, the general file
7format of a GIF87 file is as in Fig. 3.12.
• If
the “interlace” bit is set in the local Image
Descriptor, then the rows of the image are displayed
in a four-pass sequence (Fig.3.16).
• To
decipher the remainder of the file header (after
“GIF87a”), we use hexadecimal:
od -x forestfire.gif | head -2
3.2.2
JPEG
• JPEG: The most important current standard for image
compression.
PN
G
• PNG format: standing for Portable Network
Graphics — meant to supersede the GIF standard, and
extends it in important ways.
TIF
F
• TIFF: stands for Tagged Image File Format.
EXI
F
• EXIF (Exchange Image File) is an image format for
digital cameras:
• 1. Compressed EXIF files use the baseline JPEG
format.
PS and
PDF
• Postscript is an important language for typesetting,
and many high-end printers have a Postscript
interpreter built into them.
• Postscript
is a vector-based picture language, rather than
pixel- based: page element definitions are essentially in
terms of vectors.
1. Postscript includes text as well as
vector/structured graphics.
PT
M
• PTM (Polynomial Texture Mapping) is a technique for
storing a representation of a camera scene that
contains information about a set of images taken under
a set of lights that each have the same spectrum (say, a
xenon flash), but with each light placed at a different
direction from the scene. PTM was
invented at Hewlett-Packard.
Fig.
3.18:
(a)50 input images for PTM:
lights individually from 50
different directions ei,
i=1..50;
(b) interpolated image
under
new light e