Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Computer Graphics

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Computer Graphics

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

COMPUTER GRAPHICS

UNIT I:

Introduction: Computer Graphics, Computer Graphics Applications.

Video Display Devices: Refresh Cathode Ray Tube, Raster Scan displays, Random Scan Displays,
Architecture of Raster and Random Scan Monitors, Color CRT-monitors, Color Generating Techniques
(Shadow Mask, Beam Penetration), Direct View Storage Tube, Flat Panel Displays.

Two dimensional Graphics Primitives: Points and Lines, Point plotting Techniques: Coordinate system,
Increment method, Line drawing algorithm: DDA, Bresenham’s line drawing, Bresenham‘s circle drawing
algorithm: Using polar coordinates, Midpoint circle drawing algorithms, Filled area algorithm: Scan line,
Polygon filling algorithms, Boundary filled algorithms.

UNIT II:

Two Dimensional Viewing: Viewing pipeline, Window to view port transformation, Window to view port
mapping.

Two Dimensional Geometric transformations: Two Dimensional Transformations: Transformations,


Translation, Scaling, Rotation, Other Transformations Reflection, shear, Homogenous Coordinate System

UNIT III:

Three-Dimensional Transformations: Scaling, Translation, Rotation, Shear Transformations, Reflection.


Projection, Parallel Projection, Perspective Projection

Three Dimensions Viewing: Three-Dimensional Viewing Transformations


Introduction to Computer Graphics:

 Computer Graphics: Computer graphics is simply the art/science of producing and manipulating
images on a computer. It is the use of computer to create, store, manipulate and interrogate and
present pictorial output. Tools used to make such pictures, software and hardware; input/output
devices are studied under computer graphics.

 A frame buffer is a portion of RAM containing a bitmap that drives a video display. The
information in the buffer typically consists of color values for every pixel to be shown on the
display. Also called Refresh Buffer, contains picture definition. The image is stored in a frame
buffer containing the total screen area and where each memory location corresponds to a pixel.
Consider it as 2-D memory array. E.g. Frame buffer
1. size 8x8
2. Color depth 8 (values 0-7)
Uses large memory: 640x480 à 307200 bits à 38 kB

Computer Graphics Applications:


 Computer Aided Design (CAD): A major use of computer graphics is in design process particularly
for engineering and architectural systems which is termed as CAD. It is used in designing Buildings,
automobiles, aircraft, watercraft, spacecraft, computer, text-tiles and many others products.
 Presentation Graphics: It is used to produce illustrations for reports or generate slides for use with
projectors. It is used to summarize financial, statistical, scientific and economic data for research
reports, customer information bulletins and other types of reports. Examples: Bar Charts, Line
Graphs, Pie Charts etc.
 Computer Art: Computer graphics is used in both fine and commercial art applications. Artists used
special purpose hardware and many computer methods such as paintbrush programs like Lumena,
pixel paint and super paint packages. Commercial art includes logos design, page layout with text
and graphics, TV advertising etc. Morphing is a graphic method in which one object is transformed
into other.
 Entertainment (Animations, Games....): In Movie Industry they are used in motion pictures, music
videos and television shows and are used in making of cartoon animation films. Sometimes the
graphics scenes are displayed by themselves and sometime graphics objects are combined with actor
and live scenes.
 Education and Training: Computer Generated models of physical, financial and economic systems
are used as educational aids. It helps the trainees to understand the system. Simulators for practice
session or training of ship captains, aircraft pilots, heavy equipment operators and air traffic control
personnel.
 Visualization: Scientists, engineers, medical personnel, business analysis, and others often need to
analyze large amount of information or to study the behaviour of certain processes- tedious and
effective. To overcome this, a technique which trends and patterns apparently is called visualization.
Numerical modelling of thunderstorms, protein modelling, molecular structure, etc.
 Image Processing: Methods used in computer graphics and image processing overlap.
 Image processing is used to create picture. Image processing applies Techniques to modify or
interpret existing pictures such as photographs and TV scans. To apply image processing methods
we first digitize a photograph into image file then apply digital method to rearrange picture parts and
enhance color separations or to improve quality of picture.
 Medical Applications: Medicine use it to model and study physical functions, Computer Aided
surgery
Video Display Devices
Refresh Cathode Ray Tube: A beam of electrons emitted by electron gun passes through focusing and
deflection systems that direct the beam towards specified positions on the phosphor-coated screen. The
phosphor then emits a small spot of light at each place contacted by electron beam. As the light fads rapidly,
some method is needed for maintaining the screen picture. One way to keep this is to redraw the picture
repeatedly by quickly directing the electron beam to the same points.

Working of CRT
 Beam of electrons directed from cathode (-)to phosphor-coated (fluorescent) screen (anode (+))
 Directed by magnetic focusing and deflection coils (anodes) in vacuum filled tube
 Phosphor emits photon of light, when hit by an electron, of varied persistence (long 15-20 ms for
texts / short < 1ms for animation)
 Refresh rate (50-60 Hz / 72-76 Hz) to avoid flicker / trail
 Phosphors are organic compounds characterized by their persistence and their color (blue, red,
green).
 Horizontal deflection and vertical deflection direct the electron beam to any point on the screen
 Intensity knob: regulates the flow of electrons by controlling the voltage at the control grid (high
voltage reduces the electron density and thus brightness)
 Accelerating voltage from positive coating inside screen (anode screen) or an accelerating anode
Image maintenance
 Charge distribution to store picture information OR
 Refresh CRT: refreshes the display constantly to maintain phosphor glow.
Focusing
 Focusing forces the electron beam to converge to a point on the monitor screen
 Can be electrostatic (lens) or magnetic (field)
Deflection
 It directs the electron beam horizontally and/or vertically to any point on the screen
 Can be controlled by electric (deflection plates, slide 9) or magnetic fields (deflection coils, slide 5)
 Magnetic coils: two pairs (top/bottom, left/right) of tube neck
 Electric plates: two pairs (horizontal, vertical)
Characteristics of Cathode-Ray Tube (CRT)
 Intensity is proportional to the number of electrons repelled in beam per second (brightness)
 Resolution is the maximum number of points that can be displayed without overlap; is expressed as
number of horizontal points by number of vertical points; points are called pixels (picture elements);
example: resolution 1024 x 768 pixels. Typical resolution is 1280 x 1024 pixels.
High-definition systems: high resolution systems.
 Persistence is defined as the time taken by the emitted light to decay one tenth of its original
intensity.
Max persistence 1 Sec, Min Persistence 10-60 m sec
Higher persistence ~ Low refresh rate ~ complex images
Lower persistence ~ High refresh rate ~ Animations
 Refresh Rate (Hz): number of times screen drawn or refreshed per second.
Usually 60 Hz (Why)
Depends upon persistence
 Pixel Picture Element
Mapping of phosphorus element to pixel
Bit for monochrome
Byte for 256 color levels
3 Bytes to produce more than 16.7 million colors

Raster Scan displays:


Introduction
Raster-scan display is the most common type of monitor using a CRT.
A raster is a matrix of pixels covering the screen area and is composed of raster lines.
The electron beam scans the screen from top to bottom one row at a time. Each row is called a scan line.
The electron beam is turned on and off to produce a collection of dots painted one row at a time. These will
form the image.

Refresh Procedure
Retracing
 Horizontal retrace – beam returns to left of screen
 Vertical retrace – bean returns to top left corner of screen
Blanking
 Horizontal Retrace Blanking
 Vertical Retrace Blanking
Interlacing
 display first even-numbered lines, then odd-numbered lines
 permits to see the image in half the time
 Useful for slow refresh rates (30 Hz shows as 60 Hz).
Over scanning
 Scan lines extended beyond visibility edge as there is limit on speed of sweep generator
 Avoid cracking at borders and distortion
 Top and Bottom Vertical Over scanning
 Left and Right Horizontal Over scanning
Refresh rate
 24 is a minimum to avoid flicker, corresponding to 24 Hz (1 Hz = 1 refresh per second)
 Current raster-scan displays have a refresh rate of at least 60 frames (60 Hz) per second, up to 120
(120 Hz).

Random Scan Displays:


Introduction
Random scan systems are also called
 Vector Displays
 stroke-writing, or
 Calligraphic displays.
The electron beam directly draws the picture in any specified order. A pen plotter is an example of such a
system. Picture is stored in a display list, refresh display file, vector file, or display program as a set of line
drawing commands. Refresh rate depends upon the size of the file. It refreshes by scanning the list 30 to 60
times per second. More suited for line-drawing applications such as architecture and manufacturing. It got
improved in the 1960’s by the Direct View Storage Tube (DVST) from Tektronix.

Advantages:
 Good quality lines
 No need of scan conversion
 Easy animation and requires little memory
Disadvantages:
 Requires intelligent electron beam (processor controlled)
 Limited screen density, limited to simple, line-based images
 Limited color capability.

RASTER RANDOM

DISPLAY MECHANISM E-beam traces entire screen from E-beam can highlight random
upper left corner to bottom right positions on the screen

DRAWING UNIT Pixel Line


IMAGE STORAGE Frame Buffer Display File
IMAGE TYPES Can display very complex images Wire Frame modeling
with greater accuracy
IMAGE QUALITY • May be Jagged due to • Smooth lines as e-beam
digitization directly follows the line path
• Diagonal Lines are • Diagonal Lines are produced
produced with lower with equal intensity
intensity
REFRESHING Entire Screen has to be refreshed Only selected portions are redrawn
REFRESH RATE Maximum 80 Hz Higher refresh rates.
ANIMATIONS Supported Not supporting
COLORS Higher Color Depth Lesser colors and shades
COLOR TECHNIQUE Shadow Masking Beam Penetration

Architecture of Raster Scan:


Color CRT-monitors:
Introduction:
- It uses different phosphors, a combination of Red, Green, and Blue, to produce any color.
- Color CRT’s are designed as RGB monitors also called full-color system or true-color system.
- Use shadow-mask methods with intensity from each electron gun (red, green, blue) to produce any
color directly on the screen without preprocessing.
- Frame buffer contains 24 bits per pixel, for 256 voltage settings to adjust the intensity of each
electron beam, thus producing a choice of up to 17 million colors for each pixel (2563).

Color Generating Techniques:


Two methods:
 Beam penetration
 Shadow Masking

Shadow Masking Method:


 Raster scan system uses a shadow mask with three electron guns: Red, Green, and Blue (RGB color
model).
 Color is produced by adjusting the intensity level of each electron beam.
 Produces a wide range of colors, from 8 to several millions.
 The arrangement of color components can be
1) Delta-Delta arrangement
2) In line arrangement
Beam Penetration Method:
 Random scan system uses beam penetration.
 2 layers (Red, Green) phosphors; low speed electrons excite Red, high speed electrons excite Green.
 Intermediate speed excites both to get yellow and orange.
 Color is controlled by electron beam voltage.
 It is inexpensive
 Only produces a restricted set of colors.
 Quality of Picture is low

Direct View Storage Tube:


Introduction
- Picture is stored inside the CRT
- No refreshing required
- Diagrammatically

Components
- Flooding Gun to flood the entire screen and charge the collector plate
- Writing Gun is same as e-gun in CRT having heating filament, cathode, focusing anode and
deflection yokes
- Collector Plate partly energized by the flooding gun, has background charge to keep fired
phosphorus illuminated
- Phosphorus Screen higher persistence CRT screen
- Ground to discharge the collector to erase the screen
Advantages/Disadvantages
– No Refreshing required
– It can draw complex images with higher resolution
– Does not display colors
– Selected part of the picture cannot be erased
– Animation not supported
Flat Panel Displays:
Introduction
- Flat panel displays are video devices that are thinner, lighter, and require less power than CRT’s.
- Examples: wall frames, pocket notepads, laptop computer screens …
Types of Flat Panel Displays
- Emissive panels convert electrical energy into light:
plasma panels, thin-film electroluminescent display device, light-emitting diodes.
- Non-emissive convert light into graphics using optical effects:
liquid-crystal device (LCD).
Plasma-panel display:

Components of Plasma-panel displays


- Cathode Fine wires attached to glass plates deliver –ve voltage to gas cells on vertical axis
- Fluorescent cells Small pockets of gas liquid or solids to emit light in excited state
- Anode Fine wires attached to glass plates deliver +ve voltage to gas cells on horizontal axis
- Glass Plates to act as capacitors to maintain sustaining voltage
Working of Plasma-panel displays
- An array of small fluorescent gas lights
- Constructed by filling a mixture of gases (usually neon) between two glass plates
- vertical conducting ribbons are placed in one plate, and horizontal conducting ribbons are placed in
the other plate
- voltage is applied to the two ribbons to transform gas into glowing plasma of electrons and ions.
- Two voltage levels
Firing Voltage 60
Sustaining Voltage 40
Advantages/Disadvantages:
- No need of refreshing
- Provides Fairly High resolution
- However MONOCHROME with few grey levels
Thin-film electroluminescent display:

Thin-film electroluminescent displays are similar devices except that the region between the plates is filled
with phosphor instead of gas. Example: zinc sulphide with manganese
voltage applied between the plates moves electrons to the manganese atoms that release photons of light.
Light-emitting diode:
– a matrix of diodes, one per pixel
– apply voltage stored in the refresh buffer
– Convert voltage to produce light in the display.
Liquid-crystal displays (LCD):
- LCD screens are often used in small devices such as calculators and laptop monitors.
- non-emissive types of displays
- the picture produced by passing light from a light source through liquid-crystal material
- Liquid-crystal material contains crystals within a liquid nematic (thread-like) liquid-crystals have rod
shape that can either align to with the light direction or not
when voltage is applied to conductors.
- Liquid-crystal material can be programmed to either let the light through or not

Components of Liquid Crystal Displays


- Glass Plates contains the liquid crystal and serve as bonding surface for conductive coating.
- Transparent Conductor: To apply voltage to two ribbons (across liquid crystals) to make plasma
glow.
- Liquid Crystals Substance that polarize light when voltage is applied.
- Two Polarized Films Transparent sheets that polarize light.
- Reflectors
- ON STATE when light is twisted
- OFF STATE when block the light
- Passive matrix LCD have refresh buffer
screen refreshed at 60 frames per second
- Active matrix LCD transistor stored at each pixel prevents charge from leaking out of liquid-crystals
- Temperature dependent, sluggish
- Require little power to operate
Two dimensional Graphics Primitives
Primitive graphic objects:
Computer-generated images are produced using primitive graphic objects such as:
 Points
 Straight lines
 Circles
Points and Lines
Point plotting Techniques
Coordinate system
Increment method
Scan Conversion Algorithm:
Line Drawing:
Many computer-generated pictures are composed of straight-line segments. A line segment is displayed by
turning on a set of adjacent pixels. In order to draw a line, it is necessary to determine which pixels lie
nearest the line and provide the best approximation to the desired line. The line drawing routine should be
accurate, fast, and easy to implement.
The Problem of Scan Conversion
A line segment is defined by the coordinate positions of the line endpoints.
Slope-Intercept Line Equation
A line segment in a scene is defined by the coordinate positions of the line endpoints. The starting point is
(Xstart, Ystart) and the ending point is (Xend, Yend).
Line Equation is defined as: y = m x + b
Where m is the slope of the line, and defined as the change in y values divided by the change in x values:

Yend – Ystart
m=
Xend – Xstart
b is the y-intercept. Recall that the y-intercept is the line’s y value when x equals zero.
For example, the line defined by equation y=5x+3 the y-intercept is b=3.
The y-intercept can be calculated by the following equation in terms of the coordinate of the starting points.
b = Ystart – m Xstart
The y-intercept can also be calculated by the following equation in terms of the coordinate of the ending
points.
b = Yend – m Xend
The slope of a line (m) is defined by its start and end coordinates. The diagram below shows some examples
of lines and their slopes, in all cases b=0.

Horizontal Line Drawing Algorithm


The screen coordinates of the points on a horizontal Line are obtained by keeping the value of y constant
and repeatedly incrementing the x value by one unit.
Horizontal line with starting point (0, 4) and ending point (8, 4) on a pixel based display
The following code can be used to draw a horizontal line from (Xstart, Y) to (Xend, Y),
Where Xstart £ Xend
x = Xstart
y=Y
Next: Set pixel (x, y) with desired color
x=x+1
If x £ Xend then go to Next
End
Vertical Line Drawing Algorithm
The screen coordinates of the points on a Vertical Line are obtained by keeping the value of x constant and
repeatedly incrementing the y value by one unit.
A vertical line with starting point (4, 0) and ending point (4,8) on a pixel based display.
The following code can be used to draw a vertical line from (X, Ystart) to (X, Yend),
Where Ystart £ Yend
x=X
y = Ystart
Next: Set pixel (x, y) with desired color
y = y+ 1
If y £ Yend then go to Next
End
Diagonal Line Drawing Algorithm (m=1)
To draw a diagonal line with a slope equals +1 (m=1), we need only repeatedly increment by one unit both
the x and y values from the starting to the ending pixels.
A diagonal line (m=1) with starting point (2,2) and ending point (7,7) on a pixel based display
The following code can be used to draw a diagonal line from (Xstart, Ystart) to (Xend, Yend), where Xstart
£ Xend and Ystart £ Yend
x = Xstart
y = Ystart
Next: Set pixel (x, y) with desired color
y = y+ 1, x = x + 1
If x £ Xend then go to Next
End
Diagonal Line Drawing Algorithm (m=-1)
To draw a diagonal line with a slope equals -1 (m=-1), we need only repeatedly increment by one unit in x
and decrement by one unit in the y values from the starting to the ending pixels.
A diagonal line (m=-1) with starting point (2,7) and ending point (7,2) on a pixel based display
The following code can be used to draw a diagonal line from (Xstart, Ystart) to (Xend, Yend), where Xstart
£ Xend and Ystart ³ Yend
x = Xstart
y = Ystart
Next: Set pixel (x, y) with desired color
y = y- 1, x = x + 1
If x £ Xend then go to Next
End
Arbitrary Line Drawing Algorithm
Drawing lines with arbitrary slope creates several problems.
 Direct Line Drawing Algorithm
 Simple Digital Differential Analyzer (simple DDA) Line Drawing Algorithm
 Bresenham ’s Line Drawing Algorithm
Direct Line Drawing Algorithm
Perhaps the most natural method of generating a straight line is to use its equation. First we calculate the
slope (m) and the y-intercept (b) using these equations:

Yend – Ystart
m=
Xend – Xstart

b = Ystart – m Xstart or b = Yend – m Xend


We then draw the line by incrementing the x value one unit from (Xstart, Ystart) to (Xend, Yend) and at
each step solve for the corresponding y value. For non-integer y value, we must first determine the nearest
integer coordinate.
The following code can be used to draw a diagonal line from (Xstart, Ystart) to (Xend, Yend), where Xstart
£ Xend
x = Xstart
y = Ystart
Next: Set pixel (x, Round(y)) with desired color
x= x + 1
y = mx + b
If x £ Xend then go to Next
End
DDA (Digital Differential Analyzer)
m = (Yend-Ystart) / (Xend-Xstart)
If (abs (m) <1 and Xstart>Xend) then
Swap end points Xstart « Xend and Ystart « Yend
end if
Set pixel (Xstart, Ystart) with desired color
If abs(m) < 1 then
y = Ystart
x = Xstart + 1
Next: y = y + m
Set pixel (x, Round(y)) with desired color
x=x+1
If x £ Xend-1 then go to Next
endif
Set pixel (Xend, Yend) with desired color
DDA Line Drawing Algorithm
1. Input the two line endpoints and store the left endpoint in (x0,y0)
2. Plot first point (x0,y0)
3. Calculate constants Δx, Δy
4. If |Δx| > |Δy| steps = |Δx| else steps = |Δy|
5. Calculate XInc = |Δx| / steps and YInc = |Δy| / steps
6. At each xk along the line, starting at k=0, Plot the next pixel at (xk + XInc, yk + YInc)
7. Repeat step 6 steps times

Bresenham’s line drawing


Bresenham’s circle drawing algorithm: Using polar coordinates, Midpoint circle drawing algorithms,
Filled area algorithm: Scan line, Polygon filling algorithms, Boundary filled algorithms

You might also like