RTU Solution 5CS4-04 Computer Graphics & Multimedia
RTU Solution 5CS4-04 Computer Graphics & Multimedia
5CS4-04
Computer Graphics &
Multimedia
Part –A
Q1. What is pixel made of?
The word “pixel” means a picture element. Every photograph, in digital form, is made up of pixels. They
are the smallest unit of information that makes up a picture. Usually round or square, they are typically
arranged in a 2-dimensional grid.
It is a process of representing graphics objects a collection of pixels. The graphics objects are continuous.
The pixels used are discrete. Each pixel can have either on or off state.
The circuitry of the video display device of the computer is capable of converting binary values (0, 1) into a
pixel on and pixel off information. 0 is represented by pixel off. 1 is represented using pixel on. Using this
ability graphics computer represent picture having discrete dots.
Advantage of developing algorithms for scan conversion are we can generate graphics objects at a faster
rate. Using algorithms memory can be used efficiently. Algorithms can develop a higher level of graphical
objects. Examples of objects which can be scan converted Point,Line,Sector,Arc,Ellipse etc
Q3 Differentiate between plasma panel display and thin film electro luminous display
Plasma displays are bright, have a wide color gamut, and can be produced in fairly large sizes, up to 262 cm
(103 inches) diagonally Electroluminescence is the result of radiative recombination of electrons and holes
in a material (usually a semiconductor). lasma displays use as much power per square meter as a CRT or an
AMLCD television. EL devices have low power consumption when compared with neon signs, and have a
wide range of applications such as their use on advertising boards and safety signs.
Raster Scan
In a raster scan system, the electron beam is swept across the screen, one row at a time from top to bottom.
As the 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 area called the Refresh Buffer or Frame Buffer. This memory area
holds the set of intensity values for all the screen points. Stored intensity values are then retrieved from the
refresh buffer and “painted” on the screen one row scanlinescanline at a time as shown in the following
illustration.
Random Scan /VectorScan
In this technique, the electron beam is directed only to the part of the screen where the picture is to be drawn
rather than scanning from left to right and top to bottom as in raster scan. It is also called vector display,
stroke-writing display, or calligraphic display.
Picture definition is stored as a set of line-drawing commands in an area of memory referred to as the refresh
display file. To display a specified picture, the system cycles through the set of commands in the display file,
drawing each component line in turn. After all the line-drawing commands are processed, the system cycles
back to the first line command in the list.
Random-scan displays are designed to draw all the component lines of a picture 30 to 60 times each second.
A convex polygon is defined as a polygon with all its interior angles less than 180°. This means that all the
vertices of the polygon will point outwards, away from the interior of the shape. Think of it as a
'bulging' polygon. Note that a triangle (3-gon) is always convex
. A concave polygon is defined as a polygon with one or more interior angles greater than 180°. It looks sort
of like a vertex has been 'pushed in' towards the inside of the polygon. Note that a triangle (3-gon) can never
be concave. A concave polygon is the opposite of a convex polygon. See Convex Polygon.
Q7 What is Translations
(𝒙′, 𝒚′)
𝒕𝒚
(𝒙, 𝒚)
𝒕𝒙
Translation.
It is a transformation that used to reposition the object along the straight line path from one coordinate
location to another.
It is rigid body transformation so we need to translate wholeobject.
We translate two dimensional point by adding translation distance 𝒕𝒙and 𝒕𝒚to the original coordinate position
(𝒙, 𝒚) to move at new position (𝒙′, 𝒚′)as:
𝒙′ = 𝒙+𝒕𝒙 & 𝒚′ = 𝒚 +𝒕𝒚
In all or none string clipping method, either we keep the entire string or we reject entire string based on the
clipping window. As shown in the above figure, STRING2 is entirely inside the clipping window so we keep
it and STRING1 being only partially inside the window, we reject.
This clipping method is based on characters rather than entire string. In this method if the string is entirely
inside the clipping window, then we keep it. If it is partially outside the window, then −
You reject only the portion of the string being outside
If the character is on the boundary of the clipping window, then we discard that entire character and keep the
rest string.
This clipping method is based on characters rather than the entire string. In this method if the string is
entirely inside the clipping window, then we keep it. If it is partially outside the window, then
You reject only the portion of string being outside.
If the character is on the boundary of the clipping window, then we discard only that portion of character
that is outside of the clipping window.
It is the movement of an object from one position to another position. Translation is done using translation
vectors. There are three vectors in 3D instead of two. . Three-dimensional transformations are performed by
transforming each vertex of the object. Steps involved in 3D transformation are
Modeling Transformation
Projection Transformation
Viewing Transformation
Workstation Transformation
Part-B
It is a process of representing graphics objects a collection of pixels. The graphics objects are continuous.
The pixels used are discrete. Each pixel can have either on or off state.
The circuitry of the video display device of the computer is capable of converting binary values (0, 1) into a
pixel on and pixel off information. 0 is represented by pixel off. 1 is represented using pixel on. Using this
ability graphics computer represent picture having discrete dots.
Any model of graphics can be reproduced with a dense matrix of dots or points. Most human beings think
graphics objects as points, lines, circles, ellipses. For generating graphical object, many algorithms have
been developed.
This algorithm is used for scan converting a line. It was developed by Bresenham. It is an efficient method
because it involves only integer addition, subtractions, and multiplication operations. These operations can
be performed very rapidly so lines can be generated quickly.In this method, next pixel selected is that one
who has the least distance from true line.The method works as follows:
Assume a pixel P1'(x1 ',y1'),then select subsequent pixels as we work our may to the night, one pixel position
at a time in the horizontal direction toward P 2'(x2',y2 ').
The line is best approximated by those pixels that fall the least distance from the path between P 1',P2'.
To chooses the next one between the bottom pixel S and top pixel T.
If S is chosen
We have xi+1=xi+1 and yi+1=yi
If T is chosen
We have xi+1=xi+1 and yi+1=yi+1
This difference is
s-t = (y-yi)-[(yi+1)-y]
di=△x (s-t)
di=△x (2 (xi+1)+2b-2yi-1)
=2△xyi-2△y-1△x.2b-2yi△x-△x
di=2△y.xi-2△x.yi+c
We can write the decision variable di+1 for the next slip on
di+1=2△y.xi+1-2△x.yi+1+c
di+1-di=2△y.(xi+1-xi)- 2△x(yi+1-yi)
Special Cases
Finally, we calculate d1
d1=△x[2m(x1+1)+2b-2y1-1]
d1=△x[2(mx1+b-y1)+2m-1]
Since mx1+b-yi=0 and m = , we have
d1=2△y-△x
Step5: Consider (x, y) as starting point and xendas maximum possible value of x.
If dx < 0
Then x = x2
y = y2
xend=x1
If dx > 0
Then x = x1
y = y1
xend=x2
Step9: Increment x = x + 1
Step11: Go to step 7
2 Use Cohen-sutherland Line clipping algo to find visible point of line inside the window
Q3 Explain in Brief RGB, CMY and HSV Colour Model
Based on tristimulus theory of vision our eye perceives color through stimulate one of three visual pigments
in the cones of theretina.
These visual pigments have peak sensitivity at red, green and bluecolor.
So combining these three colors we can obtain wide range of color this concept is used in RGB color model.
Fig. 6.13:- The RGB color model.
A color model CMY is used for hardcopy devices as we produce picture by coating a paper with color
pigments, we see the color by reflected light a subtractiveprocess.
When white light is reflected from cyan colored ink the reflected light must have no red component that is
red light is absorbed or subtracted by theink.
Similarly magenta is subtracting greencomponent.
Unit cube for CMY model is shown in figurebelow.
All color models treated so far are hardware oriented. The Hue-Saturation-Value model is oriented towards
the user/artist. The allowed coordinates fill a six sided pyramid the 3 top faces of the color cube as base.
Note that at the same height colors of different perceived brightness are positioned. Value is given by the
height, saturation is coded in the distance from the axes and hue by the position on the boundary.
owever, it allows you to switch to the HSV color model to provide greater flexibility in choosing colors.
Unlike the RGB color model, which is hardware-oriented, the HSV model is user-oriented, based on the
more intuitive appeal of combining hue, saturation, and value elements to create a color.
However, the scocolor client automatically translates any colors that are selected or created using the HSV
model to corresponding RGB values. The HSV option is provided only as an alternative interface for
selecting colors.
Q4 What is the use of compression in computer graphics? Explain JPEG
Compression is the method computers use to make files smaller by reducing the number of bits (1's and 0's)
used to store the information. ... Once a file has been compressed using a lossy method, any bits that are lost
cannot be recovered.Image compression is the method of data compression on digital images.
Media compression is used to save compressed image, audio, and video files. Examples
of compressed media formats include JPEG images, MP3 audio, and MPEG video files. Most image viewers
and media playback programs can open standard compressed file types directly.
The main objective in the image compression is:
JPEG compression
JPEG stands for Joint photographic experts group. It is the first interanational standard in image
compression. It is widely used today. It could be lossy as well as lossless . But the technique we are going to
discuss here today is lossy compression technique.
Let’s for the record, say that this 8x8 image contains the following values.
The range of the pixels intensities now are from 0 to 255. We will change the range from -128 to 127.
Subtracting 128 from each pixel value yields pixel value from -128 to 127. After subtracting 128 from each
of the pixel value, we got the following results.
The result comes from this is stored in let’s say A(j,k) matrix.
There is a standard matrix that is used for computing JPEG compression, which is given by a matrix called
as Luminance matrix.
This matrix is given below
Applying the following formula
Now we will perform the real trick which is done in JPEG compression which is ZIG-ZAG movement. The
zig zag sequence for the above matrix is shown below. You have to perform zig zag until you find all zeroes
ahead. Hence our image is now compressed.
Q5 Show rotation of a 2D box represented by (5,5) to (10,15) with respect to(5,5) 90o in anti clockwise
direction
Q6 Explain the document architecture and formatting of files or documents in the multimedia system
Document: - A document consists of a set of structural information that can be in different forms of media
and during presentation can be generated or recorded. –
A document is aimed at the perception of human and is accessible for computer processing. Multimedia
Document: -
A multimedia document which comprised of information coded in at least one continuous (time-dependent)
medium and in one discrete (time-independent) medium. Integration of the different media is given through
a close relation between information units. This is also called synchronization.
A multimedia document is closely related to its environment of tools, data abstractions, basic concepts and
document architecture. - Currently, continuous and discrete data are processed differently: text is processed
within an editor program as a type of programming language; a motion picture can be manipulated with the
same editor program only through library calls. –
The goal of abstracting multimedia data is to achieve integrated, i.e. uniform, description and processing of
all media. This reduces the complexity of program generation and maintenance that process multimedia data.
- Abstractions of multimedia data serve as the fundamental building block for programming different
multimedia applications, especially editors and other document processing tools.
Basic concepts for documents processing use multimedia abstraction and also serve as concepts for the
information architecture in a document. Thus we can use the terms document architecture and information
architecture interchangeably
- ODA has been used mainly by the computer industry, especially in Europe
The main property of ODA is the distinction among content, logical structure
and layout structure.
- This is a contrast to SGML where only a logical structure and the contents are
defined ODA defines semantics.
- The above figure shows three aspects (content, logical structure and layout
structure) linked to a document. One can imagine these aspects as three
orthogonal views of the same documents. Each of these views represent one
aspect, together we get the actual document.
Content:
- The content of the document consist of content portions.
- A content architecture describes for each medium:-
(i) Specification of the elements
(ii) The possible access functions and
(iii) The data coding
- ODA has content architectures for media text, geometrical graphics and raster
graphics.
Layout Structure:
The layout structure specifies mainly the representation of a document. It is
related to a two dimensional representation.
Logical Structure:
It includes the partitioning of the content.
Content of multimedia applications may include data in combinations of the following formats: still images,
graphics, motion video, animation, text, numbers, sound, storyline and interface. Image files may be put in
various standard formats for interchange purposes. These may also be used for editing and storage. The
formats explain what encoding system is used to compress the image and how the image information is
organized, with additional header information about the image as well.
Different formats relate to different ways of representing images, eg. raster, vector or textual representations.
Examples are TIFF, PCX, Targa, GIF, IFF/LBM, bitmaps, Cals type 1&2, bitmap graphics. File formats
exist for other media such as ASCII for text, MIDI for audio, HDTV for video.
Formats for image storage and display are often described in terms of image resolution. This is a
combination of the number of pixels across and down the image. Resolutions of stored images may be
higher than the relevant display device can make use of. The number of colors available (reflected in the
standard used e.g. VGA, SVGA) also affects the picture quality, especially with digitized images rather than
graphics. Photo CD formats Pro-Master, Master 35mm, Portfolio, and Catalogue equate to diminishing
levels of resolution from 4096 x 6144 pixels down to 128 x 192 pixels. These are useful for different
purposes with high resolution for high quality publishing output and low resolution to enable many images
to be displayed at once or browsed through quickly.
Stored data may be compressed to reduce the space needed with various formats and standards for image,
audio and video compression and decompression for transmission and display.
Examples are JPEG, fractals, (both handling color and grey scale images), CCITT Groups 3&4 (for
monochrome images); JBIG (modification of JPEG) for raster images; MIDI for audio; MPEG and DVI for
video and associated audio. Photo CD images use their own color encoding metric, Photo YCC, optimized
for TV display and printing, but which is not an official standard. They have to be read into another file
format for manipulation. Some of these compression formats cause more loss of data than others, and in
some applications this may be of considerable importance.
y = mx + b
y
1 Original
Position
2 3
x
2’ 3’
Reflected
’
1 Position
y
1’ 1 Original
Reflected
Position Position
3’ 2’ 2 3
1’ x
3’
2’
Reflected Position
−1 0 0
[0 −1 0]
0 0 1
Transformation matrix for reflection about the line 𝒙 = .
y
Original
x=y line
Position
3
2 1
1’ Reflected Position
3’
2’
0 1 0
[1 0 0]
0 0 1
Transformation matrix for reflection about the line 𝒙 = − .
x=-y line 3 y
1 2
Original
’ 1’
3
Position
2’
Reflected
Position
x
0 −1 0
[−1 0 0]
0 0 1
Part-C
Q1 explain the function of display processor in Raster system , Compare merits and demerits of raster
and vector devices
Raster-graphics system with a display processor
System Bus
I/O Devices
Architecture of a raster-graphics system with a display processor.
Random-scan monitors are also known as vector displays or stroke-writing displays or calligraphic displays.
Merits
1. A CRT has the electron beam directed only to the parts of the screen where an image is to be drawn.
2. Produce smooth line drawings.
3. High Resolution
Demerits:
Raster Scan
Merits
1. Realistic image
2. Million Different colors to be generated
3. Shadow Scenes are possible.
Demerits:
1. Low Resolution
2. Expensive
5. Refresh rate depends or resolution 5. Refresh rate does not depend on the picture.
7. Beam Penetration technology come under it. 7. Shadow mark technology came under this.
Q2 Explain Bezier Curve and determine eleven points on a Bezier curve with equidistant parametric
value having central points
(xo,yo)=(50,180)
(x1,y1)=(250,100)
(x2,y2)=(600,300)
(x3,y3)=(500,50)
Bezier Curves
Bezier curve section can be fitted to any number of controlpoints.
Number of control points and their relative position gives degree of the Bezierpolynomials.
With the interpolation spline Bezier curve can be specified with boundary condition or blendingfunction.
Most convenient method is to specify Bezier curve with blendingfunction.
Consider we are given n+1 control point position from p 0 to pn where pk = (xk, yk,zk).
This is blended to gives position vector p(u) which gives path of the approximate Bezier curveis:
𝑛
𝑝(𝑢) = 0≤𝑢≤1
∑𝑝𝑘𝐵𝐸𝑍𝑘,𝑛(𝑢)
𝑘=
0
Where 𝐵𝐸𝑍𝑘,(𝑢) = 𝐶(𝑛, 𝑘)𝑢𝑘(1 − 𝑢)𝑛−𝑘
And (𝑛, 𝑘) = 𝑛!⁄𝑘! (𝑛 − 𝑘)!
We can also solve Bezier blending function by recursion asfollow:
𝐵𝐸𝑍𝑘,(𝑢) = (1 − 𝑢)𝐵𝐸𝑍𝑘,𝑛−1(𝑢)+𝑢𝐵𝐸𝑍𝑘−1,𝑛−1(𝑢) 𝑛 > 𝑘 ≥1
Here 𝐵𝐸𝑍𝑘,(𝑢) = 𝑢𝑘 and 𝐵𝐸𝑍0,𝑘(𝑢) = (1 − 𝑢)𝑘
Parametric equation from vector equation can be obtain asfollows.
𝑛
𝑥(𝑢) = ∑ 𝑥𝑘𝐵𝐸𝑍𝑘,𝑛(𝑢)
𝑘=0
𝑛
𝑦(𝑢) = ∑ 𝑦𝑘𝐵𝐸𝑍𝑘,𝑛(𝑢)
𝑘=0
𝑛
𝑧(𝑢) = ∑ 𝑧𝑘𝐵𝐸𝑍𝑘,𝑛(𝑢)
𝑘=0
This is blended to gives position vector p(u) which gives path of the approximate Bezier curve
is:
Bezier curve is a polynomial of degree one less than the number of controlpoints.
Below figure shows some possible curve shapes by selecting various controlpoint.
So any curve position is simply the weighted sum of the control pointpositions.
Bezier curve smoothly follows the control points without erraticoscillations.
Parallel Projection is used to display picture in its true shape and size. When projectors are
perpendicular to view plane then is called orthographic projection. The parallel projection is
formed by extending parallel lines from each vertex on the object until they intersect the plane
of the screen. The point of intersection is the projection of vertex.
Parallel projections are used by architects and engineers for creating working drawing of the
object, for complete representations require two or more views of an object using different
planes.
1. Isometric Projection: All projectors make equal angles generally angle is of 30°.
2. Dimetric: In these two projectors have equal angles. With respect to two principle axis.
3. Trimetric: The direction of projection makes unequal angle with their principle axis.
4. Cavalier: All lines perpendicular to the projection plane are projected with no change in
length.
5. Cabinet: All lines perpendicular to the projection plane are projected to one half of their
length. These give a realistic appearance of object.
It is uniquely defined by its projection plane Π and the direction of the (parallel)
projection lines. The direction must not be parallel to the projection plane.
Any point of the space has a unique image in the projection plane Π, and the points of Π are
fixed.
Any line not parallel to direction is mapped onto a line; any line parallel to is
mapped onto a point.
Parallel lines are mapped on parallel lines, or on a pair of points (if they are parallel to ).
The ratio of the length of two line segments on a line stays unchanged. As a special
case, midpoints are mapped on midpoints.
The length of a line segment parallel to the projection plane remains unchanged. The length of
any line segment is shortened if the projection is an orthographic one. [clarification needed]
Any circle that lies in a plane parallel to the projection plane is mapped onto a circle with the
same radius. Any other circle is mapped onto an ellipse or a line segment (if direction is
parallel to the circle's plane).
Angles in general are not preserved. But right angles with one line parallel to the projection
plane remain unchanged.
Any rectangle is mapped onto a parallelogram or a line segment (if is parallel to the
rectangle's plane).
Any figure in a plane that is parallel to the image plane is congruent to its image.
Orthographic Projection
In orthographic projection the direction of projection is normal to the projection of the plane.
There are three types of orthographic projections −
Front Projection
Top Projection
Side Projection
Oblique Projection
In oblique projection, the direction of projection is not normal to the projection of plane. In
oblique projection, we can view the object better than orthographic projection.
There are two types of oblique projections − Cavalier and Cabinet. The Cavalier projection
makes 45° angle with the projection plane. The projection of a line perpendicular to the view
plane has the same length as the line itself in Cavalier projection. In a cavalier projection, the
foreshortening factors for all three principal directions are equal.
The Cabinet projection makes 63.4° angle with the projection plane. In Cabinet projection,
lines perpendicular to the viewing surface are projected at ½ their actual length. Both the
projections are shown in the following figure
Isometric Projections
Orthographic projections that show more than one side of an object are called axonometric
orthographic projections. The most common axonometric projection is an isometric
projection where the projection plane intersects each coordinate axis in the model coordinate
system at an equal distance. In this projection parallelism of lines are preserved but angles are
not preserved. The following figure shows isometric projection −
Q4 Describe Z-buffer algorithm for visible surface detection
Z-Buffer Algorithm
It is also called a Depth Buffer Algorithm. Depth buffer algorithm is simplest image space
algorithm. For each pixel on the display screen, we keep a record of the depth of an object
within the pixel that lies closest to the observer. In addition to depth, we also record the
intensity that should be displayed to show the object. Depth buffer is an extension of the
frame buffer. Depth buffer algorithm requires 2 arrays, intensity and depth each of which is
indexed by pixel coordinates (x, y).
Algorithm
For all pixels on the screen, set depth [x, y] to 1.0 and intensity [x, y] to a background value.
For each polygon in the scene, find all pixels (x, y) that lie within the boundaries of a polygon
when projected onto the screen. For each of these pixels:
(b) If z < depth [x, y], this polygon is closer to the observer than others already recorded for
this pixel. In this case, set depth [x, y] to z and intensity [x, y] to a value corresponding to
polygon's shading. If instead z > depth [x, y], the polygon already recorded at (x, y) lies closer
to the observer than does this new polygon, and no action is taken.
3. After all, polygons have been processed; the intensity array will contain the solution.
4. The depth buffer algorithm illustrates several features common to all hidden surface
algorithms.
5. First, it requires a representation of all opaque surface in scene polygon in this case.
6. These polygons may be faces of polyhedral recorded in the model of scene or may simply
represent thin opaque 'sheets' in the scene.
7. The IInd important feature of the algorithm is its use of a screen coordinate system. Before
step 1, all polygons in the scene are transformed into a screen coordinate system using matrix
multiplication.
1. The depth buffer Algorithm is not always practical because of the enormous size of depth and
intensity arrays.
2. Generating an image with a raster of 500 x 500 pixels requires 2, 50,000 storage locations for
each array.
3. Even though the frame buffer may provide memory for intensity array, the depth array
remains large.
4. To reduce the amount of storage required, the image can be divided into many smaller
images, and the depth buffer algorithm is applied to each in turn.
5. For example, the original 500 x 500 faster can be divided into 100 rasters each 50 x 50 pixels.
6. Processing each small raster requires array of only 2500 elements, but execution time grows
because each polygon is processed many times.
7. Subdivision of the screen does not always increase execution time instead it can help reduce
the work required to generate the image. This reduction arises because of coherence between
small regions of the screen.
Back-Face Detection
A fast and simple object-space method for identifying the back faces of a polyhedron is based
on the "inside-outside" tests. A point x,y,zx,y,z is "inside" a polygon surface with plane
parameters A, B, C, and D if When an inside point is along the line of sight to the surface, the
polygon must be a back
face weareinsidethatfaceandcannotseethefrontofitfromourviewingpositionweareinsidethatface
andcannotseethefrontofitfromourviewingposition.
We can simplify this test by considering the normal vector N to a polygon surface, which has
Cartesian components A,B,CA,B,C.
In general, if V is a vector in the viewing direction from the
eye or"camera"or"camera" position, then this polygon is a back face if
V.N > 0
Furthermore, if object descriptions are converted to projection coordinates and your viewing
direction is parallel to the viewing z-axis, then −
V = (0, 0, Vz) and V.N = VZC
So that we only need to consider the sign of C the component of the normal vector N.
In a right-handed viewing system with viewing direction along the negative ZVZV axis, the
polygon is a back face if C < 0. Also, we cannot see any face whose normal has z component
C = 0, since your viewing direction is towards that polygon. Thus, in general, we can label
any polygon as a back face if its normal vector has a z component value −
C <= 0
Similar methods can be used in packages that employ a left-handed viewing system. In these
packages, plane parameters A, B, C and D can be calculated from polygon vertex coordinates
specified in a clockwise
direction unlikethecounterclockwisedirectionusedinaright−handedsystemunlikethecountercloc
kwisedirectionusedinaright−handedsystem.
Also, back faces have normal vectors that point away from the viewing position and are
identified by C >= 0 when the viewing direction is along the positive ZvZv axis. By
examining parameter C for the different planes defining an object, we can immediately
identify all the back faces.
Q5 What is animation? what are the challenges faced in the implementation?write the
steps in generation of animation ?
Example :Advertising animations often transition one object shape into another.
Object definitions
Key-frame specifications
Story board
It defines the motion sequences as a set of basic events that are to take place.
Object Definition
An object definition is given for each participant in the action.Objects can be defined in terms
of basic shapes such as polygons or splines. The associated movements of each object are
spcified along with the shape.
Key frame
Within each key frame, each object is positioned according to the time for that frame.
Some key frames are chosen at extreme positions in the action; othersare
spaced so that the time interval between key frames is not too much.
In-betweens
- Motion verification
- Editing