You are on page 1of 24

CSO243:

FUNDAMENTALS OF MULTIMEDIA

Lecture 2:Graphics and Image Data Representations


Topics Covered
2

 Bit Images
 8-Bit Gray-Level Images
 Image Data Types
 24-Bit Color Images
 8-Bit Color Images
 Color Lookup Tables (LUTs)
Types of images (1-Bit Images)
3

Images consist of pixels


 A 1-bit image consists of on and off bits only and thus

is the simplest type of image.


 Each pixel is stored as a single bit (0 or 1), so also

referred to as a binary image.


 It is also sometimes called

a 1-bit monochrome image


, since it contains no color.
Monochrome 1-bit images
4

The entire image can be thought of as a two-dimensional


array of pixel values or Matrix.
 Image resolution refers to the number of pixels in a
digital image (higher resolution always yields better
quality).
Monochrome 1-bit images
5

1-bit images can be represented can be represented


by matrices. For example, the small image of Felix the
Cat can be represented by a 35 × 35 matrix
whose elements are the numbers 0 and 1.
Monochrome 1-bit images (Size)
6

 A 35 × 35 monochrome image requires 153.125 B of


storage (= 35× 35/8).

Monochrome 1-bit Lena image resolution 640 × 480


 A 640 × 480 monochrome image requires 38.4 kB of
storage (= 640 × 480/8).
8-Bit Gray-Level Images
7

 Each pixel has a gray value between 0 and 255. Each pixel
is represented by a single byte. for example, a dark pixel
might have a value of 10, and a bright one might be 230.
 Each pixel is usually stored as a byte (a value between 0 and
255), so a 640 × 480 gray scale image requires 300 kB of
storage (640 × 480 = 307,200).
8-Bit Gray-Level Images cont.
8

 Fairly high resolution for such an image might be


 1,600 × 1,200, whereas lower resolution might be
640 × 480. Notice that here we
 are using an aspect ratio of 4:3. We don’t have to
adopt this ratio, but it has been
 found to look natural. For this reason, 4:3 was
adopted for early TV
 Later displays typically use an aspect ration of
16:9
 to match high-definition video and TV.
24-Bit Color Images
9

 In a color 24-bit image, each pixel is represented by three


bytes, usually representing RGB.
 Since each value is in the range 0–255, this format supports
256 × 256 × 256, or a total of 16,777,216, possible
combined colors.
 However, such flexibility does result in a storage penalty: a 640
× 480 24-bit color image would require 921.6 kB of storage
without any compression.
 An important point to note is that many 24-bit color images
are actually stored as 32-bit images, with the extra byte of
data for each pixel storing an α (alpha) value representing
special-effect information. The simplest use is as a transparency
flag.
forestfire.bmp, a 24-bit image in
10
Microsoft Windows BMP format
R
24 bit color Channel
Image

B
G Channel
Channel
8-Bit Color Images
11

For reducing image size to save memory


 Many systems can utilize color information stored with only 8 bits
of information (the so-called “256 colors”) in producing a screen
image.
 8-bit color image files use the concept of a lookup table to store
color information.
 Basically, the image stores not color but instead just a set of
bytes, each of which is an index into a table with 3-byte values
that specify the 24-bit color for a pixel with that lookup table
index.
 Great savings in space for 8-bit images over 24-bit ones: a 640
× 480 8-bit color image requires only 300 kB of storage,
compared to 921.6 kB for a color image
Example of an 8-bit color image
12
Color histogram
13

 A color histogram is a representation of the distribution of colors in an


image.
 A color histogram focuses only on the proportion of the number of
different types of colors, regardless of the spatial location of the
colors.
 The values of a color histogram show the statistical distribution of
colors .
Color Lookup Tables (LUTs)
14

 the idea used in 8-bit color images is to store only the


index, or code value, for each pixel. Then, if a pixel
stores, say, the value 25, the meaning is to go to row 25 in
a color lookup table (LUT).
 The LUT is often called a palette
A color picker
15

A color picker is a tool enable you to select a color .


It consists of an array of fairly large blocks of color such that a
mouse click will select the color indicated.
In reality,a color picker displays the palette colors associated
with index values from 0 to 255.
A color picker example
16
How to Devise a Color Lookup Table
to make 8-bit lookup color out of 24-bit color
17

 The most straight forward way to make 8-bit lookup color out of 24-
bit color would be to divide the RGB cube into equal slices in each
dimension.
 Then the centers of each of the resulting cubes would serve as the
entries in the color LUT, and simply scaling the RGB ranges 0 .. 255
into the appropriate ranges would generate the 8-bit codes.
 Since humans are more sensitive to R and G than to B, we could
 shrink the R range and G range 0 .. 255 into the 3-bit
 and shrink the B range down to the 2-bit, making a total of 8 bits.

However, what tends to happen with this simple scheme is that


edge artifacts appear in the image.
Example
18

Pixel (40,120,250) will be mapped to (47,109,204)

R Center G Center
B Cent.
0 to 31 16 0 to 31 16 0 to 63 32
32 to 63 47 32 to 63 47
64 to 95 78 64 to 95 78 64 to 96
96 to 127 109 96 to 127 109 127
128 to 159 140 128 to 159 140 28 to 160
191
160 to 191 171 160 to 191 171
192 to 204
192 to 223 202 192 to 223 202
255
224 to 255 233 224 to 255 233
After Mapping
19

Color After mapping Pixel (40,120,250) to (47,109,204)


Drawback of simple method
20

 However, what tends to happen with this simple


scheme is that edge artifacts appear in the image.
 The reason is that if a slight change in RGB results in
shifting to a new code, an edge appears, and this
can be quite annoying perceptually.
 simple alternate solution for this color reduction
problem called the median cut algorithm does a
better job (and several other competing methods
do as well or better).
Median-cut algorithm
21

The median cut algorithm is a popular and simple way to


reduce the number of colors in an image.
Median-cut algorithm
22

Step 1: We first create a box (cube) of the RGB


components of all pixels.

Blue
Read Green

Step 2 - Calculate the Range of Each Component


Step 3– Select the Median of the Component with the
Largest Range
Step 4 - Split the Cube Along the Median
Step 1C - Split the Cube Along the
Median
23
Median-cut algorithm
24

Step 5: Repeat steps (2,3,4) for each spitted cube until


reaching 256 cube
Step 6: For every cube, call the mean of R, G, and B in
that box the representative (the center) color for the
box.
Step 7: Based on the Euclidean distance between a
pixel RGB value and the box centers, assign every pixel
to one of the representative colors.

You might also like