You are on page 1of 217

Color Space

❒ RGB components of an image are strongly correlated

Matlab code:

x = imread(‘lena.ppm’);
figure; imshow(x);
R figure; imshow(x(:,:,1));
figure; imshow(x(:,:,2));
figure; imshow(x(:,:,3));

Note:
Size of x: (512, 512, 3)

G B
CMPT365 Multimedia Systems 28
Color Space: RGBàYUV

❒ Solution: convert to other spaces


❒ Why ? Display device, compression …

(R,  G,  B) (Y,  U,  V)

Color
Compress
Conversion

(Y,  U,  V)


(R,  G,  B)
Inverse  Color Decompress
Conversion
For  display

CMPT365 Multimedia Systems 29


Color Space

❒ 3. YUV color space (used by PAL TV system)


❍ Y: Luminance component (brightness)
❍ U, V: Chrominance components
- the difference between a color and a reference
U-­V  color  plane  when  Y=0.5
❒ 4. YCrCb Space (used in image/video coding)
❍ Derived from YUV
• U,V shifted by 0.5
❍ Components approximately
uncorrelated

CMPT365 Multimedia Systems 30


YUV Decomposition

CMPT365 Multimedia Systems 31


Color Space

R G B

Y Cb Cr
❒ Most information is in Y channel (brightness)
❍ Cb and Cr are small à easier for compression
❒ Human eyes are not sensitive to color error
❍ Don’t need high resolution for color component
CMPT365 Multimedia Systems 32
4.3.3 YIQ Color Model
• YIQ is used in NTSC color TV broadcasting. Again, gray pixels
generate zero (I, Q) chrominance signal.

(a) I and Q are a rotated version of U and V .

(b) Y ′ in YIQ is the same as in YUV; U and V are rotated by 33°:

I = 0.492111(R′ − Y ′) cos 33° − 0.877283(B′ − Y ′) sin 33°

Q = 0.492111(R′ −Y ′) sin 33°+0.877283(B′ −Y ′) cos 33°


(4.31)

(c) This leads to the following matrix transform:

éY ¢ ù é 0.299 0.587 0.114 ù é R¢ ù


ê ú ê ú ê ¢ ú (4.32)
ê I ú = ê0.595879 -0.274133 -0.321746ú = êG ú
ê Q ú êë0.211205 -0.523083 0.311878 úû ê B¢ ú
ë û ë û
(d) Fig. 4.19 shows the decomposition of the same color image as above, into YIQ
components.

CMPT365 Multimedia Systems 38


❒ Fig.4.19: (a) I and, (b) Q components of color image.

CMPT365 Multimedia Systems 39


Graphics/Image Data Types

❒ The number of file formats used in multimedia continues to proliferate.

CMPT365 Multimedia Systems 43


1-bit Images

❒ Each pixel is stored as a single


bit (0 or 1), so also referred
to as binary image.
❒ Such an image is also called a
1-bit monochrome image since
it contains no color.
❒ Fig. 1 shows a 1-bit
monochrome image (called
“Lena” by multimedia
scientists — this is a standard
image used to illustrate many
algorithms). Fig. 1: Monochrome 1-bit Lena image.

CMPT365 Multimedia Systems 44


8-bit Gray-level Images

❒ Each pixel has a gray-value between 0 and 255. Each pixel is


represented by a single byte; e.g., a dark pixel might have a value of
10, and a bright one might be 230.

❒ Bitmap: The two-dimensional array of pixel values that represents


the graphics/image data.

❒ Image resolution refers to the number of pixels in a digital image


(higher resolution always yields better quality).
❍ Fairly high resolution for such an image might be 1,600 x 1,200,
whereas lower resolution might be 640 x 480.

CMPT365 Multimedia Systems 45


8-bit Gray-level Images cont’d

❒ Frame buffer: Hardware used to store bitmap.


❍ Video card (actually a graphics card) is used for this purpose.
❍ The resolution of the video card does not have to match the desired
resolution of the image, but if not enough video card memory is available
then the data has to be shifted around in RAM for display.
❒ 8-bit image can be thought of as a set of 1-bit bit-planes, where
each plane consists of a 1-bit representation of the image at higher
and higher levels of “elevation”: a bit is turned on if the image pixel
has a nonzero value that is at or above that bit level.

Bit-planes
CMPT365 Multimedia Systems 46
Grayscale Image

❒ Each pixel -> a byte (a value between 0 to 255)


❍ 640x480 grayscale image requires 300 kB of storage (640 x 480 =
307, 200).
❒ Print a grayscale image on Black/White newspaper (or laser
printer) ?
A note: A black/white newspaper displays
black (one dot) or white (no dot) only, so
does a black/white laser printer !

CMPT365 Multimedia Systems 47


Grayscale Image

❒ Each pixel -> a byte (a value between 0 to 255)


❍ 640x480 grayscale image requires 300 kB of storage (640 x 480 =
307, 200).
❒ Print a grayscale image on Black/White newspaper (or laser
printer) ?
❍ Dithering is used, which trades intensity resolution for spatial
resolution to provide ability to print multi-level images on 2-level (1-bit)
printers.

A note: A black/white newspaper displays


black (one dot) or white (no dot) only, so
does a black/white laser printer !

CMPT365 Multimedia Systems 48


Grayscale Image Printing - Dithering

Bi-level With
only dithering

CMPT365 Multimedia Systems 49


Dithering
❒ Rationale: calculate square 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.

❒ Strategy: Replace a pixel value by a larger pattern, say 2x 2 or 4


x 4, such that the number of printed dots approximates the
varying-sized disks of ink used in analog, in halftone printing
(e.g., for newspaper photos).

1. Half-tone printing is an analog process that uses smaller or larger


filled circles of black ink to represent shading, for newspaper
printing.
2. For example, if we use a 2 x 2 dither matrix

CMPT365 Multimedia Systems 50


Dithering cont’d

we can first re-map 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.

❒ The rule is:


If the intensity is > the dither matrix entry then print an
on dot at that entry location: replace each pixel by an n x n
matrix of dots.

❒ Note that the image size may be much larger, for a dithered
image, since replacing each pixel by a 4 x 4 array of dots, makes
an image 16 times as large.

CMPT365 Multimedia Systems 51


Ordered Dithering
❒ A clever trick can get around this problem. Suppose we wish to use a larger,
4 x 4 dither matrix, such as

❒ An ordered dither consists of turning on the printer out-put bit for a pixel
if the intensity level is greater than the particular matrix element just at
that pixel position.

❒ Fig. 4 (a) shows a grayscale image of “Lena”. The ordered-dither version is


shown as Fig. 4 (b), with a detail of Lena's right eye in Fig. 4 (c).

CMPT365 Multimedia Systems 52


Dithering cont’d

(a) (b) (c)


Fig. 4: Dithering of grayscale images.

(a): 8-bit grey image “lenagray.bmp”. (b): Ordered dithered version of the
image. (c): Detail of dithered version.

CMPT365 Multimedia Systems 53


Dithering cont’d

❒ Algorithm for ordered dither, with n x n dither matrix, is as follows:

BEGIN
for x = 0 to xmax // columns
for y = 0 to ymax // rows
i = x mod n
j = y mod n
// I(x, y) is the input, O(x, y) is the output,
//D is the dither matrix.
if I(x, y) > D(i, j)
O(x, y) = 1;
else
O(x, y) = 0;
END

CMPT365 Multimedia Systems 54


Colored Dithering

❒ Apply dithering to each color


❒ http://en.wikipedia.org/wiki/Dither

CMPT365 Multimedia Systems 55


Colored Dithering

❒ pixisnap photos http://www.pixisnap.com/

CMPT365 Multimedia Systems 56


24-bit Color Images
❒ In a color 24-bit image, each pixel is represented by three bytes,
usually representing RGB.
❍ This format supports 256x 256x 256 possible combined colors, or a
total of 16,777,216 possible colors.
❍ However such flexibility does result in a storage penalty: A 640x480
24-bit color image would require 921.6 kB of storage without any
compression.

❒ An important point: many 24-bit color images are actually stored


as 32-bit images, with the extra byte of data for each pixel used
to store an alpha value representing special effect information
(e.g., transparency).

❒ Fig. 5 shows the image forestfire.bmp, a 24-bit image in Microsoft


Windows BMP format. Also shown are the grayscale images for just
the Red, Green, and Blue channels, for this image.

CMPT365 Multimedia Systems 57


24-bit Color Images

(a) (b)

(c) (d)
Fig. 5: High-resolution color and separate R, G, B color channel images.
(a): Example of 24-bit color image “forestfire.bmp”.
(b, c, d): R, G, and B color channels for this image

CMPT365 Multimedia Systems 58


Beyond 24-bit Color Images
❒ More information about the scene being imaged can be gained by
using more accuracy for pixel depth (64 bits, say); or by using
special cameras that view more than just three colors (i.e., RGB)

• use invisible light (e.g., infra-red, ultraviolet) for security cameras:


“dark flash”
• use higher-dimensional medical images of skin (> 3-D) to diagnose skin
cancer.
• in satellite imaging, use high-Depth to obtain types of crop growth, etc.

❒ Such images are called multispectral (more than 3 colors) or


hyperspectral (a great many image planes, say 224 colors for
satellite imaging)

CMPT365 Multimedia Systems 59


8-bit Color Images

❒ Many systems can make use of 8 bits of color information (the so-
called “256 colors”) in producing a screen image. Why ?

CMPT365 Multimedia Systems 60


Fig. 6: 3-dimensional histogram of RGB colors in “forestfire.bmp”.

CMPT365 Multimedia Systems 61


8-bit Color Images

❒ Many systems can make use of 8 bits of color information (the so-
called “256 colors”) in producing a screen image.

❒ Such image files use the concept of a (color index) lookup table to
store color information.
❍ Basically, the image stores not color, but instead just a set of bytes,
each of which is actually an index into a table with 3-byte values that
specify the color for a pixel with that lookup table index.

CMPT365 Multimedia Systems 62


8-bit Color Images cont’d

Example of 8-bit color image.

❒ Note the great savings in space for 8-bit images, over 24-bit ones:
a 640x480 8-bit color image only requires 300 kB of storage,
compared to 921.6 kB for a color image (again, without any
compression applied).

CMPT365 Multimedia Systems 63


Color Look-up Tables (LUTs)

❒ The idea used in 8-bit color images is to store only the index, or
code value, for each pixel. Then, e.g., if a pixel stores the value 25,
the meaning is to go to row 25 in a color look-up table (LUT).

Fig. 8: Color LUT for 8-bit color images.

CMPT365 Multimedia Systems 64


Color Look-up Tables (LUTs) cont’d
❒ (a): A 24-bit color image of “Lena”
❒ (b): The same image reduced to only 5 bits via dithering
❒ (c): A detail of the left eye

(a) (b) (c)

CMPT365 Multimedia Systems 65


How to devise a color look-up table
• The most straightforward way to make 8-bit look-up color out
of 24-bit color would be to divide the RGB cube into equal
slices in each dimension.
a) The centers of each of the resulting cubes would serve as the
entries in the color LUT, while simply scaling the RGB ranges
0..255 into the appropriate ranges would generate the 8-bit
codes.
b) 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 range 0..7
and shrink the B range down to the 2-bit range 0..3, thus making
up a total of 8 bits.
c) To shrink R and G, we could simply divide the R or G byte value
by (256/8)=32 and then truncate. Then each pixel in the image
gets replaced by its 8-bit index and the color LUT serves to
generate 24-bit color.

CMPT365 Multimedia Systems 66


Problem

❒ 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.
❒ Imaging a smoothly changing color suddenly
divided into two range
❒ E.g.
❍ Use 3 bits for R, then the original value range from
0~255 with interval 1
❍ Now become 0~255 with interval 32(256/2^3)
❍ So two color RGB(31,128,128), RGB(32,128,128) would
become RGB(0,128,128), RGB(32,128,128)
CMPT365 Multimedia Systems 67
• Median-cut algorithm: A simple alternate solution that does
a better job for this color reduction problem.

a) The idea is to sort the R byte values and find their median;
then values smaller than the median are labelled with a “0” bit
and values larger than the median are labelled with a “1” bit.

b) This type of scheme will indeed concentrate bits where they


most need to differentiate between high populations of close
colors.

c) One can most easily visualize finding the median by using a


histogram showing counts at position 0..255.

d) Fig. 3.11 shows a histogram of the R byte values for the


forestfire.bmp image along with the median of these
values, shown as a vertical line.

CMPT365 Multimedia Systems 68


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.

CMPT365 Multimedia Systems 69


More about Histogram (and the power of
digitization)

CMPT365 Multimedia Systems 70


More about Histogram (and the power of
digitization)

CMPT365 Multimedia Systems 71


CMPT365 Multimedia Systems 72
CMPT365 Multimedia Systems 73
CMPT365 Multimedia Systems 74
Popular File Formats

❒ 8-bit GIF : one of the most important formats because of


its historical connection to the WWW and HTML markup
language as the first image type recognized by net browsers.

❒ JPEG: currently the most important common file format.

CMPT365 Multimedia Systems 79


GIF

❒ GIF standard: (We examine GIF standard because it is so


simple! yet contains many common elements.)
-- Graphics Interchange Format
❒ Limited to 8-bit (256) color images only, which, while
producing acceptable color images, is best suited for images
with few distinctive colors (e.g., graphics or drawing).
❒ GIF standard supports interlacing — successive display of
pixels in widely-spaced rows by a 4-pass display process.
❒ GIF actually comes in two flavors:
1. GIF87a: The original specification.
2. GIF89a: The later version. Supports simple animation via a
Graphics Control Extension block in the data, provides simple
control over delay time, a transparency index, etc.

CMPT365 Multimedia Systems 80


GIF87
❒ General file format of a GIF87 standard file

Fig. 12: GIF file format.

CMPT365 Multimedia Systems 81


❒ Screen Descriptor comprises a set of attributes that
belong to every image in the file.

Fig.13: GIF screen descriptor in GIF87

CMPT365 Multimedia Systems 82


❒ Color Map is set up in a very simple fashion as in Fig. 14. However,
the actual length of the table equals 2(pixel+1) as given in the Screen
Descriptor.

Fig. 14: GIF color map in GIF87

CMPT365 Multimedia Systems 83


❒ Each image in the file has its own Image Descriptor

Fig. 15: GIF image descriptor.

CMPT365 Multimedia Systems 84


❒ 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. 16: GIF 4-pass interlace display row order.

CMPT365 Multimedia Systems 85


❒ We can investigate how the file header works in practice by having a look at a
particular GIF image. Fig. 3.7 on page is an 8-bit color GIF image, in UNIX,
issue the command:
od -c forestfire.gif | head -2

and we see the first 32 bytes interpreted as characters:


G I F 8 7 a \208 \2 \188 \1 \247 \0 \0 \6 \3 \5
J \132 \24 | ) \7 \198 \195 \ \128 U \27 \196 \166 & T

❒ To decipher the remainder of the file header (after “GIF87a”), we use


hexadecimal:
od -x forestfire.gif | head -2

with the result


4749 4638 3761 d002 bc01 f700 0006 0305 ae84 187c 2907 c6c3 5c80
551b c4a6 2654

CMPT365 Multimedia Systems 86


JPEG
❒ JPEG: The most important current standard for image compression.
-- Joint Photographic Experts Group
❒ The human vision system has some specific limitations and JPEG
takes advantage of these to achieve high rates of compression.

❒ JPEG allows the user to set a desired level of quality, or


compression ratio (input divided by output).

❒ As an example, Fig. 17 shows our forestfire image, with a quality


factor Q=10%.
❍ This image is a mere 1.5% of the original size. In comparison, a JPEG
image with Q=75% yields an image size 5.6% of the original, whereas a
GIF version of this image compresses down to 23.0% of uncompressed
image size.
❒ More on later …

CMPT365 Multimedia Systems 87


Fig. 17: JPEG image with low quality specified by user.

CMPT365 Multimedia Systems 88


PNG
❒ PNG format: standing for Portable Network Graphics — meant to
supersede the GIF standard, and extends it in important ways.

❒ Special features of PNG files include:

1. Support for up to 48 bits of color information — a large


increase.

2. Files may contain gamma-correction information for correct


display of color images, as well as alpha-channel information for
such uses as control of transparency.

3. The display progressively displays pixels in a 2-dimensional


fashion by showing a few pixels at a time over seven passes through
each 8 8 block of an image.

CMPT365 Multimedia Systems 89


TIFF
❒ TIFF: stands for Tagged Image File Format.

❒ The support for attachment of additional information (referred to


as “tags”) provides a great deal of flexibility.

1. The most important tag is a format signifier: what type of


compression etc. is in use in the stored image.

2. TIFF can store many different types of image: 1-bit, grayscale,


8-bit color, 24-bit RGB, etc.

3. TIFF was originally a lossless format but now a new JPEG tag
allows one to opt for JPEG compression.

4. The TIFF format was developed by the Aldus Corporation in the


1980's and was later supported by Microsoft.

CMPT365 Multimedia Systems 90


EXIF
❒ EXIF (Exchange Image File) is an image format for digital cameras:

❒ 1. Compressed EXIF files use the baseline JPEG format.

❒ 2. A variety of tags (many more than in TIFF) are available to facilitate


higher quality printing, since information about the camera and picture-
taking conditions (flash, exposure, light source, white balance, type of
scene, etc.) can be stored and used by printers for possible color correction
algorithms.

❒ 3. The EXIF standard also includes specification of file format for audio
that accompanies digital images. As well, it also supports tags for
information needed for conversion to FlashPix (initially developed by Kodak).

CMPT365 Multimedia Systems 91


Graphics Animation Files
❒ A few dominant formats aimed at storing graphics animations (i.e., series of
drawings or graphic illustrations) as opposed to video (i.e., series of images).

❒ Difference: animations are considerably less demanding of resources than


video files.

❒ 1. FLC is an animation or moving picture file format; it was originally created


by Animation Pro. Another format, FLI, is similar to FLC.

❒ 2. GL produces somewhat better quality moving pictures. GL animations can


also usually handle larger file sizes.

❒ 3. Many older formats: such as DL or Amiga IFF files, Apple Quicktime


files, as well as animated GIF89 files.

CMPT365 Multimedia Systems 92


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.

2. GL bit-mapped images can be included in output files.

3. Encapsulated Postscript files add some additional information


for inclusion of Postscript files in another document.

CMPT365 Multimedia Systems 93


4. Postscript page description language itself does not provide
compression; in fact, Postscript files are just stored as ASCII.

❒ Another text + figures language has begun to supersede or at least parallel


Postscript: Adobe Systems Inc. includes LZW compression in its Portable
Document Format (PDF) file format.

❍ PDF files that do not include images have about the same compression ratio, 2:1 or
3:1, as do files compressed with other LZW-based compression tools.

CMPT365 Multimedia Systems 94


Some Other Image Formats
❒ Microsoft Windows: BMP
❍ Major system standard graphics file format for Microsoft
Windows, used in Microsoft Paint and other programs
❍ Many sub-variants within the BMP standard

❒ Microsoft Windows: WMF (Windows Metafile)


❍ Native vector file format for the Windows operating
environment:
❍ Features
1. Consist of a collection of GDI (Graphics Device Interface)
function calls, also native to the Windows environment.
-- e.g., PlayMetaFile() function to render
2. Ostensibly device-independent and size unlimited

Many more... (check “save as” in Photoshop)

CMPT365 Multimedia Systems 95


Multimedia System Design
Chapter 3

IMAGES
Overview
• Colors and palettes in Multimedia
• Creation of multimedia images.
• Creation of still images.
• Image file types used in multimedia.
Before You Start to Create:
• Plan your approach using flowcharts
and storyboards
• Organize your tools means with
multimedia tools you can make text,
buttons, sounds, etc.
• Use multiple monitors (especially for
a program like Director where
changes in one window are visible in
the presentation window)
Making Still Images
• Bitmaps ( paint graphics or raster
graphics) – used for photo-realistic
images and detailed drawings
• Vector graphics – used for lines, polygons
and other mathematical objects
• Saved as GIF,JPEG,PNG files with
compression
6
M
M
D
S
Colour
1
2 Light source, object, observer
0
1 Electromagnetic spectrum
S
t
u
a
r
t
F
r
a
s
20/09/20217
M
M
D
S
It’s a Brain Thing
1
2 Colour optical illusions
0
1 Pure yellow light will register on both
S the red absorbing cones and the
t green absorbing cones
u
a Red and green mixed yellow with
r register slightly on the blue
t
F
absorbing cones
r Brain filters out the small blue amount
a
s
as a white addition
I.e. red, green, blue produce white so 20/09/2021
the 8
M
M
D
S
Not just a Brain Thing
1
2 Colour blindness
0 Affects roughly 8% of males to varying
1
S
degrees.
t X chromosome determines the red and
u green acuity
a Men have only one X so if one is bad the
r other can’t be used to fix it
t
F Different wave lengths require different
r focal lengths to see
a Red tends to jump out, blues not so good
s for short sighted people. 20/09/20219
M
M
D
S
1 Colour affects our depth perception
2
0
And therein lies a misconception:
1
S It’s not a universal creed
t
u That reds advance and blues recede;
a
r For some there is a better chance
t
F
r That blues advance and reds recede.
a
s
20/09/2021
10
Complications of color
 Why does the prism separate
the light into its spectral
Components?

 prism bends different wavelengths of


light by different amounts
• refractive index is a function of
Wavelength
• shorter wavelengths are refracted
more strongly than longer
wavelengths
Color
• Natural Light and Color
– Quantum Theory of Light
– Color is the frequency of visible light
– ROY G. BIV ( increasing frequencies)
– Infrared | Visible Light | Ultraviolet
– White light is a mixture of all the
frequencies
M
M
D
S
The Eye
1 Rods and Cones
2
Rods perceive luminance only
0
Highly sensitive
1
Cones perceive colour
S
Require bright conditions
t
Red, Green, Blue pigment
u 3 million behind fovea, 1° - 2 ° of
a accurate vision
r Absorption not even distributed
t 40:20:1 (RGB)
F Better tuned to see red, yellow,
green cyan range
r
a
s
20/09/2021
13
Color
• Cornea of your eye focuses light rays onto
the retina to stimulate rods and cones
which transmit the patterns of color
information to the brain.
• ( Cones are sensitive to red, green and blue light.)
• Green, blue, yellow, orange, purple, pink, brown
black, gray and white are most common colors in
all cultures.
• The eye can differentiate among about 80,000 colors,
or hues, consisting of combinations of red, green,
and blue.
TRADITIONAL GRAPHICS
Color image reproduction.
Use a series of four-color dots of
transparent inks.
CYMK
Cyan, magenta, yellow, and a key
color usually black.
Small dots of color combinations
can reproduce many different colors.

15
COLOR REPRODUCTION
Color images on printed surface are formed
using subtractive process.
Light is reflected from the printed surface.
Pigments that form an image absorb some of the
colors.
Remaining colors reach the eye to produce image.

16
Color images on computer monitor use
additive process.
Varying amounts of Red, Green, and Blue light are
added together to create the color.
Graphic artists convert from RGB(additive)
color models to CMYK model if image is
printed.

17
Color
• Color and Culture
– Western culture: Red = anger, danger
Black = death, funerals
– Eastern culture Red = happiness
White = death, funerals
( Eastern Weddings and restaurants most often
use RED )
Internet study (p.142) world’s favorite color is
blue
Color
• Psychology of Color – how you perceive it
• Computer monitors produce color with red,
green and blue light – the ADDITIVE primary
colors. Tiny red, blue and green dots on the
screen, light up when bombarded by
electrons.
• The reflected light from a printed page is
SUBTRACTIVE primary colors ( cyan,
magenta, yellow and a little black)
Color
• Computerized Color
• Monitors and Color – most monitors today
are set to display 640 X 480 pixels and 256
colors, can be adjusted for more Called
VGA ( Video Graphics Array)
• Minimum configuration for Windows and
MAC
• More colors requires more memory
Color
• Computerized color
Computers combine red, green, and blue (RGB) light
Bit depth determines the number of possible colors

1-bit 4-bit 8-bit 24-bit


2 colors 16 colors 256 colors 16,777,216 colors
COLOR Formation
• RGB Combination (R,G,B) Perceived Color
• Red only (255,0,0) Red
• Green only (0,255,0) Green
• Blue only (0,0,255) Blue
• Red and green (blue subtracted) (255,255,0) Yellow
• Red and blue (green subtracted) (255,0,255) Magenta
• Green and blue (red subtracted) (0,255,255) Cyan
• Red, green, and blue (255,255,255) White
• None (0,0,0) Black
Color Wheel
M
M
D
S
Gamut
1
2 Different ranges of producible colour
0
1
S
t
u
a
r
t
F
r
a
s
20/09/2021
24
M
M
D
S
Colour Models
1
2 RGB/CMYK
0
RGB additive colours
1
S CMY subtractive
t
HLS/HSB/HSV
u
a Munsell
r
t CIE Lab
F
r
a
s
20/09/2021
25
Color
• Computer Color Models
• Color of a pixel is expressed as the amount
of red, green and blue ( RGB)
• HSB ( hue, saturation, brightness) and HSL
( hue, saturation, lightness) models specify
color as an angle from 0 –360 degrees on a
color wheel and saturation, brightness, and
lightness as percentages.
• 100% Lightness = white
• Saturation is the intensity of the color Other
color models are used for TV, photos and
other media
Color Models - Additive
Color Models
• Additive Color: RGB
– Describes colors that emanate from glowing
bodies such as lights, TV, and computer
monitors
• In additive color models, mixing two
colors results in a brighter color
• Overlapping colors from 3 projectors
produces new colors:
– red+ green -> yellow
– green+ blue -> cyan
– red + blue -> magenta
Color Models - Subtractive
Color Models
• Subtractive Color : CMYK
– Most object reflect light
– Mixing two colors creates a darker one
– cyan, magenta, yellow, which are
complements of red, green and blue,
respectively
– Where 3 inks overlap, there is black (
gray)
M
M
D
S
RGB/CMY
1
2
0
1
S Add/Mix amounts of light/pigment
t
u
a Additive colour uses light sources
r
t
F Subtractive/Reflective uses
r pigments/paints
a
s
20/09/2021
31
M
M
D
S
HLS
1
2 Hue Lightness Saturation
0
1
S
t
u
a
r
t
F How we perceive colour
r HSB (Hue Saturation Brightness)
a Brightness is not the same scale as lightness in HLS
s
20/09/2021
32
Color Models - HSB
<-------- lum -------->
<-------- sat -------->
<-------- hue -------->
Color Model:
HSV/HSL
 HSV specifies a value
from 0 to 255 for
 Hue
 Saturation
 Value
 HSL (Hue, Saturation, and
Lightness/ Luminance) is
a similar model, but “L”
expands from white to
black (rather than HSV’s
black to hue), therefore
providing a “double cone”
M
M
D
S
Terminology
1
2 Hue
0
1 Saturation/Tone
S Tint
t
u Shade
a
Luminance
r
t Lightness/Value
F
r
a
s
20/09/2021
35
Color Models
Varying Brightness

Varying Saturation
Hue
 Definition – a  ROY G. BIV =
distinct color of the  Red
color gamut (range  Orange
of a color model)  Yellow
 Green
 Defined by a  Blue
particular  Indigo
wavelength  Violet
 This is what most of
us refer to when we
say “color”
Saturation
 Definition:
 “the amount of white light (or gray paint) mixed with the
hue”
 how MUCH color; the dominance of the hue
 High Saturated colors include little gray or white light
 These are bright and vibrant
 Low Saturated colors appear grayish in color
 These include pastels and “muddier” colors
High saturation

Low saturation
Webpage Example
 The two screen shots
primarily differ based on
their saturation…
 How has the appeal
changed?
 Is one of the slides more
“generally appealing”
than the others?
Value
 Definition:
 “the intensity of light present”
 how light or dark the color is
 Also referred to as “brightness” or “intensity”
 Range from “tints” (light values) to “shades” (dark
values)
 Often accomplished by mixing the color with various
amounts of white or black

shades

tints
M
M
D
S
Munsell
1
2 One of the first to try and conceive of a
0 notation for colour
1
S Not just arbitrary naming
t Notation is characterised by the hue,
u
a chroma and value
r
t
F
r
a
s
20/09/2021
41
M
M
D
S
CIE/ CIE Lab
1
2 Comission Internationale de l'Eclairage
0 (International Commission on
1
S Illumination)
t Device independent
u
a Used in colour
r management
t
F
r
a
s
20/09/2021
42
M
M
D
S
Colour Schemes
1
Monochromatic
2
All one hue
0
1 Analogous
S Hues next to one another on colour wheel

t Complimentary
u Split complimentary (opposite on colour wheel)
a Tetradic (Double split complimentary lines near each other)
r Triadic
t Split colour wheel into three 120°
F Discord
r Mismatch, rude, yet can be eye catching (attention grabbing)
a
s
20/09/2021
43
M
M
D
S
Colour Wheel
1 Newton’s Colour Wheel
2
0
Primaries
1 Can’t be made from mixing
S two pigments
t Secondaries
u Made from equal parts of
a adjacent primaries
r
t Tertiary
F Made from equal parts of a
r primary and adjacent
a secondary
s
20/09/2021
44
Color Wheels
 Help to arrange colors and determine
appropriate combinations of color
 Three types
 artist’s wheel (paint mixing)
 subtractive color wheel
 additive color wheel
Additive Color Wheel
 Models how projected color
combines
 Black = no light (i.e., no
color)
 White = all light (i.e., all
color)
 Primary colors =
 RED
 GREEN
 BLUE
From which we get RGB
 Used in computer monitors,
Color Model: RGB
 RGB stands for the primary
additive colors
 RED
 GREEN
 BLUE
 Has become a standard and
is often used in languages
and programs (i.e., HTML,
Flash)
 Each value given an integer
range from 0 to 255
 Can also be expressed as a
hexadecimal value
Subtractive Color Wheel
 Models how painted color
combines (since it is now
on the paper and
reflecting the light)
 White = no color (all
reflected)
 Black = all color (none
reflected)
 Traditional (artist’s
wheel) primary colors =
 RED
 YELLOW
 BLUE
OR…
Subtractive Color Wheel
 Printers (computer) use the
following primary colors =
 CYAN
 MAGENTA
 YELLOW
From which we get CMYK
(more detail later
 Subtractive color works
through light absorption
(what we see is the color not
absorbed)
 Magenta + Cyan = Blue
 Cyan + Yellow = Green
 Yellow + Magenta = Red
Color Harmony
• Certain combinations of colors tend
to be pleasing. They arise from the
color harmony schemes:
– Monochromatic
– Complementary
– Analogous
– Triadic
Color Harmony

Primary Colors Secondary colors Tertiary Colors


Color Harmony
Color Harmony Schemes
Primary colors 3 (Ps): Red, Yellow, Blue
– red, green and blue (Modern)
• Secondary colors 3(S’): obtained by
mixing two primary colors – orange,
green, violet
• Tertiary colors 6(Ts): obtained by mixing
equal amounts of a primary and
secondary color - red-violet, blue-violet,
blue-green, yellow-green, yellow-orange,
red-orange
• Warm (yellow, orange, red) or cool ( blue,
green) colors
Color Harmony Schemes
Color temperatures affect us both
psychologically and perceptually by
helping us determine how objects appear
positioned

• Warm (red, orange, yellow)

• cool ( green,blue and purple)


Color Harmony Schemes

• Neutrals: black, white, gray, tans, and


browns
Color Harmony Schemes
• Monochromatic
– all colors have hues that are the same
or within a few degrees of one another
– colors vary in saturation or brightness,
but hue is consistent
– enhances cohesiveness to overall
layout of web page
Color Harmony Schemes
Monochromatic Examples
Monochromatic Example
Color Harmony Schemes
• Complementary
– uses a pair of complementary hues,
which appear opposite one another on a
color wheel
– one color is dominant, the other is an
accent
– use the dominant hue to fill the large
areas
Complementary Example
Color Schemes
• Analogous
– two colors which lie close together on a
color wheel
– often echo the colors found in nature
– pleasing combinations ( such as
orange, yellow, green)
– more interesting if the colors do not
have the same brightness and
saturation
Color Harmony Schemes Analogous
Color Schemes
• Triadic
– Any 3 colors, spaced equally around a color
wheel
– Color hues form a triad
– Offers wide variety of choice and can create
excitement
– Can be overpowering unless colors chosen
vary in brightness and saturation, or the
number of text and background are limited
Color Schemes
- Triadic
Webpage Example
 The two screen shots
differ based on their
contrast…
 Analogous colors are
used
 As well as various
values and saturations

 How has the appeal


changed?
 How has the perception
of quality changed?
Selecting Your Color Scheme

Two Important Issues to


consider…
Message trying to send
Audience you are trying to reach
Webpage Example
 Which sells the most/least
expensive moods?
 Which would you feel most
comfortable from buying
from?
 If you were looking for
financial information,
which site would you be
most/least likely to use?
 The woman is telling you a
“secret.” In each case,
what do you think it might
be about?

(Source: Nolan, 2003)


Selecting Your Color Scheme
 Age Differences
 Younger children prefer brighter, more solid colors
 Adults prefer more subdued colors (i.e., light values/tints)
(e.g., pastels)
 Class Differences
 Working class prefer “named” colors: blue, red, green, etc.
 More “highly educated” class prefers obscure colors: taupe,
azure, mauve
 Gender
 Men tend to prefer cool colors (blues and greens)
 Women tend to prefer warm colors (reds and yellows)
 Seasonal issues
 Winter = blacks, whites, grays
 Spring = spring greens and bright colors
 Summer = yellows
 Fall = browns and golds
Selecting Your Color Scheme
 Cultural Issues
 Geography
 Warm climates = strong colors
 Cooler climates = cooler, “more washed out” colors
 Colors and their common connotations in Western
culture
 Cultural Examples (next slide)
Color Positive Negative
White Clean, innocent, pure Cold, empty, sterile

Red Strong, brave, passionate Dangerous, aggressive, domineering

Yellow Happy, friendly, optimistic Cowardly, annoying, brash

Green Natural, tranquil, relaxing Jealous, inexperienced, greedy

Brown Warm, earthy, mature Dirty, sad, cheap


Selecting Your Color Scheme –
Cultural Examples
Color Country: Meaning
China: color for young boys
Black
Western: funerals, death, bad guys, rebellion

Japan: white carnation symbolizes death


White Eastern: funerals
Western: brides, angels, good guys, hospitals, doctors, peace (white dove)

China: good luck, celebration, summoning


Cherokees: success, triumph
India: purity
Red South Africa: color of mourning
Russia: Bolsheviks and Communism
Eastern: Worn by brides
Western: excitement, danger, love, passion, stop
Ireland: Religious (Protestants)
Orange
Selecting Your Color Scheme –
Cultural Examples
Color Country: Meaning
China: nourishing
Egypt: color of mourning
Yellow Japan: courage
India: merchants
Western: hope, hazards, coward
China: green hats indicate a man’s wife is cheating on him, exorcism
India: Islam
Green
Ireland: <the whole country>
Western: spring, new birth, go, St. Patrick’s Day
Cherokees: defeat, trouble
Blue Iran: color of heaven and spirituality
Western: depression, sadness, conservative, corporate
Thailand: color of mourning (widows)
Purple
Western: royalty
Selecting Your Color Scheme
 Setting Moods
 Example: evidence suggests using
green in the workplace results in less
absenteeism through illness
 Univ. of Iowa coach painted visitors
locker room pink because research
shows that it reduces aggression
Webpage Example
 The two screen shots
differ based on their
“temperature”…
 Blue projects businesslike
and authoritative
 Explains use in many
business websites
 However, also cold,
conservative, and
unapproachable
 Addition of red and yellow
brings warmth and
dynamism
 Do you agree?
Selecting Your Color Scheme
 Using tools
 MS color palette
allows you to select
rows for
“harmonious” color
schemes
Conclusion
 Color Terms Color Wheel
 Hue Additive
 Saturation Subtractive
 Value Color Choices
 Color models Age
 HSV Class
 RGB Gender
 CMYK Season
Culture
Color Palettes
• Palettes or color look up tables (CLUT)
are mathematical tables that define the
color of a pixel displayed on the screen
• Paint programs provide a palette tools
for displaying available colors – not
uniform across programs or platforms
• Color graphics adaptors work with 256
shades of each color producing over 16
million colors (256 x 256x 256)
Color in Text and Background
• Text should be legible
• Contrast between text and background is
important
• Dark text on light background is best or one
with high brightness and low saturation
• Avoid combinations that differ only in their
blue component ( yellow on white)
• Avoid red-green, red-blue, magenta-green
combinations which cause vibration and
eye fatigue.
Color : Hex Codes
• Hex Codes used in web design

• Start with a hash mark (#)


• Consist of three pairs of characters
sequenced together (totaling of six
characters), with each pair
controlling one of the primary
additive colors (red, green, blue)
• Those six characters following the
hash mark consist of ten numerals
(0-9) and/ or six letters (a-f)
Color : Hex Codes
– 00 is a lack of primary
– ff is the primary at full strength
• To find additive colors, start with
black and change each pair to ff:

– #000000 is black (no primaries)


– #ff0000 is the brightest red
– #00ff00 is the brightest green
Color : Hex Codes
– 00 is a lack of primary
– ff is the primary at full strength
• To find subtractive colors, start
with white and change each pair to
00:

– #ffffff is white (all primaries


– #00ffff is the brightest cyan
– #ff00ff is the brightest magenta
https://www.usability.gov/how-to-and-tools/methods/color-basics.html
Palette Flashing Problem
• Palette Flashing occurs when you use a
series of images each with its own color
palette. When the new image replaces the
older one a flash occurs on the screen - a
serious problem in multimedia
• Solution
– use a single palette for all project images or
fade each image to white or black before
showing the next image since white and black
are present in most palettes
Dithering
• Dithering is a process where the color
value of each pixel is changes to the
closest matching color value in the target
palette, using a mathematical algorithm
• It “averages” the color over an area and is
usually close to the original color
• Dithering software is usually built into
image editing and multimedia programs
BITMAPPED IMAGES
Categories of bitmapped images are:
Line art
Produced using two colors.
Grayscale
Produced using shades of gray.
Color
Produced with patterns of colored pixels.

83
BITMAPPED IMAGES
Line art
Two colors, usually black and white.
Line art is
Advantages 1-bit color

Clear, crisp image.


Small file size.
Uses include:
Charts
Illustrations Line art flow chart
diagram
Diagrams.

84
BITMAPPED IMAGES
Grayscale
Generally 8-bit images of 256 shades of
gray
For images that require more detail than
line art.
Advantages
Excellent representation of black and
white photos
Smaller files size than full color
Lower printing costs than color. 85
BITMAPPED IMAGES
Color
Consists of a pattern of colored pixels
Bit depth: the number of bits used to
encode each pixel determines the
amount of color possibilities.
Photo-realistic color requires 24-bit color.
Two methods to create color on a
computer:
Identify a table of possible colors for the
computer (Color Lookup Table) 86
MAKING COMPUTER COLOR
8-bit color presents a specific range of
colors in a table.
PCs and Macs use different tables.
Web-safe table provides colors that
display
the same on all platforms.

24-bit color combines 8-bit values of


red, green, or blue to create the
result.
16.7 million color possibilities.

87
BITMAPPED IMAGE
QUALITY
Image quality depends on spatial and
color resolution.
Spatial resolution = density of pixels per
inch.
Color resolution = number of colors each
pixel can display.
Spatial resolution measurements.
Monitor output is measured in ppi (pixels
per inch).
Print output is measured as dpi (dots per
88
SPATIAL RESOLUTION
Higher spatial resolution
Captures more detail.
Pixels are smaller and closely
packed.
Produces sharper, more accurate
images.
Lower spatial resolution
Captures less detail.
Pixels are larger.
Images appear fuzzy.
High spatial resolutions yield large file sizes
but better image quality.
89
DEVICE-DEPENDENCE
Dimensions of an image depend on the
resolution of the output device.
Monitors have low spatial resolution:
72 ppi (Mac) or 96 ppi (PC).
Printers/phones/tablets have higher spatial
resolutions:
300 dpi to 2400 dpi.
Bitmapped images are device-dependent.
300 ppi image prints the original size
on 300 dpi printer.
Same image is greatly enlarged on a
72 ppi monitor.
90
COLOR RESOLUTION
Bit-depth determines color resolution.
Making the bit-depth choice:
Simple color images do not require
many colors. Low bit-depth yields small file size.
Complex color images require millions of
colors. High bit-depth yields better quality
but larger files.
Low color resolution may cause quantization
and color banding.
Quantization leads to breaks
in shades of continuous tone images.
91
COLOR RESOLUTION
Indexing
A specific palette of colors is identified to
optimize the appearance of lower color
resolution image.
Dithering
Combining pixels of different colors to produc
another color not available in the indexed
palette.
Improves image quality without increasing bit
depth.

92
Image File Formats
• MAC has a single standard format PICT
• Windows uses device independent bitmaps
DIBs written as .bmp files, which is a
windows bitmap file
• TIFF ( tagged interchange file formats) are
universal bitmap files – used in desktop
publishing
• Adobe creates .psd files for photoshop
• See pp. 150-151 for other formats
BITMAPPED FILE FORMATS
Compression of bitmapped graphics are:
Lossy
Lossless.
Common graphic file formats are:
PICT
BMP
TIFF
What form of
JPEG compression do
each of these
GIF formats use?
PNG

94
BMP vs GIF

95
GIF vs JPEG

96
JPEG vs GIF

97
PNG vs GIF

98
SVG Scalable Vector Graphic

99
VECTOR-DRAWN GRAPHICS
Vector: a line with length, curvature, and
direction.
Vector graphics: images created from
mathematically defined shapes.
Draw programs: software used to create
vector graphics.
Main advantages:
Images can be enlarged without distortion
Small file size.

100
How vector drawn images work
A vector is a line that is described by the
location of its two endpoints.
Vector drawing makes use of Cartesian
coordinates.
Cartesian coordinates are numbers that
describe a point in two or three dimensional
space as the intersection of the X, Y, and Z
axes.

L1 [ <0,0,0>, <10,3,6>

101
DEVICE INDEPENDENCE
Vector graphics can be used with
different devices without altering the
image dimension.
Printers and monitors preserve the
original dimension of the image.

102
ADVANTAGES
BITMAPPED IMAGES VECTOR IMAGES

Full-featured photo Smooth scaling


editing. and reshaping.
Wide range of Ease of editing
artistic effects. objects in layers.
Precise editing. Low file size.
Device-
independent.
103
DISADVANTAGES
BITMAPPED IMAGES VECTOR IMAGES

Large file sizes. Inaccurate,


Loss of precise incomplete
shapes when representation of
scaled or rotated. complex contone
images.
Device-dependent.
No photo-editing
capability.
Limited artistic
control. 104
Making Still Images
• Stills are drawn in one of two
ways and are usually compressed
 Bitmaps
 Vector-drawn graphics
Bitmaps
• Bitmap is derived from the words
‘bit’, which means the simplest
element in which only two digits are
used, and ‘map’, which is a two-
dimensional matrix of these bits.
• A bitmap is a data matrix describing
the individual dots of an image.
BITMAPS
• A simple information matrix
describing the dots or pixels which
make up the image
• Make it with paint or drawing
program
• Grab it and (save it) then paste it into
you application
• Scan or digitize an image
Bitmaps
Bitmaps are an image format suited for
creation of:
– Photo-realistic images.
– Complex drawings.
– Images that require fine detail.
Bitmaps
• Bitmapped images are known as
paint graphics.
• A bitmap is made up of individual
dots or picture elements known as
pixels or pels.
• Bitmapped images can have varying
bit and color depths.
Bitmaps

Available binary Combinations for Describing a Color


Bitmaps
Bitmaps can be inserted by:
– Using clip art galleries.
– Using bitmap software.
– Capturing and editing images.
– Scanning images.
Bitmap Example
• Clipart
Clip Art
• Available from many sources on the
web or on CD ( such as PHOTODISC)
• Often included with packages such
as Corel Draw, Office, etc.
• Can manipulate some properties
such as brightness, color, size
• Can paste it into an application
Clip Art Galleries
• A clip art gallery is an assortment of
graphics, photographs, sound, and
video.
• Clip arts are a popular alternative for
users who do not want to create their
own images.
• Clip arts are available on CD-ROMs
and on the Internet.
Bitmaps
• Clipart
• Bitmap Software
Using Bitmap Software
The industry standard for bitmap
painting and editing programs are:
• Adobe's Photoshop and Illustrator.
• Macromedia's Fireworks.
• Corel's Painter.
• CorelDraw.
• Quark Express.
Bitmap Software
• Primitive Paint programs included with
windows and MAC
• Director included a powerful image editor
with advanced tools such as onion-skin
and image filtering
• Adobe Photoshop and Fractal Design’s
Painter are more sophisticated painting
and editing tools
Tip
• Use paint program for cartoon, text,
icons, symbols, buttons, or graphics.

• For photo-realistic images first scan


a picture, then use a paint or image
editing program to refine or modify
them
Bitmaps
• Clipart
• Bitmap software
• Capturing
• Scanning
Capturing and Editing Images
• Capturing and storing images directly
from the screen is another way to
assemble images for multimedia.
• The PRINT SCREEN button in Windows
and COMMAND-CONTROL-SHIFT-4
keystroke on the Macintosh copies the
screen image to the clipboard.
• From there you can insert it into a paint
program or other application.
Advanced Image Editing
• Image editing programs allow you to
insert and remove images from
photos
• Enable you to alter and distort
images, add and delete elements
• Morphing blends two images so that
one seems to “melt” into the other
Scanning Images
• Everyday objects can be scanned
and manipulated using tools such as
Photoshop
• Traditional artwork created with pen
and ink or watercolors can be
created and scanned
Vector Drawings
• Vector graphics are defined using
formulas
– RECT 0,0,200,200,RED,BLUE
Vector Drawing
• Used for lines, rectangles, geometric
objects- stored mathematically
• CAD ( computed aided design) programs
created complex and geometric
renderings needed by architects and
engineers
• Graphic artists use vector graphics to
eliminate the “jaggies”
• Programs for 3-D animation use vector
graphics for rotation,spinning and
shading
How Vector Drawing Works
• Vector drawn object are drawn to the
computer screen using a fraction of the
memory space required by a bitmap.
• A vector is a line described by its endpoints,
and sometimes direction
• A rectangle might be described as:
– RECT, 0, 0,200, 200
– Starts at 0,0 and extends 200 pixels horizontally
and 200 pixels downward from the corner ( a
square)
– RECT, 0, 0,200, 200, red, blue
– This is the same square with a red border filled
with blue
Vector- Drawn vs. Bitmaps
• Colored square as a vector contains < 30
bytes of data
• The same square as a bitmapped image
would take 5,000 bytes to describe (
200x200)/8) and using 256 colors would
require 40K as a bitmap
((200x 200) / 8 X 8)
• Vector objects are easily scalable
• Sometimes a single bitmap gives better
performance than many vector images
required to make the same image
Converting Between
Bitmaps and Vectors
• Most drawing programs offer several file
formats for saving and converting images.
• Converting bitmaps to drawn object is
more difficult and is called autotracing
• It computes the bounds of an object and
its colors and derives the polygon that
most nearly describes it
• It is available in some programs such as
Adobe Streamline, illustrator etc
Vectors vs. Bitmaps
–Vector drawings are easily
scaled
–Vector files are usually smaller
–Calculation time can draw
resources
–Bitmaps cannot easily be
converted to vector
–Vector drawings require plug-ins
3-D Drawing and Rendering
• Drawing in 3-D onto 2-D surface or screen
takes practice and skill
• Software helps to render ( or represent)
the image in visual form- but these
programs have a steep learning curve.
• Object in 3-D space carry many properties,
shape color, texture, location… and a
scene often contains many objects
3-D Drawing
• 3-D software usually offers:
Directional lighting
Motion
Different perspectives
3-D Drawing
• 3-D creation tools include:
Ray Dream Designer
Caligari True Space 2
Specular Infini-D
form*Z
3-D Drawing

3-D objects
combine
various shapes
Modeling 3-D objects
• Start with a shape ( block, cylinder,
sphere, …)
• You can draw a 2-D object and extrude or
lathe it into the third dimension
• Extrude – extends the shape
perpendicular to the shapes outline
• A lathed shape is rotated around a defined
axis to create the 3-D object.
Modeling 3-D objects

Shapes can be
extruded…
Modeling 3-D objects

…or lathed
Modeling 3-D objects
• Once a 3-D object has been created,
you can apply color and texture to
make it look realistic
• To model a scene, place all the
objects into 3-D space and set up
lighting effects and shadows.
• Objects will reflect or flare where
light is most intense.
Modeling 3-D objects
• Add a background or set a camera view
from which you will view the scene
• Shading can be applied in many ways (
See p. 304)
• Finally, the scene must be rendered- using
the algorithms to apply the effects you
have specified on the objects
• Rendering requires great computer power
and can often take hours for a single
image
• Toy Story were rendered on a “farm” of 87 dual processor and 30 quad-
processor 100 MHz SPARCstation 20s. It took 46 days of continuous
processing to render that film’s 110,000 frames at a rate of about one
frame every one to three hours.
Modeling 3-D objects

Gouraud
Flat
shading
shading

Ray Phong
tracing shading

A scene can use different types of shading


COMP 319 Oct. 30, 2014

Introduction to
Multimedia Computing
p g
Fiona Yan Liu
Department of Computing
The Hong Kong Polytechnic University
Learning Outputs of Lecture 06
Learning Outputs of Lecture 06
 Lossy compression
 Lossy compression definition
 Distortion measure
 The rate‐distortion theory
 Quantization
 Uniform scale quantization
 Nonuniform
N if scale quantization
l ti ti
 Transform coding
 1D Discrete Cosine Transform
 Compression scheme for 1D DCT
Compression scheme for 1D DCT
 2D Discrete Cosine Transform
 Compression scheme for 2D DCT

 Reference reading
Reference reading
 Chapter 8

Lecture 07: Image Data Compression 2
Outline of Lecture 07
Outline of Lecture 07
 Image compression standard JPEG
 Block diagram for JPEG encode
 Transform RGB color model to YUV or YIQ
 DCT coding for image block
 Uniform scalar quantization
 ZigZag scan for quantized DCT coefficients
 DPCM for DC coefficients
DPCM f DC ffi i t
 RLC for AC coefficients
 Entropy coding
Entropy coding
 JPEG file generation

Lecture 07: Image Data Compression 3
Image Compression Standard JPEG
Image Compression Standard JPEG
 JPEG is an image compression standard that was 
JPEG i i i d d h
developed by the “Joint Photographic Experts Group” 
 JPEG was formally accepted as an international
JPEG was formally accepted as an international 
standard in 1992
 JPEG combines several lossless and lossy compression
JPEG combines several lossless and lossy compression 
techniques
 Transform codingg
 Quantization
 DPCM
 Run‐length coding
 Entropy coding

Lecture 07: Image Data Compression 4
Block Diagram for JPEG Encode
Block Diagram for JPEG Encode

Lecture 07: Image Data Compression 5
JPEG: Transform RGB Color Model 
to YUV or YIQ

Lecture 07: Image Data Compression 6
Transform RGB Color Model to 
YUV or YIQ
 Motivation 
M i i
 Partition the image data based on the visual acuity

 Visual acuity is the accuracy in distinguishing closely spaced lines
y y g g y p
 Human’s visual acuity is much greater for gray than for color

 YUV color model
 Y: luminance information
Y l i i f ti
 U and V: chrominance information

 YIQ color model
Q
 Y in YIQ is the same as in YUV

 I and Q are a rotated version of U and V

 R f
Reference reading
di
 Lecture 2

Lecture 07: Image Data Compression 7
JPEG: DCT Coding for Image Block
JPEG: DCT Coding for Image Block

Lecture 07: Image Data Compression 8
Compression Scheme of 2D DCT 
for Image Data
 S ti l f
Spatial frequency
 Indicates how many times pixel values change across an 
image block
 The DCT formalizes spatial frequency
 With a measure of how much the image contents change in 
p y p
correspondence to the number of cycles of a cosine wave per 
block
 Motivation of DCT
 Spatial redundancy of the image
Spatial redundancy of the image
 Useful image contents change relatively slowly
 DCT can concentrate the information within first several 
components
 Humans are not sensitive to the loss of information of high 
spatial frequency

Lecture 07: Image Data Compression 9
DCT Coding for Image Block
DCT Coding for Image Block
 P ii
Partition the image to the blocks of 8 pixels * 8 pixels
h i h bl k f 8 i l * 8 i l
 2D DCT for each block in encoding part

 2D IDCT for each block in decoding part

 Reference reading
 Lecture 5

Lecture 07: Image Data Compression 10
JPEG: Uniform Scalar Quantization
JPEG: Uniform Scalar Quantization

Lecture 07: Image Data Compression 11
Uniform Scalar Quantization
Uniform Scalar Quantization
 M i i
Motivation
 Yield higher compression ratio
 Main source for compression in JPEG
Main source for compression in JPEG 
 Quantize DCT coefficients
F (u, v)
Fˆ (u, v)  round ( )
Q(u , v)
 F(u,v) represents a DCT coefficients
 Q(u,v) is a “quantization table" entry
 Fˆ (u, v) represents the quantized DCT coefficients
 Reference reading
Reference reading
 Lecture 5

Lecture 07: Image Data Compression 12
Quantization Table
Quantization Table
 Use different quantization tables for luminance 
U diff t ti ti t bl f l i
information and chrominance information
 The entries of Q(u,v) tend to have larger values
The entries of Q(u,v) tend to have larger values 
towards the lower right corner

The Luminance Quantization Table The Chrominance Quantization Table

Lecture 07: Image Data Compression 13
JPEG: ZigZag Scan
JPEG: ZigZag Scan

Lecture 07: Image Data Compression 14
Zig‐Zag Scan for Quantized DCT 
Coefficients
 Zig‐Zag scan

Zigzag scan result:


(32, 6,-1,-1,0 –1,0,0,0,-1,0,0,1,0,0… … 0)

Lecture 07: Image Data Compression 15
JPEG: DPCM for DC Coefficients
JPEG: DPCM for DC Coefficients

Lecture 07: Image Data Compression 16
DPCM for DC Coefficients
DPCM for DC Coefficients
 Q
Quantized DCT coefficients
ti d DCT ffi i t
 Direct current (DC) coefficient ~ F(0,0)
 Alternate current (AC) coefficient
te ate cu e t ( C) coe c e t ~ other F(u,v)
ot e (u, )
 The DC coefficients are coded separately from the AC ones.
 Differential Pulse Code Modulation 
 DPCM is the coding method for DC coefficients
 Example of encoding DC coefficients 
 DC coefficients for the first 5 image blocks:  150,155, 149, 
DC coefficients for the first 5 image blocks: 150 155 149
152, 144
 Coding result: 150, 5, ‐6, 3, ‐8
 R f
Reference reading
di
 Lecture 3

Lecture 07: Image Data Compression 17
JPEG: RLC for AC Coefficients
JPEG: RLC for AC Coefficients

Lecture 07: Image Data Compression 18
RLC for AC Coefficients
RLC for AC Coefficients
 Zig Zag Scan
Zig‐Zag

Zigzag scan result


(32, 6,-1,-1,0 –1,0,0,0,-1,0,0,1,0,0… … 0)
Modified Run-Length coding result
 Reference reading (0,6)(0,-1)(0,-1)(1,-1)(3,-1)(2,1)(0,0)
 Lecture 3

Lecture 07: Image Data Compression 19
JPEG: Entropy Coding
JPEG: Entropy Coding

Lecture 07: Image Data Compression 20
Entropy Coding
Entropy Coding
 The DC and AC coefficients finally undergo an entropy 
Th DC d AC ffi i fi ll d
coding step to gain a possible further compression
 Each DPCM coded DC coefficient is represented by
Each DPCM coded DC coefficient is represented by 
(SIZE, AMPLITUDE)
 Each RLC coded AC coefficient (RUNLENGTH VALUE)
Each RLC coded AC coefficient (RUNLENGTH, VALUE) 
is represented by (RUNLENGTH, SIZE, AMPLITUDE)
 SIZE is Huffman coded
SIZE is Huffman coded 
 AMPLITUDE and RUNLENGTH use actual values
 Reference reading
Reference reading
 Lecture 4

Lecture 07: Image Data Compression 21
Entropy Coding for DPCM Coded DC 
Coefficient
 SIZE indicates how many bits are needed for 
SIZE i di t h bit d df
representing the coefficient
 AMPLITUDE contains the actual bits.
AMPLITUDE contains the actual bits.
 Example of DPCM coded dc coefficients
 150, 5, −6, 3, −8 
 (8, 10010110), (3, 101), (3, 001), (2, 11), (4, 0111) .

Lecture 07: Image Data Compression 22
JPEG File Generation
JPEG File Generation

Lecture 07: Image Data Compression 23

You might also like