Unit 1 Introduction of Computer Graphics: Main Task

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

1 Computer Graphics (Reference Note) BSc.

CSIT

Unit 1
Introduction of Computer Graphics
Computer graphics is a field related to the generation of graphics using computer. It includes
the creation, storage and manipulation of images of object. These objects come from diverse
field such as medicine, physical, mathematical, engineering, architecture, entertainment,
advertisement.
- It is related to the generation and the representation of graphics by a computer using
specialized graphic hardware and software. The graphics can be photographs, drawings,
movies, or simulation etc.
- Computer graphics today is largely interactive; that is the user controls the contents
structure and appearance of images of the objects by using input devices such as
keyboard, mouse, or touch sensitive panel on the screen.

Main task
Imaging: Formation of an image.
- representation of 2D images.
Modelling: Representing 3D images.
Rendering: Constructing 2D images from 3D models.
Animation: Stimulating changes over time.
- describing how objects change in time.

Basic Concepts
Raster: A rectangular array of points and dots.
Pixel (picture element): One dot or picture element of the raster.
Scan line: A row of pixel.
Bit map: Ones and Zeros representation of rectangular array of point on the screen.
Black & white → bitmap
Color→ pixmap
n-1
Scan line

Pixel

0 m-1
m×n raster
Note: we don’t have any pixel like 1.2, 5.8.
Raster device co-ordinate can have only integer values.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


2 Computer Graphics (Reference Note) BSc.CSIT

Applications of Computer Graphics


Different application area of computer graphics:
- Graphical user interface (GUI)
- Entertainment
- Education and training
- Computer animation
- Simulation and modeling
- Office automation
- Image processing
- Research
- Computer art
- Cartography
- Computer aided design (CAD)
Computer Graphics Vs Image Processing

Computer graphics Image processing


Computer graphics involves in generating Image processing involves in analyzing the
images from mathematical or geometrical images to generate mathematical or
models. Geometrical models.
It includes the creation, storage and It is the part of computer graphics that
manipulation of images or objects. handles image manipulation or
interpretation.
E.g. Drawing a picture E.g. Making blur image visible.

Graphics Hardware System


Graphics Graphics Graphics
Library software monitor

System Graphics
CPU
modelling controller

I/O device
https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel
3 Computer Graphics (Reference Note) BSc.CSIT

Cathode Ray Tube (CRT)


A CRT is an evacuated glass tube, with a heating element on one end and phosphor-coated
screen on the other end.
When current flows through heating filament, the electrons are piled upon the filament. These
electrons are attracted by accelerating systems on the phosphor coated screen. When electron
strikes on the screen, the phosphor emits a small spot of light at each position contacted by
the electron beam. The glowing positions are used to represent the picture in the screen.

Fig: Cathode-ray tube (CRT)

Fluorescence / Phosphorescence
- When the beam of electron emitted by electron gun strikes phosphor coated screen on the
CRT, the phosphor emits a small spot of light at each position contacted by the electron
beam, such phenomenon is known as fluorescence / phosphorescence.
- It last just a fraction of millisecond.

Persistence
- How long a phosphor continues to emit light after the electron beam is removed?
- Persistence of phosphor is defined as time it takes for emitted light to decay to 1/10
(10%) of its original intensity. Range of persistence of different phosphors can react many
seconds.
- The phosphor used for graphics display device usually have persistence of 10 to 60
microsecond.

Resolution
- Resolution is defined as the maximum number of points that can be displayed
horizontally and vertically without overlap on display device.

Horizontal scan rate


- The horizontal scan rate is the number of scan lines per second. The rate is approximately
the product of the refresh rate and the number of scan lines.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


4 Computer Graphics (Reference Note) BSc.CSIT

Aspect Ratio
- It gives the ratio of vertical point to horizontal point necessary to produce equal length
lines in both directions on the screen.
- An aspect ratio of ¾ means that a vertical line plotted with 3 points has the same length as
a horizontal line plotted with 4 points.

Refresh Rate
- Light emitted by phosphor fades very rapidly, so to keep the drawn picture glowing
constantly; it is required to redraw the picture repeatedly and quickly directing the
electron beam back over the some point. The no of times/sec the image is redrawn to give
a feeling of non-flickering pictures is called refresh-rate.
- If Refresh rate decreases, flicker develops.
- Refresh rate above which flickering stops and steady it may be called as critical fusion
frequency (CFF).

Raster and Vector Graphics


A raster image is made up of pixels, each a different color, arranged to display an image
where as a vector image is made up of paths, each with a mathematical formula (vector), that
tells the path how it is shaped and what color it is bordered with or filled by.

Raster Graphics Vector Graphics


Raster graphics are composed of pixels. Vector graphics are composed of paths.
Raster image pixels do not keep on their Vector images keep on appearance
appearance as size increases- when you regardless of size, since the mathematical
blow a photograph up, it becomes blurry for formulas dictate how the image is rendered.
this reason.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


5 Computer Graphics (Reference Note) BSc.CSIT

Display Technologies:

A. Raster Scan display


- In raster scan system, the electron beam is swept across the screen, one row at a time
from top to bottom. As electron beam moves across each row, the beam intensity is
turned on and off to create a pattern of illuminated spots.
- Picture definition is stored in memory called frame buffer or refresh buffer. This memory
holds the set of intensity values for all the screen points. Stored intensity values are then
retrieved from the frame buffer and painted on the screen one row at a time.
- Returning of electron beam from right end to left end after refreshing each scan line is
called horizontal retrace.
- At the end of each frame, the electron beam returns to the top left corner to begin next
frame called vertical retrace.

Interlaced vs. non-interlaced scan (refresh procedure)


 In interlaced scan, each frame is displayed in two passes. First pass for odd scan lines
and another for even ones.
 In non-interlaced refresh procedure, electron beam sweeps over entire scan lines in a
frame from top to bottom in one pass.

Architecture of Raster Scan display system:

Fig: Architecture of raster-graphics system with a display processor

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


6 Computer Graphics (Reference Note) BSc.CSIT

- There is a special purpose processor called video controller or display controller, is used
to control the operation of the display device.
- When a particular command is called by the application program, the graphics subroutine
package sets the appropriate pixels in the frame buffer. The video controller then cycles
through the frame buffer, one scan line at a time. It will bring a value of each pixel
contained in the frame buffer and uses it to control the intensity of the CRT electron
beam.
- The display processor is a separate processor that performs graphics function such as scan
conversion and raster operation.
- System memory holds data and those program that execute on the CPU.
- The display processor memory holds data plus program that perform scan conversion and
raster operation.
- The frame buffer stores displayable image created by scan conversion & raster operation.
Advantages:
- It has an ability to fill the areas with solid colors or patterns
- The time required for refreshing is independent of the complexity of the image
- Low cost
Disadvantages:
- Its resolution is poor.
- For Real-Time dynamics not only the end points are required to move but all the pixels in
between the moved end points have to be scan converted with appropriate algorithms
which might slow down the dynamic process.

Video controller

- It is a special-purpose processor used to control the operation of the display device.


- Two Registers (𝑥 𝑎𝑛𝑑 𝑦) are used to store screen pixel coordinates.
- Initially, 𝑥 = 0 𝑎𝑛𝑑 𝑦 = 0
- As first scan line is generated, the x register is incremented up to 𝑥𝑚𝑎𝑥 . Each pixel value
is fetched and used to control the intensity of CRT beam. After first scan line, 𝑥 register
address is reset to 0 and 𝑦 register address is incremented by 1. The process is continued
until the last scan line (𝑦 = 𝑦𝑚𝑎𝑥 ) is generated.
https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel
7 Computer Graphics (Reference Note) BSc.CSIT

B. Random Scan (Vector) Display

- In random scan system, the electron beam is directed only to the part of screen where the
picture is to be drawn. It draws a picture one line at a time, so it is also called vector
display.
- Picture definition is stored as a set of line drawing commands in an area of memory called
refresh display file.
- To display a picture, the system cycles through the set of commands in the display file.
After all commands are processed, the system cycle backs to the first line command in the
list.
Architecture of Random Scan system:

Fig: Architecture of vector display system


- The graphics command in the application program are translated by the graphics package
into a display list (display file) stored in system memory. The display list is accessed by
the display processor to refresh the screen. The display processor cycles through each
command in the display list once during each refresh cycle.
- Graphics are drawn on a vector display system by directing the electron beam along
component lines of the picture.
Advantages:
- Can produce output with high resolutions.
- Better for animation than raster system since only end point information is needed.

Disadvantages:
- Cannot fill area with pattern and manipulate bits.
- Refreshing image depends upon its complexity.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


8 Computer Graphics (Reference Note) BSc.CSIT

C. Color CRT monitor


The CRT displays color picture by using the combination of phosphorous that emits different
color light. By combining the emitted light from the different phosphorous range of color can
be generate. Two basic technique for producing color display with CRT are:
1. Beam penetration method.
2. Shadow-mask Method.
1. Beam penetration method:
- This method is commonly used for random scan system.
- In beam penetration method, two layers of phosphor usually red and green are coated on
the CRT screen, and displayed color depends on how far the electron beam penetrates
into phosphor layer.
- Slow electron beam excites only the outer red layer.
- Very fast electron beam penetrates through red and excites the inner green layer.
- Intermediate beam speeds produce combination of red and green light.
Limitations:
- Quality of picture is not good as with other methods.
- It is an inexpensive way to produce color in random scan monitors, but only four colors
are possible.

2. Shadow mask method:


- This method is commonly used in raster scan systems because they can produce wide
range of colors than beam penetration.
- A shadow mask CRT has three phosphor color dots at each pixel position. One emits red
light, another emits green light and third emits blue light.
- The CRT has three electron guns, one for each color dot and shadow-mask grid is placed
just behind the phosphor coated screen.
- Two types of arrangements are there for shadow-mask method:
 Delta-delta arrangement
 In-line arrangement

D. Direct-View Storage Tubes (DVST)


- A Direct-View storage tube is a type of CRT that stores the picture information as a
charge distribution just behind the phosphor coated screen.
- Two electron guns are used in DVST:
 Primary gun: Used to store the picture pattern.
 Flood gun: Used for maintaining the picture display.
Advantages:
- No refreshing is needed.
- Very complex picture can be displayed at very high resolutions without flicker.
Disadvantages:
- To update any part of image must redraw all parts of image.
- Ordinarily, do not display color.
- To erasing and redrawing process can take several second for a picture.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


9 Computer Graphics (Reference Note) BSc.CSIT

E. Flat Panel Display


- Flat-Panel Display refers to a class of video devices that have reduced volume, weight
and power requirements compared to CRT.
- There are two categories of flat panel displays:
 Emissive Displays (or emitters): Emissive displays are device that convert
electrical energy into light. E.g. Plasma panels, light emitting diode etc.
 Non-emissive Displays (or non-emitters): Non-emissive displays use optical
effects to convert sunlight or light from other sources into graphics pattern. E.g.
Liquid Crystal Display (LCD).
Liquid Crystal Display (LCD): A LCD is a thin, flat display device made up of any number
of pixels arrayed in front of light source or reflector. It uses very small amounts of electric
power, and is suitable for use in battery-powered electronic devices.

Comparison of Raster scan system and Random scan system


Raster scan system Random scan system
The electron beam is swept across the screen, one The electron beam is directed only to the
row at a time, from top to bottom. parts of screen where a picture is to be
drawn.
Its resolution is poor. Its resolution is good.
Picture definition is stored as a set of intensity Picture definition is stored as a set of line
values for all screen point. drawing instructions in a display file.
Screen points / pixels are used to draw image. Mathematical functions are used to draw an
image.
Used in system to display realistic images. Cannot draw realistic shaded scenes.
Cost is low. Cost is high.
Graphics primitives are specified in terms of their Scan conversion is not required.
endpoints and must be scan converted into their
corresponding pixels in the frame buffer.

Some Numerical Problems


Q. Consider a RGB raster system is to be designed using 8 inch by 10 inch screen with a
resolution of 100 pixels per inch in each direction. If we want to store 8 bits per pixel in the
frame buffer, how much storage do we need for the frame buffer?
Solution:
Size of screen = 8 inch × 10 inch
Pixel per inch (Resolution) = 100
Total no. of pixel = (8*100)*(10*100) = 800000 pixels
Per pixel storage = 8 bit
Total storage required in frame buffer = 800000*8 bits = 6400000 bits
= 6400000/8 bytes = 800000 byte

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


10 Computer Graphics (Reference Note) BSc.CSIT

Q. There is a system with 24 bits per pixel and resolution of 1024 by 1024. Calculate the
size of frame buffer.
Solution:
Resolution = 1024 × 1024
Total number of pixel = 1024*1024 = 1048576 pixels
Per pixel storage = 24 bits
Total storage required in frame buffer = 1048576*24 = 25165824 bits
= 25165824/8 byte
= 25165824/(8*1024) kb
= 25165824/(8*1024*1024)Mb
= 3 Mb

Q. Consider raster system with resolution 1280 ×1024.


a) How much pixel could be accessed per second by the video controller that
refreshes the screen at the rate of 60 frames / second?
b) What is the access time per pixel?
Solution:
a) No. of pixel accessed per second = 1280*1024*60 = 78643200 pixels
b) Since 78643200 pixels are accessed in 1 second
1
Access time per pixel = 78643200 = 12.7 𝑛𝑎𝑛𝑜𝑠𝑒𝑐.

Q. Consider a raster scan system having 12 inch by 12 inch with a resolution of 100 pixels
per inch in each direction. If display controller of this system refresh the screen at the rate
of 50 frames per second, how many pixels could be accessed per second and what is the
access time per pixel of the system.
Solution:
Size of screen = 12 inch × 12 inch
Resolution = 100 pixels per inch
Total no. of pixels in one frame = (12*100)*(12*100)
Refresh rate = 50 frames per second
i.e. 50 frames can be accessed in 1 sec.
Total no. of pixel accessed in 1 sec = 50*(12*100)*(12*100) = 72000000 pixels
Again,
50 frames can be accessed in 1 sec.
1 frames can be accessed in 1/50 sec.
(12*100*12*100) frames can be accessed in 1/50 sec.
Then, 1 pixel can be accessed in 1/(50*12*100*12*100) sec.
= 109/(50*12*100*12*100) ns
= 13.88 ns.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


11 Computer Graphics (Reference Note) BSc.CSIT

Q. How many k bytes does a frame buffer needs in a 600 × 400 pixels?
Solution:
Suppose n bits are required to store 1 pixels.
Then, the size of frame buffer = resolution * bits per pixel
= (600*400)*n bits
= 240000 n/(8*1024) Kb
= 29.30 Kb

Q. Find the aspect ratio of raster system using 8 × 10 inches screen and having 100
pixels/inch.
Solution:
We know that,
𝑤𝑖𝑑𝑡ℎ 8∗100 4
Aspect ratio = ℎ𝑒𝑖𝑔ℎ𝑡 = 10∗100 = 5

So, aspect ratio = 4:5

Q. What is the time required to display a pixel on the monitor of size 1024 × 768 with
refresh rate of 60 Hz?
Solution:
Refresh rate = 60Hz i.e. 60 frames per second
Total no. of pixel in one frame = 1024*768 = 786432 pixels
60 frames need 1 sec.
1 frame need 1/60 sec.
786432 pixels need 1/60 sec.
1 pixel need 1/(60*786432) sec. = 109/(60*786432) ns = 21.19 ns

Q. How much time is spent scanning across each row of pixels during screen refresh on a
raster system with resolution 1280 ×1024 and refresh rate of 60 frames per second?
Solution:
Resolution = 1280 × 1024
i.e. one frame contains 1024 scan line and each scan line consists of 1280 pixels.
Refresh rate = 60 frames per second
i.e. 60 frames take 1 second.
1 frame takes 1/60 second.
i.e. 1024 scan line take 1/60 second i.e. 0.0166 sec.
1 scan line take 0.0166/1024 =0.016 sec.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


12 Computer Graphics (Reference Note) BSc.CSIT

Q. If a pixel is accessed from the frame buffer with an average access time of 300ns then
will this rate produce an un-flicking effect for the screen size of 640 × 480.
Solution:
Size of screen = 640 × 480
Total no. of pixels = 640*480=307200
Average access time of one pixel = 300 ns
Total time required to access entire pixels of image in the screen = 307200*300= 92160000ns
= 92160000/109 sec
= 0.09216 sec
i.e. one cycle take 0.09216 sec.
Now, no. of cycles per second i.e. refresh rate =?
0.09216 sec = 1 cycle
1 sec = 1/0.09216
=10.86
Refresh rate = 10.86 cycles per second.
Since the minimum refresh rate for unflicker image is 60 frames per second, hence we can
say the monitor produces flickering effect.

Q. Calculate the total memory required to store a 10 minute video in a SVGA system with
24 bit true color and 25 fps.
Solution:
The SVGA system allows resolution = 800 × 600
Refresh rate = 25 fps
i.e. 25 frames take 1 second
1 frame takes 1/25 second = 0.04 second
Size of video =10 minutes = 10*60 = 600 second
Total memory required = 800 × 600 × 600 × 0.04× 24 bit
= 276480000 /(8*1024*1024) Mb
= 32.959 Mb

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


13 Computer Graphics (Reference Note) BSc.CSIT

Graphics Software

There are two general categories of graphics software


 General programming packages:
 Provides extensive set of graphics functions for high level languages
(FORTRAN, C etc).
 Basic functions include those for generating picture components (straight lines,
polygons, circles, and other figures), setting color and intensity values, selecting
views, and applying transformations.
 Example: GL(Graphics Library)

 Special-purpose application packages:


 Designed for nonprogrammers, so that users can generate displays without
worrying about how graphics operations work.
 The interface to the graphics routines in such packages allows users to
communicate with the programs in their own terms.
 Example: artist's painting programs and various business, medical, and CAD
systems.

Software standards

Primary goal of standardized graphics software is portability. When packages are designed
with standard graphics functions, software can he moved easily from one hardware system to
another and used in different implementations and applications. International and national
standards planning organizations in many countries have cooperated in an effort to develop a
generally accepted standard for computer graphics. After considerable effort, this work led to
following standards:

 GKS (Graphical Kernel System): This system was adopted as the first graphics software
standard by the International Standards Organization (ISO) and American National
Standards Institute (ANSI). Although GKS was originally designed as a two-dimensional
graphics package, a three dimensional GKS extension was subsequently developed.

 PHIGS (Programmer’s Hierarchical Interactive Graphics Standard): Extension to


GKS, Increased Capabilities for object modeling, color specifications, surface rendering
and picture manipulations are provided. Subsequently, an extension of PHIGS, called
PHIGS+, was developed to provide three-dimensional surface-shading capabilities not
available in PHIGS.
Although PHIGS presents a specification for basic graphics functions, it does not provide
a standard methodology for a graphics interface to output devices (i.e. still machine
dependent). Nor does it specify methods for storing and transmitting pictures. Separate
standards have been developed for these areas:
 CGI (Computer Graphics interface): Standardization for device interface
 CGM (Computer Graphics Metafile): Standards for archiving and transporting
pictures

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


14 Computer Graphics (Reference Note) BSc.CSIT

Coordinate Representations
Normally, graphics package require coordinate specification to be given with respect to
Cartesian reference frames. Each object for a scene can be defined in a separate modeling
Cartesian coordinate system, which is then mapped to world coordinates to construct the
scene. From world coordinates, objects are transferred to normalized device coordinates, then
to the final display device coordinates. The transformations from modeling coordinates to
normalized device coordinate are independent of particular devices that might be used in an
application. Device drivers are then used to convert normalized coordinates to integer device
coordinates.
An initial modeling-coordinate position (𝑥𝑚𝑐 , 𝑦𝑚𝑐 ) in this illustration is transferred to a
device coordinate position (𝑥𝑑𝑐 , 𝑦𝑑𝑐 ) with the sequence:
(𝑥𝑚𝑐 , 𝑦𝑚𝑐 ) → (𝑥𝑤𝑐 , 𝑦𝑤𝑐 ) → (𝑥𝑛𝑐 , 𝑦𝑛𝑐 ) → (𝑥𝑑𝑐 , 𝑦𝑑𝑐 )

PHIGS Workstations
Generally, the term workstation refers to a computer system with a combination of input and
output devices that is designed for a single user. Some graphics system, such as PHIGS and
GKS, use the concept of a “workstation” to specify devices or software that are to be used for
input or output in a particular application. A workstation identifier in these system can refer
to a file; a single devices, such as a raster monitor; or a combination of devices, such as a
monitor, keyboard, and a mouse. Multiple workstation can be open to provide input or to
receive output in a graphics application.

Color Models
A color model is a method for explaining the properties or behavior of color within some
particular context. No single color model can explain all aspects of color, so we make use of
different models to help describe the different perceived characteristics of color.

Physical properties of light


- White light consists of a spectrum of all visible colors.
- All kinds of light can be described by the energy of each wavelength.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


15 Computer Graphics (Reference Note) BSc.CSIT

Most light we see is not just a single wavelength, but a combination of many wavelengths
like below. This profile is often referred to as a spectrum, or spectral power distribution.

Frequency:
 Red: 3.8 × 1014 ℎ𝑒𝑟𝑡𝑧
 Violet: 7.9 × 1014 ℎ𝑒𝑟𝑡𝑧
Wavelength:
 Red: 700 nm
 Violet 400 nm

 There are two types of color models: Subtractive and Additive.


Additive color models use light to display color while subtractive models use printing inks.
Colors perceived in additive models are the result of transmitted light. Colors perceived in
subtractive models are the result of reflected light.

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


16 Computer Graphics (Reference Note) BSc.CSIT

RGB (Red, Green, Blue) color model


- The RGB color model used in color CRT monitors.
- In this model, Red, Green and Blue are added together to get the resultant color white.

- Each color point within the bounds of the cube is represented as the triple (R, G, B),
where value for R, G, B are assigned in the range from 0 to 1.
- Here RGB color place together at 120 degree.
- All other colors are generated from these three primary colors.

CMY (Cyan, Magenta, Yellow) color model


- The CMY color model used in color printing devices.
- In his model, Cyan, Magenta, and Yellow are added together to get the resultant color
BLACK.

Relation between RGB and CMY:

 c   1  r 
 m   1   g
     
y 1 b

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


17 Computer Graphics (Reference Note) BSc.CSIT

CMYK (Cyan, Magenta, Yellow, Black) color model


- For printing and art industry the CMY model is not enough. So, fourth primary color K
(Black) is added to CMY model.
- CMYK (subtractive color model) is the standard color model used in offset printing for
full-color document. Because such printing uses inks of these four basic colors, it is often
called four-color printing.

HSV (Hue, Saturation, Value) color model


- HSV is a cylindrical coordinate representation of points in an RGB color model.
Hue: the dominant color as perceived by an observer
Saturation: the amount of white light mixed with Hue
Value: the chromatic notion of intensity
- HSV is described by a hexacone derived from the RGB cube.
- (h, s, v), where h  [0, 360) and s, v  [0, 1]
hue: angle round the hexagon
saturation: distance from the center
value: axis through the center

Color cube Hexacone

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel


18 Computer Graphics (Reference Note) BSc.CSIT

References
- Donald Hearne and M.Pauline Baker, “Computer Graphics, C Versions.” Prentice
Hall

https://collegenote.pythonanywhere.com Prepared By: Jayanta Poudel

You might also like