0% found this document useful (0 votes)
1 views

Computer Graphics Er. Inderjeet Bal

Uploaded by

shop.inderjeet
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Computer Graphics Er. Inderjeet Bal

Uploaded by

shop.inderjeet
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 82

COMPUTER

GRAPHICS

Submitted By:
Er. Inderjeet
Bal
Dept. of CS &
IT
TOPICS
• Computer Graphics
• Types of Graphics
• Graphics devices
• Applications of Graphics
• Graphics Packages
• Projections
WHAT IS COMPUTER GRAPHICS?

• Computer graphics are visual


representations of data displayed on a
monitor made on a computer.
• Computer graphics can be a series of
images (most often called video) or a single
image.
• Creation, Manipulation and Storage of
geometric objects (modelling) & their
TYPES OF GRAPHICS

There are two kinds of computer graphics


- raster (composed of pixels) and vector (composed of
paths). Raster images are more commonly
called bitmap images.
• A bitmap image uses a grid of individual pixels where each
pixel can be a different colour or shade. Bitmaps are
composed of pixels.
• Vector graphics use mathematical relationships between points
and the paths connecting them to describe an image. Vector
graphics are composed of paths.
• Bitmap images require higher resolutions and anti-aliasing for
a smooth appearance.
• Vector-based graphics on the other hand are mathematically
described and appear smooth at any size or resolution.
• Bitmaps are best used for photographs and images with subtle
shading. Graphics best suited for the vector format are page
layout, type, line art or illustrations.
GRAPHICS INPUT DEVICES

• Input devices are things we use to put information into a


computer.
• An input device is any hardware device that sends data to
the computer, without any input devices, a computer would
only be a display device and not allow users to interact
with it, much like a TV.
• For example, a keyboard is an input device.

• Input devices other than the keyboard are sometimes


called alternate input devices.
• Mice, trackballs, and light pens are all alternate input
devices.
TYPES OF INPUT DEVICES
GRAPHICS OUTPUT
DEVICES
PRINTERS
This allows you to print off the graphics you
create and edit on the computer. You can
print them off in color, black and white or
gray scale in various sizes.
PLOTTERS
Plotter is another type of computer printer
which prints vector graphics. There are two
types of plotters one is a pen plotter which is
when a pen moves across the surface of the
paper and then there is a knife plotter which
uses moving knives to cut into a piece
material.
MONITORS
This allows you to see the images
produced by the computer. The quality of
the graphics that you see depends on the
size and the resolution of the monitor.
PHOSPHORS
The phosphors used in a graphic display are
normally chosen for their colour
characteristics and persistence. Colour should
preferably white, particularly for applicants
where dark information appears on a light
background. Phosphor layers provide most of
the light produced by fluorescent lamps, and
are also used to improve the balance of light
produced by metal halide lamps.
ELECTRON GUN

Electron Gun makes use of


electrostatic fi elds to focus and
accelerate the electron beam. A fi eld
is generated when two surfaces are
raised to different potentials. The
most common use of electron guns is
in cathode ray tubes, which were
widely used in computer and
television monitors.
APPLICATIONS OF
COMPUTER GRAPHICS
• Computer Aided Design (CAD)
• Presentation Graphics
• Computer Art
• Entertainment (animation, games, …)
• Education & Training
• Visualization (scientifi c & business)
• Image Processing
• Graphical User Interfaces
1 . COMPUTER AIDED DESIGN (CAD)

Used in design of buildings, automobiles,


aircraft, watercraft, spacecraft, computers,
textiles & many other products. Objects are
displayed in wire frame outline form Software
packages provide multi-window environment
• Graphics design package provides standard shapes
(useful for repeated placements).
• Animations are also used in CAD applications.
• Realistic displays of architectural design permits
simulated “walk” through the rooms (virtual -reality
systems).
2. PRESENTATION GRAPHICS

• Used to produce illustrations for reports


or generate slides for use with
projectors
• Commonly used to summarize financial,
statistical, mathematical, scientific,
economic data for research reports,
managerial reports & customer
information bulletins
• Examples : Bar charts, line graphs, pie
charts, surface graphs, time chart
EXAMPLES OF
PRESENTATION
GRAPHICS
EXAMPLES OF
PRESENTATION GRAPHICS
3. COMPUTER ART

• Used in fine art & commercial art


• Includes artist’s paintbrush programs,
paint packages, CAD packages and
animation packages
• These packages provides facilities for
designing object shapes & specifying
object motions.
• Examples :Cartoon drawing, paintings,
product advertisements, logo design
EXAMPLES :
COMPUTER ART

• Electronic painting : Picture painted


electronically on a graphics tablet (digitizer)
using a stylus Cordless, pressure sensitive stylus
• Morphing :A graphics method in which one
object is transformed into another
4. ENTERTAINMENT

Movie Industry: Used in


motion pictures, music
videos, and television
shows. Used in making of
cartoon animation films
COMPUTER GRAPHICS IS
ABOUT ANIMATION (FILMS)
Game Industry
• Focus on interactivity
• Cost effective solutions
• Avoiding computations and other tricks
5. EDUCATION & TRAINING

• Computer generated models of


physical, financial and economic
systems are used as educational aids.
• Models of physical systems,
physiological systems, population
trends, or equipment such as color-
coded diagram help trainees
understand the operation of the
system
Specialized systems used
for training applications
simulators for practice sessions
or training of ship captains
aircraft pilots
heavy equipment operators
air traffic-control personnel
TRAINING
6. VISUALIZATION

Scientific Visualization
Producing graphical representations for scientific,
engineering, and medical data sets
7. IMAGE PROCESSING

CG- Computer is used to create a picture


• Image Processing – applies techniques to
modify or interpret existing pictures such as
photographs and TV scans
• Medical applications
• Picture enhancements
• Tomography
• Simulations of operations
• Ultrasonic & nuclear medicine scanners
• Two applications of image processing
-Improving picture quality
-Machine perception of visual information
To apply image processing methods
• Digitize a photograph (or picture) into an image file
Apply digital methods to rearrange picture parts to
-enhance color separations
-Improve quality of shading
Tomography – technique of X-ray photography that allows
cross-sectional views of physiological systems to be displayed
Computed X-ray tomography (CT) and position emission
tomography ( PET) use projection methods to
reconstruct cross sections from digital data.
Computer-Aided Surgery is a medical application technique
to model and study physical functions to design artificial
limbs and to plan & practice surgery.
8. GRAPHICAL USER
INTERFACES

• Major component –Window manager


(multiple-window areas)
• To make a particular window active, click
in that window (using an interactive
pointing device)
• Interfaces display – menus & icons
• Icons – graphical symbol designed to look
like the processing option it represents
• Advantages of icons – less screen space,
easily understood
• Menus contain lists of textual descriptions
GRAPHICS PACKAGES
A set of libraries that provide programmatically
access to some kind of graphics 2D functions.
Types

• GKS-Graphics Kernel System – first graphics package –


accepted by ISO & ANSI
• PHIGS (Programmer’s Hierarchical Interactive Graphics
Standard)-accepted by ISO & ANSI
• PHIGS + (Expanded package)
• Silicon Graphics GL (Graphics Library)
• Open GL
• Pixar Render Man interface
• Postscript interpreters
GRAPHICS
TRANSFORMATIONS
2D Transformations
• World Coordinates
• Translate
• Rotate
• Scale
• Viewport Transforms
• Putting it all together
TRANSFORMATIO
NS

Rigid Body Transformations - transformations


that do not change the object.
Translate
If you translate a rectangle, it is still a rectangle
Scale
If you scale a rectangle, it is still a rectangle
Rotate
If you rotate a rectangle, it is still a rectangle
VERTICES
We have always represented vertices as (x,y)
An alternate method is:

Example:

 x
( x, y )   
 y

 2 . 1
( 2 .1, 4 .8)   
 4 .8 
MATRIX VECTOR

 x '  a b  x  x '  a b c   x 
 y '   c d   y 
 y '   d e f   y 
       
 z '   g h i   z 

x '  ax  by x '  ax  by  cz
y '  dx  ey  fz
y '  cx  dy
z '  gx  hy  iz
 1 0 0
 1 0  
I   I  0 1 0
 0 1  0 0 1 
Matrix * Matrix

Does A*B = B*A?


a b  x y
A   , B   What does the identity do?
c d  z w 
 ax  bz ay  bw 
A * B  
 cx  dz cy  dw 
 a b   1 0
?    0 1
 c d  
PRACTICE

 2  3  2
A   , X  
1 5    3
AX ?
 2  3   0 .5 1 
A   , B  
 1 5   3 2 . 5 
A * B ?
A * I ?
TRANSLATION

Translation - repositioning an object along a straight-line


path (the translation distances) from one coordinate
location to another.

(x’,y’)

(tx,ty)

(x,y)
TRANSLATION

P ( x, y ) P  (  3 .7 ,  4 .1)
Given:
T  (t x , t y ) T  ( 7 .1,8 .2 )

We want:
x'  x  t x x '   3 .7  7 .1
y'  y  t y y '   4 .1  8 .2
Matrix form:

 x '  x   t x   x '    3 . 7   7 . 1
 y '   y    t   y '    4 . 1    8 . 2 
     y      
P' P  T x ' 3 .4
y '  4 .1
SCALE

• Scale - Alters the size of an object.


• Scales about a fixed point
(x’,y’)

(x,y)
Scale
• Given: P ( x , y ) P  (1 .4, 2 .2 )
S ( s x , s y ) S  (3,3)

x' sx x x ' 3 * 1 .4


• We want: y '  s y y ' 3 * 2 .2
y

 x '   3 0   1 .4 
 y '   0 3   2 . 2 
 x '  s x 0   x     
• Matrix  y '   0 s y   y  x '  4 .2
form:
  
P '  S P y '  6 .6
Rotation
• Rotation - repositions an object
along a circular path.
• Rotation requires an  and a pivot
point
Rotation

P ( x, y ) x '  r cos  cos   r sin  sin 


R  ( ) y '  r cos  sin   r sin  cos 
x  r cos  x '  x cos   y sin 
y  r sin  y '  x sin   y cos 
x '  r cos(   )  x '   cos   sin    x 
y '  r cos(   )  y '   sin  cos    y 
  
P '  R P
EXAMPLE

P=(4,4)
=45 degrees
SPECIFYING 2D TRANSFORMATIONS

Translation
T(tx, ty)
Translation distances
Scale
S(sx,sy)
Scale factors
Rotation
R()
Rotation angle
Combining
Transformations
• Using translate, rotation, and
scale, how do we get:
COMBINING
TRANSFORMATIONS

Note there are two ways to combine rotation and


translation. Why?
2X2 -> 3X3 MATRICES

We can combine transformations by


expanding from 2x2 to 3x3 matrices.
 1 0 tx 
 x   tx 
T t x , t y          0 1 t y 
 y ty   0 0 1 
 
 sx 0 0
s
 x 0  
S s x , s y    
  0 s y 0 

 0 s y   0 0 1
 
 cos   sin  0
 cos   sin   
R        sin  cos  0 
 sin  cos    0 0 1 

HOMOGENOUS
COORDINATES

We need to do something to the vertices By


increasing the dimensionality of the problem
we can transform the addition component of
Translation into multiplication.

 xh   6
 x  3 
 xh  h   4  6  2
 x  yh   4  3  14 
P      y h     
  y   Ex.    2  , Ex.    14    7  
 y  h 
 h   2
 1   7 
 2   2 
2
 h 
 h   2 
HOMOGENOUS
COORDINATES

Homogenous Coordinates - term used in


mathematics to refer to the effect of this
representation on Cartesian equations.
Converting a pt(x,y) and f(x,y)=0 ->
(xh,yh,h) then in homogenous equations
mean (v*xh,v*yh,v*h) can be factored out.
What you should get: By expressing the
transformations with homogenous
equations and coordinates, all
transformations can be expressed as
FINAL TRANSFORMATIONS -
COMPARE EQUATIONS

 x '  1 0 t x   x 
 x '  t x   x 
 
T t x , t y            y '   0 1 t y   y 
 y '  t y   y   1   0 0 1   1 
P T t x , t y  P  P T t x , t y  P
 x '  s x 0 0  x 
 x '  s x 0   x 
S s x , s y           y '   0
   sy 0   y 
 y '  0 s y   y   1   0 0 1   1 
P  S s x , s y  P  P  S s x , s y  P
 x '   cos   sin  0  x 
 x '   cos   sin    x   y '   sin 
R              cos  0   y 
 y '  sin  cos    y   1   0 0 1   1 
P  R   P  P  R   P
COORDINATE HIERARCHY

S c re en C oo rd in a tes

T ra n sfo rm a tion
W o rld -> S c re en

W o rld C o o rdin a tes

T ra n sfo rm a tion T ra n sfo rm a tion T ra n sfo rm a tion


O b je ct # 1 -> O b je ct # 2 -> O b je ct # 3 ->
W o rld W o rld W o rld

O b jec t #1 O b jec t #2 O b jec t #3


O b jec t C oo rd in a tes O b jec t C oo rd in a tes O b jec t C oo rd in a tes
Transformation W o rld C o o rd in a te s

Hierarchies T ra n sfo rm a tion


G re e n -> W o rld

• We can have
transformations be in
G re e n
O b je ct's C o o rd in a te s

relation to each other T ra n sfo rm a tion


R e d -> G re e n

R ed
O b jec t C o o rd in a tes

T ra n sfo rm a tion
B lu e -> R e d

B lu e
O b jec t C o o rd in a tes
TRANSLATION
ROTATION
ROTATION
ROTATION
SCALING

The matrix expression for the scaling


transformation of a position P = (xi, yi, zi)
relative to coordinate origin can be written
as:
3D VIEWING

Viewing in 3D involves the following


considerations: -
We can view an object from any spatial position, eg.
In front of an object, Behind the object, In the
middle of a group of objects, Inside an object, etc.

3D descriptions of objects must be projected onto


the flat viewing surface of the output device.
VİEWİNG COORDİNATES

Generating a view of an object in 3D is similar to


photographing the object.

Whatever appears in the viewfinder is projected


onto the flat film surface.

Depending on the position, orientation and


aperture size of the camera corresponding views
of the scene is obtained.
3D Viewing Pipeline

FIGURE 10-6 GENERAL THREE-DIMENSIONAL TRANSFORMATION


PIPELINE, FROM MODELING COORDINATES (MC) TO WORLD
COORDINATES (WC) TO VIEWING COORDINATES (VC) TO
PROJECTION COORDINATES (PC) TO NORMALIZED COORDINATES
(NC) AND, ULTIMATELY, TO DEVICE COORDINATES (DC).
SPECİFYİNG THE VİEW
COORDİNATES
xv
For a particular view of a scene yv

first we establish viewing- yw zv

coordinate system. P0=(x0 , y0 , z0)

A view-plane (or projection


plane) is set up perpendicular xw
to the viewing z-axis. zw

World coordinates are


transformed to viewing
coordinates, then viewing
coordinates are projected onto
the view plane.
SPECİFYİNG THE VİEW
COORDİNATES
To establish the viewing reference frame, we
first pick a world coordinate position called the
view reference point.

This point is the origin of our viewing coordinate


system. If we choose a point on an object we can
think of this point as the position where we aim a
camera to take a picture of the object.
PROJECTIONS
PROJECTION

General definition
Transform points in n-space to m-space(m<n)
In computer graphics
Map viewing coordinates to 2D screen coordinates
TAXONOMY OF PROJECTIONS

Planar geometric projection

Parallel Perspective

Orthographic Oblique One-point Three-point


Two-point
Top
Axonometric Cabinet Other
Front
Cavalier
Side
PARALLEL & PERSPECTIVE

Parallel Projection

Perspective Projection
PARALLEL PROJECTION

Center of projection is at infinity


Direction of projection (DOP) same for all points

DOP

View Plane
ORTHOGRAPHIC & OBLIQUE

Orthographic parallel projection


the projection is perpendicular to the view
plane 

Oblique parallel projection


The projectors are inclined with respect to
the view plane
ORTHOGRAPHIC
PROJECTIONS

DOP perpendicular to view plane

Front

Top Side
OBLIQUE PROJECTIONS

DOP not perpendicular to view plane

Cavalier Cabinet
(DOP at 45 )  (DOP at 63.4 ) 
OBLIQUE PROJECTIONS

OP not perpendicular
tan  1, to view
45 plane
Cavalier projection

Cabinet projection
tan  2 ,  63.4
PERSPECTIVE PROJECTION

Map points onto “view plane” along “projectors”


emanating from “center of projection”(cop)

r s
o
ct
o je
Pr

Center of
View Plane
Projection
PERSPECTIVE PROJECTION

How many vanishing point?


PERSPECTIVE PROJECTION

How many vanishing point?

Three-
point
perspectiv
e
PERSPECTIVE PROJECTION

How many vanishing point?

Three- Two-point
point perspectiv
perspectiv e
e
PERSPECTIVE PROJECTION

How many vanishing point?

Three- Two-point One-point


point perspectiv perspectiv
perspectiv e e
e

You might also like