Computer graphics

Post on 06-May-2015

691 views 0 download

description

Computer Graphics for Begginers

Transcript of Computer graphics

Raster Images

Picture is made up of small cells called pixels

Stored in computer memory as array of numeral values called pixel map or bitmap

Raster images are created suing Hand designed images Computed images (Mathematical

model of a scene) Scanned images (support scaling)

Gray scale raster images

Pixel dept (memory required /pixel)

n-bit memory generates 2n color values

Effect of pixel dept Quality of image

Avoid color banding

Size of image

Color Raster images

Three numeral value for each pixel

3-bytes true colors

Flat Panel Displays

Emissive Flat screen CRT

Plasma

LCD with backlight

Non-Emissive LCD

Display technologies Cathode Ray Tubes

(CRTs) Most common

display device today. Evacuated glass

bottle Extremely high

voltage Heating element

(filament) Electrons pulled

towards anode focusing cylinder

Vertical and horizontal deflection plates

Beam strikes phosphor coating on front of tube

CRT

Electron gun Contains a filament that, when heated, emits a stream of

electrons

Electrons are focused with an electromagnet into a sharp beam and directed to a specific point of the face of the picture tube

The front surface of the picture tube is coated with small phosphor dots

When the beam hits a phosphor dot it glows with a brightness proportional to the strength of the beam and how long it is hit

CRT characteristics What’s the largest (diagonal) CRT you’ve

seen? Why is that the largest?

Evacuated tube == massive glass Symmetrical electron paths (corners vs. center)

How might one measure CRT capabilities? Size of tube Brightness of phosphers vs. darkness of tube Speed of electron gun Width of electron beam Pixels?

Random Scan Display (Vector Displays) Early computer displays, Control X,Y with

vertical/horizontal plate voltage Often used intensity as Z (close things

were brighter)

Name two disadvantages

Just does wireframe

Complex scenes cause visible flicker

Vector Display draws a set of lines in any order

Vector Scanning

Vector Displays

How to generate an image using vectors A line is represented by endpoints (10,10) to

(90,90) The points along the line are computed using a

line equationy = mx + b

If you want the image larger, no problem…

Raster Displays

Raster: A rectangular array of points or dots

Pixel: One dot or picture element of the raster

Scan line: A row of pixels

Raster Displays

Black and white television: A fixed scan pattern: left to right, top to bottom As beam sweeps across entire face of CRT, beam

intensity changes to reflect brightness

Must synchronize Your program makes decisions about the intensity

signal at the pace of the CPU… The screen is “painted” at the pace of the electron

gun scanning the raster Solution: special memory to buffer image with scan-

out synchronous to the raster. We call this the frame buffer.

Raster-scan display systemdraws a discrete set of points

Line Generation on Raster Display How to generate a line using rasters

A line is represented by assigning some pixels a value of 1

The entire line is specified by the pixel valuesWhat do we do to make image larger?

Phosphers

Fluorescence Light emitted while the phosphor is being

struck by electrons()

Phosphorescence Light emitted once the electron beam is

removed

Persistence The time from the removal of the excitation to

the moment when phosphorescence has decayed to 10% of the initial light output

Refresh

Frame must be “refreshed” to draw new images

As new pixels are struck by electron beam, others are decaying

Electron beam must hit all pixels frequently to eliminate flicker

Critical fusion frequency Typically 60 times/sec Varies with intensity, individuals, phospher

persistence, lighting...

CRT Timing

Color CRT

Color CRTs are much more complicated Requires manufacturing very precise geometry Uses a pattern of color phosphors on the screen:

Why red, green, and blue phosphors?

Delta electron gun arrangement In-line electron gun arrangement

Color CRT Color CRTs have

Three electron guns

Beam penetration and shadow mask methods

A metal shadow mask to differentiate the beams

CRT

Raster CRT pros: Allows solids, not just wireframes Leverages low-cost CRT technology (i.e., TVs) Bright! Display emits light

Cons: Requires screen-size memory array Discrete sampling (pixels) Practical limit on size (call it 40 inches) Bulky

CRTs – A Review

CRT technology hasn’t changed much in 50 years Early television technology

high resolution requires synchronization between video signal and electron

beam vertical sync pulse

Early computer displays avoided synchronization using ‘vector’ algorithm flicker and refresh were problematic

CRTs – A Review

Raster Displays (early 70s) like television, scan all pixels in regular pattern use frame buffer (video RAM) to eliminate sync

problems RAM

¼ MB (256 KB) cost $2 million in 1971 Do some math…

- 1280 x 1024 screen resolution = 1,310,720 pixels

- Monochrome color (binary) requires 160 KB- High resolution color requires 5.2 MB

Liquid Crystal Displays (LCDs)

LCDs: organic molecules, naturally in crystalline state, that liquefy when excited by heat or Electric field

Crystalline state twists polarized light 90º.

Polarizer

A wire-grid polarizer converts an unpolarized beam into one with a single linear polarization. Red arrows depict the electric field vector.

Liquid Crystal Display (LCD)

Liquid Crystal Displays (LCDs)

Display Technology: Plasma

Plasma display panels Similar in principle to

fluorescent light tubes

Small gas-filled capsules are excited by electric field,emits UV light

UV excites phosphor

Phosphor relaxes, emits some other color

Plasma Display

Thin Film Electroluminescent Display Same as plasma display

Has phosphor coating instead of gas

High voltage applied on phosphor

Require more power

Good colors are hard to generate

Another emissive display is LED

Direct View Storage Tube (DVST) Instead of refreshing screen, it Keeps information inside CRT

Picture information is stored as charge distribution behind the phosphorous screen

Two electron guns are used in DVST, the primary gun and flood gun

Primary helps is storing picture patterns and flood gun maintain picture display

No refresh requires, can display complex high resolution picture without flicker

Usually doesn’t display colors

Part of a picture can’t be refreshed (redrawn)

Erasing old picture and redrawing modified picture could take seconds

No replaced by raster displays

Raster Scan System

Special purpose processor called video/display controller used to control operations of display

Video controller accesses frame buffer from system memory

Some systems also use graphics/display processor to relieve CPU of core graphic activities

Frame buffer locations and corresponding screen positions are referenced in Cartesian coordinates

Coordinate origin is decided

Raster Scan System

Architedure of a simple raster graphics system.

Architecture of a raster system with a fixed portion of the systemmemory reserved for the frame buffer.

Raster Scan System

intensity

Basic video-controller refresh operations

The origin of the coordinatesystem for identifying screenpositions is usually specifiedin the lower-left corner.

Raster Scan System

High quality system provides two frame buffers

Video controller also transform screen

Some video controllers use lookup tables (color palets) and frame buffer values are indexed into it to retrieve intensities

Some controllers allows mixing frame buffer’s image with camera picture

Raster Scan Display Processor

Architecture of a raster-graphics system with a display processor.

Raster Scan Display ProcessorDisplay processors scan convert, lines, curves and other

objects into intensity values

Characters are specified by rectangular grid or curved linesCharacter grid can be 5 by 7 or 9 by 12 or more in high quality displaysCharacter grid is superimposed and character curves are scan converted

Raster Scan Display Processor Digitize/scan-conversion picture definition provided by

application program

Display processor also performs additional tasks e.g. changing line styles, coloring areas, transformation on objects etc

Efforts are made to shorten frame buffer

One way is to store intensity information as link list and apply run-length encoding

Similar method applies when intensities change linearly

Short runs can increase storage requirements

Short runs bring difficulty in processing

Another approach encode raster as set of rectangular areas, called cell encoding

Random Scan System

Architecture of a simple random scan system.

Random Scan System Display processor also called display processing unit

or graphics controller

Application program along with graphic package stored in memory

Graphics commands of application are transformed by graphic package into display file, stored in memory

Display processor goes through each line in display file in a refresh cycle

Lines are specified by end points

Scene is drawn one line at a time and deflection voltages are directed to fill region b/w end points

Hard Copy Devices

Purpose is to put our graphics/picture on paper

Quality of pictures: Dots/inch also known as resolution

High quality printing: Adjacent dots overlaps

Two type of printers: Impact and non-impact

Impact: press formed character faces against ink ribbon

Non-impact: Use laser technique, inkjet spay, xerographic process, electrostatic or electro-thermal methods

Hard Copy Devices

Dot-matrix Printer Impact printer

Dot-matrix head with rectangular array of protruding wire pins

Number of pins depends on quality of printer

Character face or graphic patterns drawn by retracting certain pins

Single column vs multi column printing head

Hard Copy Devices

Laser Printer Have photoelectric,

e.g. selenium, coated drum

Graphics are drawn by creating charge distribution on drum using laser beam

Toner is applied to the drum

Toner then applied to paper to draw graphics

Xerographic Process

Hard Copy Devices

Ink-jet Printer Paper wrapped on a drum Ink is squirted horizontally across the length of paper Ink-stream is deflected by electric field Produce dot-matrix patterns Three types: Thermal ink-jet, Piezoelectric ink-jet and continuous ink-

jet Thermal inkjet send current through heating element in heating

chamber and make steam explosion Current send to piezoelectric material in ink-filled chamber which

changes shape & size and produce pressure High-pressure pumps direct ink through a gunbody, microscopic

nozzle, piezoelectric crystal produce accoustic waves which breaks ink stream into droplets at continuous intervals

Heating element contract on cooling and suck further ink from reserviors

Hard Copy Devices

Pen Plotter A plotter is a vector graphics printing device to print

graphical plots Move pen across the piece of paper Can draw complex line art and text but very slowly Can draw filled regions by complex closed lines Printer control languages created to send more detailed

command for text Paper placed over a roller which moves paper back &

forth for x motion and pen moved back & forth for y motion

Fast computing, inexpensive memory and quality raster graphics with laser and inkjet have replaced pen-plotters

Hard Copy Devices

Electrostatic Device Place negative charge on the length of paper one

row at a time

Paper is then exposed to toner

Toner is positively charged

Negative and positive charge produce adhesion

Hard Copy Devices

Electro-thermal Device Heat sensitive coated thermal paper Apply selective heating Produce output patterns using dotmatrix printing

head Image is produced in the area where it is heated Two color direct thermal printer produce black

and red color images when heated on two different temperatures

Input Devices

Keyboard Used for entering text Extra features: screen coordinates, object

selection, menu selection and graphic functions Function keys used to activate frequently used

operations Cursor control keys used to relocate screen cursor Can accompany track ball or joy stick Additional numeric keyboard used for fast entry

of numeric data Specialized application: buttons, switches and

dials

Input Devices

Mouse Another major input device Small handheld box used to reposition screen

cursor Movement is recorded using wheel or roller in

bottom Movement is also detected with optical sensor

with special mouse pad having horizontal and vertical line grid

Not fixed, Used for relative changes in screen cursor

Also accompany two or three buttons to activate certain function

Also Z mouse for 3D application

Input Devices

Track ball and space ball A ball with potentiometer, produce screen

movements

Unlike track ball, the Space ball doesn’t actually move

Strain gauges measure the amount of pressure and the direction of pressure

Used for three dimensional positioning in virtual reality, animation and CAD

Input Devices

Joy Stick A small vertical lever which steers screen cursor Some record physical movement of the stick

while others record only pressure on the stick In first movement and direction and in second

pressure and direction is gauged (strain gauge) Potentiometer is used Might be mounted on the keyboard Can also use one or more buttons

Input Devices

Image scanner Pictures, graphs, charts, text etc can be used as bitmap in

computer memory They are stored as color or grayscale grades Purpose is to process image objects

Transform objects

Crop different areas (Picture editing)

Image processing

Extract text

Available in variety of sizes, from hand held to huge

Input Devices

Touch Panels Select processing options, displayed

objects or screen positions with touch of screen

Touch inputs are devised with optical, electrical or acoustic methods

In optical method, infrared LEDs are fixed along vertical and horizontal edges of the frame (light detectors on opposite sides)

Detector detects which horiz and vert beams are interrupted

In case of closed LEDs, Avg is taken when two or more beams are interrupted

Input Devices

Touch Panel (continued…) Should match the color and contour of system In electrical method, two transparent plats, one

conductor and second resister, placed on small distance

Both plates touches when pressure is applied Voltage drop in resister plates is recorded as

screen coordinates In acoustic method, acoustic waves are generated

across horiz and vertical directions Interruption causes reflection of waves Time interval is calculated to find screen

coordinates

Input Devices

Light Pen Record screen location when electron been

passes to that point

Don’t detect environment light

Can’t detect black spots

Application must keep non-zero intensity for black screen position

Few other disadvantages

Voice System System is trained for a particular operator

Frequencies are recorded for different words for the operator

System record word and operation performed on those words

On use, operator voice is searched in dictionary and operation for that word is performed

User don’t have to switch among devices

Visible spectrum (Continued)

Visible spectrum (Continued)

Human vision system

Human vision system

Human eye is a spherical camera with 20mm focal length

Lens focus the image on retina

Iris control the amount of light passing through pupil

Each eye is populated unevenly with 100m receptor cells

Near the fovea dense concentration of color receptor called cons

Density of black & white receptors, called rods, increases away from the center and cons decreases

Three different types of cons (with different chemical properties) are sensitive to light of three different wavelengths

human is tri-chromate

Color model

Provide mechanism for encoding of color in visible spectrum

Mathematical model for describing colors as tuple of numbers

Numbers are usually three or four Gives precise definition of how components are

interpreted Usually define some primary colors

RGB Color Model

CMY Color Model

Cyan, Magenta, Yellow Subtractive color scheme (Subtract from

white, transparent inks) Colors which are not absorbed, determine

color Cyan absorb red, magenta absorb green

and yellow absorbs blue White(0,0,0): No component of light is

absorbed Black(255,255,255): ???

CMYK Color Model

Cyan, Magenta, Yellow, Key (Black)

Same as CMY

Black is added to improve reproduction of some dark colors

To save money on ink, and to produce deeper black tones, unsaturated and dark colors are produced by substituting black ink for the combination of cyan, magenta and yellow

HSI or HSV Color Model

Hue, Saturation, Intensity or Value

HSI or HSV Color Model

Separate Intensity from chromacy – Hue and Saturation

Hexagon or hexacon is formed by projecting RGB color cube along its major diagonal

Vertical intensity axes H is defined angle between 0 and 2Π

relative to a-axes (0 angle mean pure red) S is defined as color purity (1 pure i.e.

saturated and 0 for unsaturated i.e. some shades of gray)

Convenient for graphics designers, provide direct control over hue and brightness

2D Trasformation

Changes in the object orientation, size and shape is accomplished by 2D transformation

Basic transformations Translation

Rotation and

Scaling

2D Trasformation

Translation Object is moved along a line path from one

coordination to another

It’s a rigid body transformation (no deformation)

(x, y) Original coordinate location

(tx, ty) translation distance, also called the translation vector or shift vector

(x’,y’) new coordinate location

2D Trasformation

Translation

Can be expressed as

X’ = x + tx y’= y + ty

Can also be expressed in matrix form

2D Trasformation