Computers and Imaging Telecommunications 1 P. Mathys Two Different Methods Vector or object-oriented graphics. Images are generated by mathematical descriptions of line (vector) segments. Bitmap or raster graphics. Images are made up of individual dots or pixels which are arranged in rows and columns. Vector Graphics: Example Outline of letter S specified by points that are connected using Bézier cubic spline curves. The letter S as it is printed after filling the outline specified on the left. Bitmap Graphics: Example The letter S is placed on a grid of pixels, each of which can be black or white. The letter S as it is printed, without the grid itself being visible. Vector Graphics: Resizing Original size Enlarged by factor of 2 Enlarged by factor of 4 Resizing works well, but requires substantial computational resources. Bitmap Graphics: Resizing Original size Enlarged by factor of 2 Enlarged by factor of 4 Resizing is problematic due to spatial quantization effect of underlying grid.
12

# Vector object-oriented graphics Computers and Imagingmathys/ecen1200/imaging/imaging2006_6pp.pdfVector graphics are well suited for graphs, e.g., in spreadsheets, and for scalable

Sep 22, 2020

## Documents

dariahiddleston
Welcome message from author
Transcript

Computers and Imaging

Telecommunications 1P. Mathys

Two Different Methods

Vector or object-oriented graphics. Images are generated by mathematical descriptions of line (vector) segments.Bitmap or raster graphics. Images are made up of individual dots or pixels which are arranged in rows and columns.

Vector Graphics: Example

Outline of letter Sspecified by pointsthat are connectedusing Bézier cubicspline curves.

The letter Sas it is printedafter filling theoutline specifiedon the left.

Bitmap Graphics: Example

The letter Sis placed on

a grid of pixels,each of whichcan be blackor white.

The letter Sas it is printed,without the griditself being visible.

Vector Graphics: Resizing

Originalsize

Enlarged byfactor of 2

Enlarged byfactor of 4

Resizing works well, but requires substantial computational resources.

Bitmap Graphics: Resizing

Originalsize

Enlarged byfactor of 2

Enlarged byfactor of 4

Resizing is problematic due to spatial quantization effect of underlying grid.

Vector Graphics

Good for storing images composed of lines, circles and polygons, or images that can be decomposed into simple geometrical objects.Can be easily rescaled and rotated.Cannot easily accommodate very complex images, such as photographs where color information may vary from pixel to pixel.

Bitmap Graphics

Are easy to edit in memory and display on TV monitors due to the arrangement of the pixels in a rectangular array.Pixel values can be modified individually.Uncompressed images can become very large and require a lot of memory.Resizing and rotation do not work very well and may distort the image significantly.

Bitmap versus Vector Graphics

Vector graphics are well suited for graphs, e.g., in spreadsheets, and for scalable fonts, e.g., PostScript or TrueType fonts.Bitmap graphics are used for general purpose images and, in particular, photographs.On the WWW, bitmap graphics are by far the most popular and we will concentrate on them in the following slides.

Bitmap Black and White Image

Suppose we want to draw a B&W image on a computer screen.We first subdivide the screen into small rectangles or squares called pixels.A typical TV screen has about 300x400 = 120,000 pixels.A high resolution Computer monitor has about 1000x1300 = 1,300,000 pixels.

Screen with 9x13 = 117 Pixels

0 1

0

1

2

3

4

5

6 (1,6)

2 3 4 5 6 7 8 9 10 11 12

7

8

y

x

Pixels(x,y)

(4,8)

Black and White Image

To draw a B&W image, we paint some of the pixels black and leave the rest white.For instance, the letter “A” in its simplest form, would look like this:

Black and White Image

To make more fancy letters, we have to use more pixels as shown by the following “improved” letter A:

What can m Bits Describe?

In general, if we have m bits, we can represent

different objects.Examples:

n m= 2

2 1 2 2 2 4 2 8 2 160 1 2 3 4= = = = =, , , ,

Powers of 2

Each additional bit doubles the number of objects that can be described.Suppose now we have n objects. How many bits do we need to describe them?The answer is m bits, where m is equal to x rounded up to the nearest integer, and

x = log(n)/log(2)

Colors

Humans can distinguish about 10,000 colors simultaneously, but many more colors can be perceived, although not simultaneously.A “truecolor” display or printer uses 24 bits per pixel, corresponding to 16.8 million (2^24=16,777,216) different colors.The most common bitmap formats use either 1,4,8,16, or 24 bits per pixel.

Used for TV and Computer Displays

(Almost) all colorscan be generated bycombining light fromred (R), green (G) andblue (B) sources withthe “right” intensities.For example, addingR and G in equalamounts results inyellow, and adding R,G, and B in equalamounts results inwhite.

Subtractive (CMY) Colors

Used in Photography and Printing

Starting from whitelight, we can use ayellow (Y) filter toremove blue, a cyan(C) filter to removered, and a magenta(M) filter to removegreen. In this wayalso (almost) allpossible colors can begenerated.

Subtractive (CMY) Colors

White consists of equal amounts of red, blue and green, i.e., W = R+G+B.

Cyan filter blocks red:W-R = R+G+B-R = G+B = C

Magenta filter blocks green:W-G = R+G+B-G = R+B = M

Yellow filter blocks blue:W-B = R+G+B-B = R+G = Y

Colors are described in the form of 3 numbers, e.g., (20,235,109), where the first number is the amount of red (R), the second is the amount of green (G), and the third is the amount of blue (B). Examples (in hex):

(Almost) all visible colors can be made up from red, green, and blue components in the “right” proportions.If we use 8 bits for each, R, G, and B, then we can represent 2^24=16.7 Mio colors.The values of R, G, and B are then in the range 0..255 each. Black is (0,0,0), white is (255,255,255). In between, e.g., (128,128,128) lies gray.

Photographic Image (R,G,B)

R

G

B

R,G,B Components Photographic Image (C,M,Y)

C

M

Y

C,M,Y Components Complementary Colors

Suppose a specific color X is represented byX = (R,G,B)

where R, G, B each take on values 0…255.Then the complementary color C(X) is

C(X) = W-X = (255-R,255-G,255-B)

Examples:• Red = (255,0,0) ==> C(Red) = (0,255,255) = Cyan• Green = (0,255,0) => C(Green) = (255,0,255) = Magenta• Blue = (0,0,255) ==> C(Blue) = (255,255,0) = Yellow

True Color (24 bits/pixel)

This image has about 50,000 different colors.

Using Fewer Bits per Pixel

To use fewer bits per pixel, the number of different colors must generally be reduced.If 8 bits or less are used per pixel, then the colors are usually defined in a palette.A palette is a mapping from an index (e.g. 0..255) to a 24-bit (R,G,B) value that is used to display the image. The palette must be stored in a file together with the image.

256 Color Palette, Optimized

<-- Original

256 Color Palette, Windows

<-- Original

16 Color Palette, Windows

<-- Original

2 Color Palette

<-- Original

Use of Palettes

GIF files always use palettes with a maximum of 256 distinct colors.JPEG files do not use palettes.BMP files may or may not use palettes. When they use palettes, the maximum number of colors is 256.The quality of photographic images is usually degraded when palettes are used.

Different Wavelengths

C.I.E.

CommitteeInternationalD’Eclairage

RGB Color Model

HSV Color Model

HueSaturationValue

By adjusting the amounts of R, G, and B present in a pixel, most of the visible colors can be produced.Because there are 3 color components, we cannot show all possibilities in a 2-dimensional graph.The following slides show mixtures of any 2 color components (the third component is fixed at zero).

Mixing Red and Green (B=0)

255

255

204

204

153

153

102

102

51

51

0

0

Mixing Red and Blue (G=0)

255204153102510

255

204

153

102

51

0

Mixing Blue and Green (R=0)

255204153102510

255

204

153

102

51

0

Color Hue, Saturation, Value

The R,G,B color model is not always the most convenient to describe the coloring of a pixel.Often it is more appropriate to talk about the more intuitive quantities color hue (H), color saturation (S), and brightness value (V). The result is the H,S,V model.

Color Hue

Color hue corresponds to the average spectral wavelength of a color. The convention is to use an angle between 0 and 360 degrees (measured counterclockwise).Examples:Red: 0 deg. Yellow: 60 deg.Green: 120 deg. Cyan: 180 deg.Blue: 240 deg. Magenta: 300 deg.

Color Hue from R,G,B

Compute intermediate quantities I, Q asI = R - G/2 - B/2, Q = sqrt(3)*(G-B)/2

Then compute H in degrees as (atanis inverse tangent)H = (180/pi)*atan(Q/I)

If I<0 and Q>0 add 180 to HIf I<0 and Q<0 subtract 180 from H

Color Saturation, Value

Color saturation is a measure for the purity of a color. Mathematically, the saturation S is defined as

max{R,G,B} - min{R,G,B}S = ---------------------------------

max{R,G,B}Value is a measure for brightness, defined byV = max{R,G,B}/255

(RGB) => (HSV) Example

(RGB) = “#6495ED” (in hex)Hex => decimal: 64,95,ED => 100,149,237I = 100-149/2-237/2 = -93Q = (sqrt(3)/2)*(149-237) = -76.2atan(-76.2/-93) = 39.3 degH = 39.3-180 = -140.7 degS = (237-100)/237 = 0.58, V = 237/255 = 0.93(HSV) = (-141 deg, 0.58, 0.93)

Color Hue, Saturation (V=255)

Hue

Saturation

YUV Model

The YUV model defines a color space in terms of a luminance (Y), and two chrominance (U,V) components. Here• Luminance: Y = 0.30*R + 0.59*G + 0.11*B,• Chrominance (blue): U = 0.49*(B-Y),• Chrominance (red): V = 0.88*(R-Y).

Used for TV (PAL and NTSC).MPEG files can also use this model for (lossy) data compression.

Y,Cb,Cr Model

A similar model, that was originally developed for color TV (and compatibility with black and white TV), is the luminance (Y), and chrominance (Cb,Cr) model. For HDTV and computer displays• Luminance: Y = 0.21*R + 0.72*G + 0.07*B,• Chrominance (blue): Cb = 0.54*(B-Y),• Chrominance (red): Cr = 0.64*(R-Y).

Older monitors use slightly different constants. JPEG and MPEG use (slight variants of) this model for lossy data compression.

Image Processing, Enhancement

By varying specific components in the R,G,B model, and/or in the H,S,V model, and/or in the Y,Cb,Cr model, images can be enhanced or modified. Examples include:• Contrast reduction/enhancement,• Brightness and gamma correction,• Color component/hue/saturation correction,• Image filtering (blur/sharpen).

The following slides show some examples.

Original Image Contrast Reduced

Note: Horizontal axis shows input in range0...1, vertical axis shows correspondingoutput in range 0…1 for Y and R,G,B.

Luminance Increased

What is shown here is a linear increase in bright-ness that affects dark pixels (value near 0) bythe same amount as bright pixels (value near 1).

Luminance Decreased

What is shown here is a linear decrease in bright-ness that affects dark pixels (value near 0) bythe same amount as bright pixels (value near 1).

Contrast Increased

This makes bright pixels brighter and dark pixelsdarker. Note the non-linearity (where the curvesgo flat) which arises because output values >1 and<0 are not possible.

Gamma Correction

This is a non-linear brightness correction thatincreases the brightness of dark pixels more thanof those pixels which are already bright. Thisusually works best to brighten a dark image.

Decrease in Color Saturation

Hue and brightness value (V) are not affected bythis. A reduction in color saturation just changesthe image towards a black and white image.

Color Hue Change: +45 deg.

Originally, red (R) is at 0 degrees. Changing thehue by +45 degrees moves red towards yellow,green towards cyan and blue towards purple.

Color Hue Change: -30 deg.

Originally, red (R) is at 0 degrees. Changing thehue by -30 degrees moves red towards purple,green towards yellow and blue towards cyan.

Max. Increase in Value (V)

Because V=max{R,G,B}, only one color componentneeds to be pushed to the maximum, and colorhue and saturation are preserved.

Max. Increase in Luminance (Y)

Because Y=0.3*R+0.59*G+0.11*B, all three colorcomponents need to be pushed to the maximumand the image becomes nearly white.

To find out, we make one half of the full brightness in 2 ways (shown here for gray):(a) We set (R,G,B)=(0.5,0.5,0.5).(b) We make a checkerboard pattern with equal areas

of pure white and pure black.

If brightness differs, display is non-linear.

Is the Display Linear?

Enlarged Test Pattern

For a linear displaycharacteristic the grayframe with

(R,G,B) = (0.5,0.5,0.5)should appear to have thesame brightness as thepure white/black checker-board pattern.

Gamma Correction

A TV display has characteristic

where y is the input and z is the output of the display.Gamma correction uses

where x is the input and y is the output of the correction.

γyz =

γ/1xy =

x

x

y

y

Chart to Determine Gamma Resolution

Do our eyes have the sameresolution for the red, greenand blue color components?

No! The resolution is bestfor green and worst for blue.

<-- Resolution chart in GIFformat.

The JPEG image formatmakes use of our inabilityto distinguish fine detailsin the red and blue colorcomponents to compressthe image data. The R andB components are low-passfiltered (and the excessivedata is thrown away) whenan image is converted toJPEG format.

<-- Resolution chart in JPEGformat.

Related Documents
##### Motivation When we do word processing, graphics,...
Category: Documents
Category: Documents
Category: Technology
Category: Data & Analytics
##### AC 2007-397: USE OF SPREADSHEETS WITH …€¦ · Use of...
Category: Documents
##### 3D Graphics with Spreadsheets - Scholastica · 3D Graphics....
Category: Documents