Вы находитесь на странице: 1из 18

February 2010

Master of Computer Application (MCA) –


Semester 3
MC0072 – Computer Graphics
Assignment Set - 1

1. Describe the following:


A) Image Processing as Picture Analysis
B) Advantages of Interactive Graphics
C) Representative Uses of Computer Graphics

Ans –

A) Image Processing as Picture Analysis

The computer graphics is a collection, contribution and representation


of real or imaginary objects from their computer-based models. Thus we
can say that computer graphics concerns the pictorial synthesis of real or
imaginary objects. However, the related field image processing or
sometimes called picture analysis concerns the analysis of scenes, or the
reconstruction of models of 2D or 3D objects from their picture. This is
exactly the reverse process. The image processing can be classified as

· Image enhancement

· Pattern detection and recognition

· Scene analysis and computer vision

The image enhancement deals with the improvement in the image


quality by eliminating noise or by increasing image contrast. Pattern
detection and recognition deal with the detection and clarification of
standard patterns and finding deviations from these patterns. The optical
character recognition (OCR) technology is an practical example of
pattern detection and recognition. Scene analysis and computer vision
deals with the recognition and construction of 3D model of scene from
several 2 D images.
The above three fields of image processing proved their importance in
many area such as finger print detection and recognition, modeling of
building, ships, automobiles etc. , and so on.

We have discussed the two fields: computer graphics and image


processing of computer processing of picture. In the initial stages they
were quite separate disciplines. But now a days they use some common
features, and overlap between them is growing. They both uses raster
displays.

B) The advantages of Interactive Graphics

Let us discuss the advantages of interactive graphics.

· Today, a high quality graphics display of personal computer provide one


of the most natural means of communication with a computer.

· It provides tools for producing pictures not only of concrete, “real-


world” objects but also of abstract, synthetic objects, such as
mathematical surfaces in 4D and of data that have no inherent
geometry, such as survey results.

· It has an ability to show moving pictures, and thus it is possible to


produce animations with interactive graphics.

· With interactive graphics use can also control the animation by


adjusting the speed, the portion of the total scene in view, the geometric
relationship of the objects in the scene to one another, the amount of
detail shown and so on.

· The interactive graphics provides tool called motion dynamics. With


this tools user can move and tumble objects with respect to a stationary
observer, or he can make objects stationary and the viewer moving
around them. A typical example is walk throughs made by builder to
show flat interior and building surroundings. In many case it is also
possible to move both objects and viewer.

· The interactive graphics also provides facility called update


dynamics. With update dynamics it is possible to change the shape,
colour or other properties of the objects being viewed.

· With the recent development of digital signal processing (DSP) and


audio synthesis chip the interactive graphics can now provide audio
feedback along with the graphical feedbacks to make the simulated
environment even more realistic.

In short, interactive graphics permits extensive, high-bandwidth user-


computer interaction. It significantly enhances the ability to understand
information, to perceive trends and to visualize real or imaginary objects
either moving or stationary in a realistic environment. It also makes it
possible to get high quality and more precise results and products with
lower analysis and design cost.

C) Representative Uses of Computer Graphics

The use of computer graphics is wide spread. It is used in various


areas such as industry, business, government organizations, education,
entertainment and most recently the home. Let us discuss the
representative uses of computer graphics in brief.

· User Interfaces: User friendliness is one of the main factors


underlying the success and popularity of any system. It is now well
established fact that graphical interfaces provide and attractive and easy
interaction between users and computers. The built-in graphics provided
with user interfaces use visual control items such as buttons, menus,
icons, scroll bar etc, which allows user to interact with computer only by
mouse-click. Typing is necessary only to input text to be stored and
manipulated.

· Plotting of graphics and chart: In industry, business, government


and educational organizations, computer graphics is most commonly
used to create 2D and 3D graphs of mathematical, physical and
economic functions in form of histograms, bars and pie-charts. These
graphs and charts are very useful for decision making.

· Office automation and Desktop Publishing: The desktop publishing


on personal computers allow the use of graphics for the creation and
dissemination of information. Many organizations does the in-house
creation and printing of documents. The desktop publishing allows user
to create documents which contains text, tables, graphs and other forms
of drawn or scanned images or pictures. This is one approach towards
the office automation.

· Computer-aided Drafting and Design: The computer-aided drafting


uses graphics to design components and systems electrical, mechanical,
electromechanical and electronic devices such as automobile bodies,
structures of building, airplane, ships, very large-scale integrated (VLSI)
chips, optical systems and computer networks.

· Simulation and Animation: Use of graphics in simulation makes


mathematical models and mechanical systems more realistic and easy to
study. The interactive graphics supported by animation software proved
their use in production of animated movies and cartoons films.

· Art and Commerce: There is a lot of development in the tools


provided by computer graphics. This allows user to create artistic
pictures which express messages and attract attentions. Such pictures
are very useful in advertising.
· Process Control: By the use of computer now it is possible to control
various processes in the industry from a remote control room. In such
cases, process systems and processing parameters are shown on the
computer with graphic symbols and identifications. This makes it easy
for operator to monitor and control various processing parameters at a
time.

· Cartography: Computer graphics is also used to represent geographic


maps, weather maps, oceanographic charts, contour maps, population
density maps and so on.

2. Explain the following with the help of relevant real


time applications:
A) Classification of Applications
B) Development of Hardware and Software for
Computer Graphics
Ans –

A) Classification of Applications

In the last section we have seen various uses of computer graphics.


These uses can be classified as shown in the figure below. As shown in
the figure below the use of computer graphics can be classified
according to dimensionality of the object to be drawn: 2D or 3D. It can
also be classified according to kind of picture: Symbolic or Realistic.
Many computer graphics applications are classified by the type of
interaction. The type of interaction determines the user’s degree of
control over the object and its image. In controllable interaction user can
change the attributes of the images. Role of picture gives the another
classification. Computer graphics is either used for representation or it
can be an end product such as drawings. Pictorial representation gives
the final classification to use computer graphics. It classifies the use of
computer graphics to represent pictures such as line drawing, black and
white, colour and so on.
B) Development of Hardware and Software for Computer
Graphics

The development of hardware of computer graphics involves the


development of input and output device technology. Therefore, in all
development of computer graphics involves the development in three
fields:

1. Output technology

2. Input technology and

3. Software technology

1.6.1 Output Technology

Figure below shows the historical development in the output


technology. In early days of computer the hardcopy devices such as
teletype printer and line printer were in use with computer driven CRT
displays. In mid fifties command and control CRT display consoles were
introduced. The more display devices developed in mid-sixties and in
common use until the mid-eighties, are called vector, stroke, line
drawing or calligraphic displays. The term vector is used as a synonyms
for line; a stroke is a short line, and characters are made of sequence of
such strokes.

Architecture of a Vector Display

Vector Scan CRT


As shown in Figure above vector scan CRT display directly traces
out only the desired lines on CRT i.e If we want a line connection point A
with point B on the vector graphics display. We simply drive the beam
deflection circuitry which will cause beam to go directly from point A to
B. If we want to move the beam from point A to point B without showing
a line between points, we can blank the beam as we move it. To move
the beam across the CRT, the information about both, magnitude and
direction is required. This information is generated with the help of
vector graphics generator.

The figure below shows the typical vector display architecture. It


consists of display controller, Central Processing Unit (CPU), display
buffer memory and a CRT. A display controller is connected as an I/O
peripheral to the central processing unit (CPU). The display buffer
memory stores the computer produced display list or display program.
The program contains point and line plotting commands with (x,y) or
(x,y,z) end point coordinates, as well as character plotting commands.
The display controller interprets commands for plotting points, lines and
characters and sends digital and point coordinates to a vector generator.
The vector generator then converts the digital coordinates values to
analog voltages for beam-deflection circuits that displace an electron
beam writing on the CRT’s phosphor coating.

In vector displays beam is deflected from end point to end point,


hence this technique is also called random scan. We know as beam,
strikes phosphor it emits light. But phosphor light decays after few
milliseconds and therefore it is necessary to repeat through the display
list to refresh the phosphor at least 30 times per second to avoid flicker.
As display buffer is used to store display list and it is used for refreshing,
the display buffer memory is also called refresh buffer.

Architecture of a Raster Display

The figure gbelow shows the architecture of a raster display. It


consists of display controller, central processing unit (CPU), video
controller, refresh buffer, keyboard, mouse and the CRT.
Architecture of a raster display

As shown in the Figure above, the display images stored in the


form of 1s and 0s in the refresh buffer. The video controller reads this
refresh buffer and produces the actual image on the screen. It does this
by scanning one scan line at a time, from top to bottom and then back to
the top.

Raster Scan CRT

In this method, the horizontal and vertical deflection signals are


generated to move the beam all over the screen in a pattern shown in
the Figure above.

Here, the beam is swept back forth from left to right across the
screen. When the beam is moved from the left to right, it is ON. The
beam OFF, when it is moved from right to left as shown by dotted line in
Figure above.

When the beam reaches the bottom of the screen, it is made OFF
and rapidly retraced back to the top to start again. A display produced in
this way is called raster scan display. Raster scanning process is similar
to reading different lines on the page of a book. After completion of
scanning of one line, the electron beam files back to the start of next line
and process repeats. In the raster scan display, the screen images is
maintained by repeating scanning the same image. This process is
known as refreshing of screen.

Vector Scan Display Raster Scan Display


1. In vector scan display1. In raster scan display the beam
the beam is movedis moved all over the screen one
between the end points ofscan line at a time, from top to
the graphics primitives bottom and then back to top.
2. Vector display flickers2. In raster display, the refresh
when the number ofprocess is independent of the
primitives in the buffercomplexity of the image.
becomes too large.
3. Scan conversion is not3. Graphics primitives are
required. specified in terms of their
endpoints and must be scan
converted into their corresponding
pixels in the frame buffer.
4. Scan conversion4. Because each primitive must be
hardware is not required. scan converted, real time
dynamics is far more
computational and requires
separate scan conversion
hardware.
5. Vector display draws a5. Raster display can display
continuous and smoothmathematically smooth line,
lines polygons and boundaries of
curved primitives only by
approximating them with pixels on
the raster grid.
6. Cost is more. 6. Cost is low.
7. Vector display only7. Raster display has ability to
draws lines anddisplay areas filled with solid
characters. colors or patterns.

Direct-view storage tubes

In last sixties, the direct-view storage tube (DVST) was introduced


in the display technology. The direct-view storage tubes (DVST) give the
alternative method of maintaining the screen image. A DVST uses the
storage grid which stores the picture information as a charge distribution
just behind the phosphor-coated screen.

The Figure below shows the general arrangement of the DVST. It


consists of two electron guns: a primary gun and a flood gun.
Arrangement of DVST

A primary gun stores the picture pattern and the flood gun
maintains the picture display. A primary gun produces high speed
electrons which strike on the storage grid to draw the picture pattern. As
electron beam strikes on the storage grid with high speed, it knocks out
electrons from the storage grid keeping the positive charge. The knocked
out electrons are attracted towards the collector. The net positive
charges on the storage grid is nothing but the picture pattern. The
continuous low speed electrons from flood gun pass through the control
grid and are attracted to the positive charged areas of the storage grid.
The low speed electrons then penetrate the storage grid and strike the
phosphor coating without affecting the positive charge pattern on the
storage grid. During this process the collector just behind the storage
grid smooth out the flow of flood electrons.

Advantages of DVST

1. Refreshing of CRT is not required.

2. Because no refreshing is required, very complex pictures can be


displayed at very high resolution without flicker.

3. It has flat screen.

Disadvantages of DVST

1. They do not display colors and are available with single level of line
intensity.

2. Erasing requires removal of change on the storage grid. Thus erasing


and redrawing process takes several seconds.

3. Selective or part erasing of screen is not possible.

4. Erasing of screen produces unpleasant flash over the entire screen


surface which prevents its use of dynamic graphics applications.
5. It has poor contrast as a result of the comparatively low accelerating
potential applied to the flood electrons.

6. The performance of DVST is some what inferior to the refresh CRT.

In early seventies the inexpensive raster graphics displays were


developed. Raster displays store the display primitives (such as lines,
characters solid and filled patterns) in a refresh buffer in terms of their
corresponding pixels.

Input Technology

Input technology has also improved greatly over the years.


Number of input devices were developed over the years. These devices
are punch cards, light pens, keyboard, tables, mouse and scanners.

Software Technology

Like output and input technology there is a lot of development in


the software technology. In early days low level software were available.
Over the years software technology moved from low level to device
dependent and then to device independent packages. The device
independent packages are high level packages with can drive a wide
variety of display and printer devices. As a need for the device
independent package a standardization is made and specification are
decided. The first graphics specification to be officially standardized was
GKS (the Graphical Kernel System). GKS supports the grouping of
logically related primitives such as lines, polygons, and character strings
and their attributes in collected form called segments. In 1988, a 3D
extension of GKS, became an official standard, as did a much more
sophisticated but even more complex graphics system called PHIGS
(Programmer’s Hierarchical Interactive Graphics System).

PHIGS, as its name implies, supports nested hierarchical grouping


of 3D primitives, called structures. In PHIGS, all primitives are
subjected to geometric transformations such as scaling, rotation and
translation to accomplish dynamic movement. PHIGS also supports a
database of structures the programmer may edit and modify. PHIGS
automatically updates the display whenever the database has been
modified.

3. Explain the following with respect to Graphics


Hardware:
A) Graphics Workstation B) Video Controller
C) Color Tables
Ans –
A) Graphics Workstation

Graphics Workstation is the Graphics Kernel System’s (GKS) term for a


graphical device that can display graphical output or accept graphical
input or both.

The figure below shows the block diagram of typical graphics station.
It consists of CPU, display processor, memory, display devices, recorder,
plotter, joystick, keyboard, light pen mouse, scanner etc, the main
hardware components of a graphics workstation are CPU and Display
Processor. The display processor is also called a graphics controller or a
display coprocessor. It makes CPU free from the graphical chores. In
addition to the system memory, a separate display processor memory
area is provided in graphics workstations. Graphics workstations have a
provision to interface video cameras and television set. The size of the
display device, colors supported by it, whether it is a raster or line
drawing device are the main properties of the graphics workstation. The
graphics workstation is always supported with graphics software.
Graphics software acts as a very powerful tool to create scenes, images,
pictures and also animated pictures.

block diagram of typical workstation

B) Video Controller

We know that the video controller receives the intensity


information of each pixel from frame buffer and display them on the
screen. Let us see the internal organization of a video controller.

The figure below shows the internal organization of a video


controller. It consists of raster-scan generator, x and y address registers
and pixel value register. The raster-scan generator produces deflection
signals that generate the raster scan. The raster scan generator also
controls the x and y address registers which in turn define the memory
location to be accessed next. Frarne buffer locations, and the
corresponding screen positions, are referenced in Cartesian coordinates.
For many graphics monitors, the coordinate origin is defined at the lower
left screen corner. The screen surface is then represented as the first
quadrant of a two-dimensional system, with positive x values increasing
to the right and positive y values increasing from bottom to top. (On
some personal computers, the coordinate origin is referenced at the
upper left comer of the screen, so the y values are inverted.) Scan lines
are then labeled from y, at the top of the screen to 0 at the bottom.
Along each scan line, screen pixel positions are labeled from 0 to xmax.
During each fetch the pixel value is read and is used to control the
intensity of the CRT beam.

Simple organization of Video Controller

C) Color tables

In color displays, 24- bits per pixel are commonly used, where 8-bits
represent 256 levels for each color. Here it is necessary to read 24-bits
for each pixel from frame buffer. This is very time consuming. To avoid
this video controller uses look up table (LUT) to store many entries of
pixel values in RGB format. With this facility, now it is necessary only to
read index to the look up table from the frame buffer for each pixel. This
index specifies the one of the entries in the look-up table. The specified
entry in the loop up table is then used to control the intensity or color of
the CRT.

Usually, look-up table has 256 entries. Therefore, the index to the
look-up table has 8-bits and hence for each pixel, the frame buffer has to
store 8-bits per pixel instead of 24 bits. Figure below shows the
organization of a color (Video) look-up table.

Organization of a Video look-up table

There are several advantages in storing color codes in a lookup


table. Use of a color table can provide a "reasonable" number of
simultaneous colors without requiring Iarge frame buffers. For most
applications, 256 or 512 different colors are sufficient for a single picture.
Also, table entries can be changed at any time, allowing a user to be able
to experiment easily with different color combinations in a design, scene,
or graph without changing the attribute settings for the graphics data
structure. In visualization and image-processing applications, color tables
are convenient means for setting color thresholds so that all pixel values
above or below a specified threshold can be set to the same color. For
these reasons, some systems provide both capabilities for color-code
storage, so that a user can elect either to use color tables or to store
color codes directly in the frame buffer.

4. Describe the following:


A) Basic Concepts in Line Drawing
B) Digital Differential Analyzer Algorithm
C) Bresenham’s Line Drawing Algorithm
Ans –

A) Basic Concepts in Line Drawing

Before discussing specific line drawing algorithms it is useful to note the


general requirements for such algorithms. These requirements specify
the desired characteristics of line.

· The line should appear as a straight line and it should start and end
accurately.

· The line should be displayed with constant brightness along its length
independent of its length and orientation.

· The line should be drawn rapidly.

Let us see the different lines drawn in Fig.3.5.

a) Vertical and horizontal lines b) 450 line


c) Lines with other orientation

As shown in Figure a horizontal and vertical lines are straight and


have same width. The 450 line is straight but its width is not constant. On
the other hand, the line with any other orientation is neither straight nor
has same width. Such cases are due to the finite resolution of display
and we have to accept approximate pixels in such situations, shown in
Fig.3.5 (c).

The brightness of the line is dependent on the orientation of the


line. We can observe that the effective spacing between pixels for the
450 line is greater than for the vertical and horizontal lines. This will make
the vertical and horizontal lines appear brighter than the 450 line.
Complex calculations are required to provide equal brightness along
lines of varying length and orientation. Therefore, to draw line rapidly
some compromises are made such as

· Calculate only an approximate line length.

· Reduce the calculations using simple integer arithmetic

· Implement the result in hardware or firmware

B) DDA Line Algorithm

1. Read the line end points (x1,y1 ) and (x2,y2) such that they are not
equal.

[if equal then plot that point and exit]

2. ∆x = and ∆y =

3. If then

Length=

else

Length=
end if

4. = (x2-x1)/length

= (y2-y1)/length

This makes either or equal to 1 because the length is either


| x2-x1| or |y2-y1|, the incremental value for either x or y is 1.

5. x = x1+0.5 * sign( )

y = y1+0.5*sign( )

[Here the sign function makes the algorithm worl in all quadrant. It
returns –1, 0,1 depending on whether its argument is <0, =0, >0
respectively. The factor 0.5 makes it possible to round the values in the
integer function rather than truncating them]

6. i=1 [begins the loop, in this loop points are plotted]

7. while(i length)

Plot (Integer(x), Integer(y))

x= x+∆x

y= y+∆y

i=i+1

8. stop

C) Bressenham’s Line Drawing Algorithm

Bresenham’s line algorithm uses only integer addition and


subtraction and multiplication by 2, and we know that the computer can
perform the operations of integer addition and subtraction very rapidly.
The computer is also time-efficient when performing integer
multiplication by powers of 2. Therefore, it is an efficient method for
scan-converting straight lines.

The basic principle of Bresenham’s line algorithm is to select the


optimum raster locations to represent a straight line. To accomplish this,
the algorithm always increments either x or y by one unit depending on
the slope of line. The increment in the other variable is determined by
examining the distance between the actual line location and the nearest
pixel. This distance is called decision variable or the error. This is
illustrated in the Figure below..

As shown in the Figure above the line does not pass through all
raster points (pixels). It passes through raster point (0,0) and
subsequently crosses three pixels. It is seen that the intercept of line
with the line x=1 is closer to the line y=0,i.e. pixel(1,0) than to the line
y=1 i.e. pixel (1,1). Hence, in this case, the raster point at (1,0) better
represents the path of the line that at (1,1). The intercept, of the line
with the line x=2 is close to the line y=1, i.e. pixel (2,1) than to the line
y=0,i.e. pixel(2.0). Hence the raster point at (2,1) better represents the
path of the line, as shown in the Figure above.

In mathematical term error or decision variable is defined as

e=DB-DA Or DA-DB

Let us define e= DB-DA. Now if e>0, then it implies that DB>DA, i.e., the
pixel above the line is closer to the true line. If DB < DA (i.e.<0) then we
can say that the pixel below the line is closer to the true line. Thus by
checking only the sign of error term it is possible to determine the better
pixel to represent the line path.

The error term is initially set as e=2∆y-∆x

Where ∆y=y2-y1, and ∆x=x2-x1

Then according to value of e following actions are taken.

while (e≥0)

y=y+1

e=e-2*∆x

x=x+1
e=e+2*∆y

When e≥0, error is initialized with e=e – 2∆x. This is continued till error
is negative. In each iteration y is incremented by 1. When e<0, error is
initialized to e=e + 2∆y. In both the cases x is incremented by 1. Let us
see the Bresenham’s line drawing algorithm.

Bresenham’s Line Algorithm

1. Read the line end points (x1, y1) and (x2, y2) such that they are not
equal.

[if equal then plot that line and exit]

2. ∆x = and ∆y =

3. [initialize starting point]

x = x1

y = y1

4. e = 2 * ∆y – ∆x

[ Initialize value of decision variable or error to compensate for non zero


intercepts]

5. i = 1 [initialize counter]

6. Plot (x, y)

7. while (e >0)

y = y+1

e = e-2 * ∆x

x = x+1

e = e+2 * ∆y

8. i = i+1

9. if ( i ∆x) then go to step 6


10. stop

Вам также может понравиться