Sie sind auf Seite 1von 36

CS8092 Computer Graphics and Multimedia

III YEAR / VI SEMESTER (INFORMATION TECHNOLOGY)

UNIT I - OUTPUT PRIMITIVES

COMPILED BY,

Mr.M.KARTHIKEYAN, M.E., HoD / IT

VERIFIED BY

HOD PRINCIPAL CEO/CORRESPONDENT

SENGUNTHAR COLLEGE OF ENGINEERING,TIRUCHENGODE – 637 205.

DEPARTMENT OF INFORMATION TECHNOLOGY

1
CREDIT POINT

ANNA UNIVERSITY, CHENNAI


AFFILIATED INSTITUTIONS
R-2017
B.TECH INFORMATION TECHNOLOGY

SEMESTER VI

COURSE CONTACT
SN COURSE TITLE CATEGORY L T P C
CODE PERIODS

THEORY
Computational
1 IT8601
Intelligence
PC 3 3 0 0 3

Object Oriented Analysis


2 CS8592
and Design
PC 3 3 0 0 3

3 IT8602 Mobile Communication PC 3 3 0 0 3

4 CS8091 Big Data Analytics PC 3 3 0 0 3

Computer Graphics
5 CS8092 PC 3 3 0 0 3
and Multimedia

6 Professional Elective I PE 3 3 0 0 3

PRACTICAL

Mobile Application
7 CS8662 PC 4 0 0 4 2
Development Laboratory
Object Oriented Analysis
8 CS8582 PC 4 0 0 4 2
and Design Laboratory
9 IT8611 Mini Project EEC 2 0 0 2 1
Professional
10 HS8581
Communication
EEC 2 0 0 2 1

TOTAL 30 18 0 12 24

2
CS8092 Computer Graphics and Multimedia

OBJECTIVES:
 To develop an understanding and awareness how issues such as content, information
architecture, motion, sound, design, and technology merge to form effective and
compelling interactive experiences for a wide range of audiences and end users.
 To become familiar with various software programs used in the creation and
implementation of multi- media
 To appreciate the importance of technical ability and creativity within design practice.
 To gain knowledge about graphics hardware devices and software used.
 To understand the two-dimensional graphics and their transformations.
 To understand the three-dimensional graphics and their transformations.
 To appreciate illumination and color models
 To become familiar with understand clipping techniques
 To become familiar with Blender Graphics

UNIT I ILLUMINATION AND COLOR MODELS

Light sources - basic illumination models – halftone patterns and dithering techniques;
Properties of light - Standard primaries and chromaticity diagram; Intuitive
colour concepts - RGB colour model - YIQ colour model - CMY colour model -
HSV colour model - HLS colour model; Colour selection. Output primitives –
points and lines, line drawing algorithms, loading the frame buffer, line function;
circle and ellipse generating algorithms; Pixel addressing and object geometry,
filled area primitives.

UNIT II TWO-DIMENSIONAL GRAPHICS

Two dimensional geometric transformations – Matrix representations and homogeneous


coordinates, composite transformations; Two dimensional viewing – viewing pipeline,
viewing coordinate reference frame; window-to-viewport coordinate transformation, Two
dimensional viewing functions; clipping operations – point, line, and polygon clipping algorithms.

UNIT III THREE-DIMENSIONAL GRAPHICS


Three dimensional concepts; Three dimensional object representations – Polygon
surfaces- Polygon tables- Plane equations - Polygon meshes; Curved Lines
and surfaces, Quadratic surfaces; Blobby objects; Spline representations –
Bezier curves and surfaces -B-Spline curves and surfaces.
TRANSFORMATION AND VIEWING: Three dimensional geometric and
modeling transformations – Translation, Rotation, Scaling, composite
transformations; Three dimensional viewing – viewing pipeline, viewing
coordinates, Projections, Clipping; Visible surface detection methods.

3
UNIT IV MULTIMEDIA SYSTEM DESIGN & MULTIMEDIA FILE HANDLING

Multimedia basics − Multimedia applications − Multimedia system architecture − Evolving


technologies for multimedia − Defining objects for multimedia systems −
Multimedia data interface standards − Multimedia databases. Compression
and decompression − Data and file format standards − Multimedia I/O
technologies − Digital voice and audio − Video image and animation − Full
motion video − Storage and retrieval technologies.

UNIT V HYPERMEDIA

Multimedia authoring and user interface - Hypermedia messaging -Mobile messaging −


Hypermedia message component − Creating hypermedia message −
Integrated multimedia message standards − Integrated document
management − Distributed multimedia systems. CASE STUDY: BLENDER
GRAPHICS Blender Fundamentals – Drawing Basic Shapes – Modelling – Shading
& Textures

TOTAL: 45 PERIODS

OUTCOMES:
At the end of the course, the students should be able to:
 Design two dimensional graphics.
 Apply two dimensional transformations.
 Design three dimensional graphics.
 Apply three dimensional transformations.
 Apply Illumination and color models.
 Apply clipping techniques to graphics.
 Understood Different types of Multimedia File Format
 Design Basic 3d Scenes using Blender

TEXT BOOKS:
1. Donald Hearn and M. Pauline Baker, “Computer Graphics C Version”, Pearson Education,
2003.
2. Andleigh, P. K and Kiran Thakrar, “Multimedia Systems and Design”, PHI, 2003.
REFERENCES:
1. Judith Jeffcoate, “Multimedia in practice: Technology and Applications”, PHI, 1998.
2. Foley, Vandam, Feiner and Huges, “Computer Graphics: Principles and Practice”, 2 nd Edition,
Pearson Education, 2003.

4
SENGUNTHAR COLLEGE OF ENGINEERING, TIRUCHENGODE- 637205

DEPARTMENT OF INFORMATION TECHNOLOGY

LECTURE PLAN

Subject Code : CS8092

Subject Name : Computer Graphics and Multimedia

Name of the faculty & Designation : M.KARTHIKEYAN / HOD - IT

Course : VI Semester B.Tech., IT

Academic Year : 2019 – 2020 EVEN SEMESTER

RECOMMENDED TEXT BOOKS / REFERENCE BOOKS

Sl No Title of the Book Author Reference


1 T1
2 R1
3 R2

NO. OF
TOPIC REFERENCES TEACHING
HOURS
UNIT I ILLUMINATION AND COLOR MODELS

Light sources - basic illumination models – halftone 2


T1-CH1 Black Board
patterns and dithering techniques
Properties of light - Standard primaries and 2
chromaticity diagram; T1-CH1 LAB VISIT

Intuitive colour concepts - RGB colour model - YIQ colour


model - CMY colour model - HSV colour model - HLS T1-CH1 Black Board 1
colour model.
Colour selection. Output primitives – points and lines, line
T1-CH1 Black Board 1
drawing algorithms

5
loading the frame buffer, line function; circle and ellipse
generating algorithms;
T1-CH1 Black Board 2

Pixel addressing and object geometry, filled area primitives T1-CH1 Black Board 1

UNIT II TWO-DIMENSIONAL GRAPHICS

Two dimensional geometric transformations – Matrix


representations and homogeneous coordinates, T1-CH2 Black Board 3
composite transformations;

Two dimensional viewing – viewing pipeline, viewing


coordinate reference frame; window-to-viewport T1-CH2 Black Board 2
coordinate transformation

Two dimensional viewing functions; T1-CH2 Black Board 2

clipping operations – point, line, and polygon clipping


algorithms. T1-CH2 Black Board 2

UNIT III THREE-DIMENSIONAL GRAPHICS

Three dimensional concepts; Three dimensional


T1-CH3 Black Board 2
object representations
Polygon surfaces- Polygon tables- Plane equations -
Polygon meshes; Curved Lines and T1-CH3 Black Board 2
surfaces, Quadratic surfaces; Blobby
objects;
Spline representations – Bezier curves and surfaces T1-CH3 Black Board 2
-B-Spline curves and surfaces.
TRANSFORMATION AND VIEWING: Three
dimensional geometric and modeling T1-CH3 Black Board 2
transformations – Translation, Rotation,
Scaling, composite transformations
; Three dimensional viewing – viewing pipeline,
viewing coordinates, Projections,
Clipping; Visible surface detection T1-CH3 Black Board 1
methods.

UNIT IV MULTIMEDIA SYSTEM DESIGN & MULTIMEDIA FILE HANDLING

6
Multimedia basics − Multimedia applications
T1-CH4 Black Board 2
Multimedia system architecture − Evolving technologies
for multimedia
T1-CH4 Black Board 2
Defining objects for multimedia systems − Multimedia data
interface standards −
T1-CH4 Black Board 1

Multimedia databases. Compression and decompression T1-CH4 Black Board 1


Data and file format standards T1-CH4 Black Board 2
Multimedia I/O technologies − Digital voice and audio −
Video image and animation − Full motion video − Storage T1-CH4 Black Board 1
and retrieval technologies

UNIT V HYPERMEDIA

Multimedia authoring and user interface T1-CH5 Black Board 2

Hypermedia messaging -Mobile messaging −


Hypermedia message component − T1-CH5 Black Board 2
Creating hypermedia message

Integrated multimedia message standards − Integrated


document management
T1-CH5 Black Board 2

Distributed multimedia systems. T1-CH5 Black Board 2


CASE STUDY: BLENDER GRAPHICS Blender Fundamentals
– Drawing Basic Shapes – Modelling – Shading & Textures
T1-CH5 Black Board 1

Total 45
Revision 10
Total Hours 55

UNIT I

7
UNIT I ILLUMINATION AND COLOR MODELS

 Light sources - basic illumination models – halftone patterns and dithering


techniques;

 Properties of light - Standard primaries and chromaticity diagram;

 Intuitive colour concepts - RGB colour model - YIQ colour model - CMY colour
model - HSV colour model - HLS colour model; Colour selection.

 Output primitives – points and lines, line drawing algorithms,

 loading the frame buffer, line function;

 circle and ellipse generating algorithms;

 Pixel addressing and object geometry, filled area primitives.

LIST OF IMPORTANT QUESTIONS


UNIT I
OUTPUT PRIMITIVES
PART - A
1. Give the difference between Bresenham’s and DDA line drawing algorithm.
[APR/MAY2018]
2. Write the working principle of Raster-Scan System. [NOV/DEC 2017]
3. List out the basic geometric transformation.[NOV/DEC 2017]
4. Derivation of decision parameter for bresenham's line algorithm.[APR/MAY2017]
5. Give the final coordinates of a unit quad ABCD with vertex A placed on the origin after applying
the uniform scaling of 2units with respect to the centre of the square. [APR/MAY2017]
6. Write any two attributes of a line.[NOV/DEC 2016]
7. Differentiate between raster scan and random scan displays.[APR/MAY2008,
NOV/DEC 2015]
8. Briefly explain vector vs. raster graphics.
9. Define refresh buffer/frame buffer.
10. Digitize a line from (10,12) to (15,15) on a raster screen using Bresenhams straight
line
algorithm.(NOV/DEC 2013)
11. What are the disadvantages of DDA algorithm?

8
12. Applications of Computer Graphics.
13. What is pixel?
14. Define aspect ratio.
15.What is Graphics?
16. What is Bitmapped Display?
17. What is VGA (video graphics array)?
18. What is Refresh Rates .
19. What is chromaticity?
20. What do you mean by color model?
21. Write short notes on HLS color model.
22. What is Color gamut?
23. What for CMY color model used?
24. What is HSV model?
PART-B

1. Explain RGB,CMY,YIQ and YUV color models. (APR/MAY 18) (or) Write briefly on
YIQ Color Model.(NOV/DEC17)
2. Draw the CIE chromaticity diagram and explain. (6)
3. Digitize the line with end points (0,0) and (4,6) using DDA line drawing algorithm.
[APR/MAY 2018]
4. Explain the properties of a circle. [NOV/DEC2017]
5. Discuss briefly about curve attributes.[NOV/DEC2015] [APR/MAY 2017] [OR]
Attributes of Output Primitives.
6. Calculating the pixel location approximating the first octant of a circle having centre at (4,5)
and the radius 4 units using Bresenham's circle drawing algorithm.(8) [NOV/DEC2016]
7. Write down and explain the midpoint circle drawing algorithm. Assume 10 cm as
the radius and co-ordinate origin as the centre of the circle.(NOV/DEC
2009,2010,2011,2015)
8. Explain midpoint ellipse algorithm with an example?

9. Explain the DDA and Bresenham Line drawing Algorithm.[NOV/DEC 2012]

UNIT I
OUTPUT PRIMITIVES
PART – A
9
1. Give the difference between Bresenham’s and DDA line drawing algorithm. [APR/MAY2018]

Criteria Digital Differential Analyzer Bresenhams Line Drawing


Line Drawing Algorithm Algorithm
Arithmetic DDA algorithm uses floating Bresenhams algorithm uses fixed
points i.e.Real Arithmetic. points i.e. Integer Arithmetic.
Operations DDA algorithm Bresenhams algorithm uses
uses multiplication anddivision in only subtraction and addition in its
its operations. operations.
Speed DDA algorithm is rather slowly than Bresenhams algorithm is faster than
Bresenhams algorithm in line drawing DDA algorithm in line drawing
because it uses real arithmetic because it performs only addition and
(floating-point operations). subtraction in its calculation and uses
only integer arithmetic so it runs
significantly faster.
Accuracy DDA algorithm is not as accurate and Bresenhams algorithm is more
& efficient as Bresenham algorithm. efficient and much accurate than
Efficiency DDA algorithm.
Drawing DDA algorithm can draw circles and Bresenhams algorithm can draw
curves but that are not as accurate as circles and curves with much more
Bresenhams algorithm. accuracy than DDA algorithm.
Round Off DDA algorithm round off the Bresenhams algorithm does
coordinates to integer that is nearest not round off but takes the
to the line. incremental value in its operation.
Expensive DDA algorithm uses an enormous Bresenhams algorithm is less
number of floating-point expensive than DDA algorithm as it
multiplications so it is expensive. uses only addition and subtraction.

2. Write the working principle of Raster-Scan System. [NOV/DEC 2017]


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 (scan line) at a time as shown in the following illustration.
Each screen point is referred to as a pixel (picture element) or pel. At the end of each
scan line, the electron beam returns to the left side of the screen to begin displaying the
next scan line.

10
3. List out the basic geometric transformation.[NOV/DEC 2017]

A geometric transformation is any bijection of a set having some geometric structure to


itself or another such set. Specifically, "A geometric transformation is a function whose
domain and range are sets of points. Most often the domain and range of a geometric
transformation are both R2 or both R3. Often geometric transformations are required to be
1-1 functions, so that they have inverses." ] The study of geometry may be approached via
the study of these transformations.
Geometric transformations can be classified by the dimension of their operand sets.

4. Derivation of decision parameter for bresenham's line algorithm.[APR/MAY2017]


if pi < 0, pi+1 = pi + 2∆y
because 2∆x ⋅ (yi+1 – yi) = 0
if pi > 0, pi+1 = pi + 2∆y – 2∆x
because (yi+1 – yi) = 1
At this stage the basic algorithm is defined. We only need to calculate the initial value for
parameter po.
pi = 2⋅∆y⋅xi– 2⋅∆x⋅yi + 2⋅∆y + 2⋅∆x⋅b – ∆x
from (7) p0 = 2⋅∆y⋅x0– 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅b – ∆x (9)
For the initial point on the line:
y0 = mx0 + b therefore
b = y0 – (∆y/∆x) ⋅ x0
Substituting the above for b in (9)we get:
p0 = 2⋅∆y⋅x0– 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅ [ y0 – (∆y/∆x) ⋅ x0 ] – ∆x
= 2⋅∆y⋅x0 – 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅y0 – 2∆x⋅ (∆y/∆x) ⋅ x0 – ∆x simplify
= 2⋅∆y⋅x0 – 2⋅∆x⋅y0 + 2⋅∆y + 2∆x⋅y0 – 2∆y⋅x0 – ∆x regroup
= 2⋅∆y⋅x0 – 2∆y⋅x0 – 2⋅∆x⋅y0 + 2∆x⋅y0 + 2⋅∆y – ∆x simplify
= 2⋅∆y – ∆x

5. Give the final coordinates of a unit quad ABCD with vertex A placed on the origin
after applying the uniform scaling of 2units with respect to the centre of the square.
[APR/MAY2017]
Uniform scaling means this scalar is the same for all components:

A scaling transformation alters the size of an object. This operation can be carried out
for polygons by multiplying the coordinate values (x, y) to each vertex by scaling factor Sx
11
& Sy to produce the transformed coordinates (x’, y’)
x’ = x.Sx y’ = y.Sy
scaling factor Sx scales object in x direction while Sy scales in y direction.
The transformation equation in matrix form

6. Write any two attributes of a line.[NOV/DEC 2016]


Line Attributes
Basic attributes of a straight line segment are its type, its width, and its color. In
some graphics packages, lines can also be displayed using selected pen or brush options
* Line Type
* Line Width
* Pen and Brush Options
* Line Color

7. Differentiate between raster scan and random scan displays.[APR/MAY2008,


NOV/DEC 2015]
The most common form of graphics monitor employing a CRT is the raster scan display,
based on television technology. 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 a memory area called the refresh buffer or frame buffer.

8. Briefly explain vector vs. raster graphics.

Vector graphics are stored in the computer as a set of mathematical formulas describing
the shapes that make up each image. When you display a vector graphic on the screen or
print it, these formulas are converted into the patterns of dots you can see. Because the dots
are not specified unit! you display or print the graphic, you can change the size of the image
without any loss of quality, and the image will always appear at the highest resolution of
whatever screen or printer you're using. The term vector graphics means exactly the same
thing as object-oriented (or just object) graphics.

9. Define refresh buffer/frame buffer.


A framebuffer (frame buffer, or sometimes framestore) is a portion of RAM containing a
bitmap that is driven to a video display from a memory buffer containing a complete frame of
data. The information in the memory buffer typically consists of color values for every pixel
(point that can be displayed) on the screen.

10. Digitize a line from (10,12) to (15,15) on a raster screen using Bresenhams straight
line
12
algorithm.(nov/dec 2013)
The line has a slope of 0.6 with
Δx=5, Δy=3
The initial decision parameter has the value
P0=2Δy-Δx
=6-5=1
And the increments for calculating successive decision parameters are
2Δy-2Δx=6-10=-4
We plot the point (x0.y0) =(10,12), and determine successive pixel positions along the
line path from the decision parameter as
K pk (xk+1, yk+1)
0 1 (11, 13)
1 -3 (12, 13)
2 3 (13, 14)
3 -1 (14, 14)
4 5 (15, 15)

11. What are the disadvantages of DDA algorithm?


1.Floating point arithmetic in DDA algorithm is still time-consuming.
2. The algorithm is orientation dependent. Hence end point accuracy is poor.

12. Applications of Computer Graphics.


Computer graphics user interfaces - GUIs.

 GUI
A graphic, mouse-oriented paradigm which allows the user to interact with a
computer.
 Business presentation graphics - "A picture is worth a thousand words".
 Cartography - drawing maps
 Weather Maps - real time mapping, symbolic representations
 Satellite Imaging - geodesic images
 Photo Enhancement - sharpening blurred photos
 Medical imaging - MRIs, CAT scans, etc. - non-invasive internal examination.
 Engineering drawings - mechanical, electrical, civil, etc. - replacing the blueprints of
the past.
 Typography - the use of character images in publishing - replacing the hard type of
the past.
 Architecture - construction plans, exterior sketches - replacing the blueprints and
hand drawings of the past.
 Art - computers provide a new medium for artists.
13. What is pixel?
The pixel (a word invented from "picture element") is the basic unit of programmable color
on a computer display or in a computer image. Think of it as a logical - rather than a physical -
unit. The physical size of a pixel depends on how you've set the resolution for the display
screen.

14. Define aspect ratio.


13
In computer graphics, the relative horizontal and vertical sizes. For example, if a graphic
has an aspect ratio of 2:1, it means that the width is twice as large as the height. When
resizing graphics, it is important to maintain the aspect ratio to avoid stretching the graphic
out of proportion.

15.What is Graphics?
Pictures on a computer display or the process of creating pictures on a computer display.
The term came into use when there was still a distinction between computers that could
display only text and those that could also display pictures. This distinction is lost now that
almost all computers employ a GRAPHICAL USER INTERFACE.

16. What is Bitmapped Display?


Bitmapped Display: Strictly, a display in which each PIXEL on the screen is represented by
a BIT stored in VIDEO MEMORY which would limit its applicability to black-and-white images
only. More frequently used, however, to describe any display in which each pixel corresponds
to a byte or word in video memory, which covers all contemporary computer colour displays.
The term was coined in distinction to the now-obsolete VECTOR DISPLAY, which drew lines
instead of pixels.

17. What is VGA (video graphics array)?

VGA, which stands for video graphics array, is currently the most popular standard for PC
screen display equipment. Technically, a VGA is a type of video adapter (circuitry in the
computer that controls the screen). IBM developed the VGA for its PS/2 line of computers (the
name "Video Graphics Array" is an IBM trademark), but loads of other manufacturers make
VGA add-in boards (that plug into a slot in the pc) and VGA chips (in some pcs, these VGA
chips are built right into the main part of the computer, the motherboard). A VGA monitor is a
monitor that works with a VGA adapter.

18. What is Refresh Rates


When choosing a monitor, one of the factors that the customer usually considers is the
refresh rate. A high refresh rate is important in providing a clear picture and avoiding eye
fatigue.

19. What is chromaticity?


Chromaticity is an objective specification of the quality of a color regardless of its
luminance. Chromaticity consists of two independent parameters, often specified as hue (h)
and colorfulness (s), where the latter is alternatively called saturation, chroma, intensity, or
excitation purity. This number of parameters follows from trichromacy of vision of most
humans, which is assumed by most models in color science.

20. What do you mean by color model?


A color model is an abstract mathematical model describing the way colors can be
represented as tuples of numbers, typically as three or four values or color components.
14
When this model is associated with a precise description of how the components are to be
interpreted (viewing conditions, etc.), the resulting set of colors is called color space. This
section describes ways in which human color vision can be modeled.

21. Write short notes on HLS color model.


HLS color model A color model that defines colors by the three parameters hue (H),
lightness (L), and saturation (S). It was introduced by Tektronix Inc. Hue lies on a circle,
saturation increases from center to edge of this circle, lightness goes from black to white. This
model uses the same hue plane as the HSV model, but it replaces value (V) by an extended
lightness axis so that the maximum color gamut is at L=0.5 and decreases in each direction
towards white (L=1) and black (L=0). The HLS color model is represented by a double
hexagonal cone, with white at the top apex and black at the bottom.

22. What is Color gamut?


The color models used to describe combinations of light in terms of dominant frequency
use three colors to obtain a reasonably wide range of colors, called the color gamut for that
model.

23. What for CMY color model used?


The CMYK color model (process color, four color) is a subtractivecolor model, used color
printing, and is also used to describe the printing process itself. CMYK refers to the four inks
used in some color printing: cyan, magenta, yellow, and key (black). Though it varies by print
house, press operator, press manufacturer, and press run, ink is typically applied in the order
of the abbreviation.
The "K" in CMYK stands for key because in four-color printing, cyan, magenta, and yellow
printing plates are carefully keyed, or aligned, with the key of the black key plate. Some
sources suggest that the "K" in CMYK comes from the last letter in "blac k" and was chosen
because B already means blue

24. What is HSV model?


Hue, Saturation, Value or HSV is a color model that describes colors (hue or tint) in terms
of their shade (saturation or amount of gray) and their brightness (value or luminance).The

15
HSV color wheel may be depicted as a cone or cylinder. Instead of Value, the color model
may use Brightness, making it HSB (Photoshop uses HSB).

16
PART – B

1. Explain RGB,CMY,YIQ and YUV color models. (APR/MAY 18) (or) Write briefly on YIQ Color
Model.(NOV/DEC17)
Colours used in graphics are based on a particular model. The model you pick depends on the
range of colours you need in a graphic and whether it is going to be output to print media or to
screen. There are various colour models available. Some of these are:
Black & white
Greyscale
RGB - Red, Green and Blue
CMYK - Cyan, Magenta, Yellow and Black
Lab - Luminance, 'a' & 'b' stand for chrominance
HSB - Hue, Saturation & Brightness. Other similar models are:
HSL, where L stands for Lightness,
HSV, where V stands for 'brightness Value' and
HCV, where C stands for Chroma and V for Value.
Indexed
Web safe
Print media such as magazines, leaflets and posters can use the CMYK, Greyscale and Lab
colour models. The Lab colour model isn't as commonly used.

Graphics that are going to be displayed on screen use the RGB or HSB/HSL/HSV colour models.
There is also the YUV and YCC models which are used for TVs.

RGB and CYMK are the most common colour models used for graphics. RGB is known as the
primary colour model. Any device that uses light to display graphics eg TVs, film projectors,
computer monitors, used the RGB colour model.

When combinations of pure red, green and blue are applied, they produce either Cyan, Magenta
or Yellow. CMYK is therefore known as the secondary colour model, as it is created from the
primary colour model.

RGB Color Model


Based on the tristimulus theory of version, our eyes perceive color through the stimulation of
three visual pigments in the cones on the retina. These visual pigments have peak sensitivity at
wavelengths of about 630 nm (red), 530 nm (green) and 450 nm (blue). By comparing intensities
in a light source, we perceive the color of the light. This is the basis for displaying color output on
a video monitor using the 3 color primaries, red, green, and blue referred to as the RGB color
model. It is represented in the below figure.

17
The sign represents black, and the vertex with coordinates (1,1,1) in white Vertices of the cube
on the axes represent the primary colors, the remaining vertices represents the complementary
color for each of the primary colors.
The RGB color scheme is an additive model. (i.e.,) Intensities of the primary colors are added to
produce other colors.
Each color point within the bounds of the cube can be represented as the triple (R,G,B) where
values for R, G and B are assigned in the range from 0 to1. The colorCλ is expressed in RGB
component as
Cλ = RR + GG + BB
The magenta vertex is obtained by adding red and blue to produce the triple (1,0,1) and white at
(1,1,1) in the sum of the red, green and blue vertices.
Shades of gray are represented along the main diagonal of the cube from the origin (black) to the
white vertex.

CYMK

White is pure colour whereas black is the lack of colour. Black is not actually a colour at all. When
you combine pure cyan, magenta and yellow together you get black. That is what the 'K' stands
for - B is reserved for 'Blue'. It is for this reason that CMYK is known as the subtractive colour
model. As stated earlier, CMYK is used for print media. When you combine CMY ink together you
don't get a pure black, therefore black ink has to be added.

18
RGB is known as the additive colour model because when the pure colours are combined they create colour
(white).

YIQ and YUV


In TV broadcasting the color is for all practical purposes an addition to the black and white
information, provided
by the so-called Y-signal: Y = g1*R+ g2*G + g3*B where g1+g2+g3 = 1.0. Two additional low-
bandwidth signal
pathways transport the color information in a form of weighted difference between the real signal
and the Y
component.
YIQ:
is used in color TV norm NTSC (America and Japan).
Y-chanel = Y signal
I-chanel = weighted difference between "redness" and "blueness"
Q-chanel = weighted sum of "redness" and "blueness"
Y = g1*R + g2*G + g3*B Y-Bandwidth 4.2 MHz
I = g3*(R-Y) - g4*(B-Y) I-Bandwidth 1.2 MHz
Q = g5*(B-Y) + g6*(R-Y) Q-Bandwidth 0.6 MHz
YUV:
is used in the PAL colorTV norm (Europe, Africa, Asia except for Japan, Australia) and in digital
video. YUV

19
uses similar signals as YIQ (with different weights, however, and using a coordinate system,
rotated 33
degrees) but with a higher bandwidth and correspondingly higher quality.
Y-chanel = Black and white signal Y-Bandwidth 5.5 MHz
U-chanel contains the difference of two weighted differences U-Bandwidth 1.3 MHz
V-chanel contains the sum of two weighted differences V-Bandwidth 1.3 MHz
HLS, HSV, HVC
These color models reflect the human color vision better than the RGB, CMY, YUV and YIQ
models, which are
targeted primarily for hardware applications. HLS, HSV, HVC are better suited for human than for
electronic
communication.
HLS is the abreviation for Hue-Lightness-Saturation.
The HLS-Model can be best understood by an analogy of a painter deciding for a color he or she
will apply:
(1) choose first a pure color (=Hue).
(2) add white pigment to it, so that it loses a little of its individuality (=Saturation).
(3) Now add the black pigment, so that the color is not too bright (=Lightness)
The three coordinates H, L and S of this system can be easily visualized as follows:
Pure colors are found at the outer border of a horizontal color circle. The hue can be interpreted
as the polar angle, going from red (0 degrees), green (120), blue (240) back to red.
The circle is closed to the outside, on the other side any point within the circle stands for some
color. The closer to the center of the circle the higher the proportion of the white color. The center
of the circle is colorless white.
Below this level other color circles are positioned in a cylindrical fashion. The lower they are, the
darker they get. Descending along the vertical axis of the system from its top down to the bottom,
one crosses from bright white color down to complete black. Off-axis, for instance for hue=red,
one descends from bright red down to dark red, with the degree of color saturation depending on
how far off-axis we are. Note that bright red is not as bright as bright white, which, additional to
bright red, also contains bright green and bright blue.
This is why the final form of an HLS system consists of two tops (rotational pyramids), with their
bottom sides glued together. The top point denotes absolute white, the bottom absolute black
and the middle circle a circular approximation of all available colors at an intermediate intensity.
The Hue coordinate is described by an angle between 0 and 360 degrees, the Lightness (vertical
axis) and Saturation (radial distance from the Lightness axis) with values between 0.0 and 1.0.
The maximal color saturation possible depends on Lightness. Halfway from the top (L=0.5) the
maximum saturation (in other words
the radius of the circle) is S=1.0. The red color for instance thus has coordinates like H = 0
Degrees, L = 0.5 and S = 1.0

20
HSV Color Model The HSV model uses color descriptions that have a more interactive appeal to
a user. Color parameters in this model are hue (H), saturation (S), and value (V). The 3D
representation of the HSV model is derived from the RGB cube. The outline of the cube has the
hexagon shape.
The boundary of the hexagon represents the various hues, and it is used as the top of the HSV
hexcone.
In the hexcone, saturation is measured along a horizontal axis, and value is along a vertical axis
through the center of the hexcone.
Hue is represented as an angle about the vertical axis, ranging from 00 at red through 3600.
Vertices of the hexagon are separated by 600 intervals.
Yellow is at 600, green at 1200 and cyan opposite red at H = 1800. Complementary colors are
1800 apart.

Saturation S varies from 0 to 1. the maximum purity at S = 1, at S = 0.25, the hue is said to be
one quarter pure, at S = 0, we have the gray scale.
Value V varies from 0 at the apex to 1 at the top.
- the apex representation black.
At the top of the hexcone, colors have their maximum intensity.
When V = 1 and S = 1 we have the “pure‟ hues.
White is the point at V = 1 and S = 0.

HVC
HVC is an abreviation of Hue-Value-Chroma.
This is a practical color coordinate system, designed about 1900 by a physicist A. Munsell. It is
based on a set of samples, whose production is carefully controlled to ensure repeatability. The
samples have been selected in such a fashion that from the point of view of human vision they
sample the seeable colors in equidistant fashion.
It is good in cases when subjective impression of the color is asked for but less useful in case of
technical systems.

21
2. Draw the CIE chromaticity diagram and explain. (6)
The Commission International de l' Eclairage(CIE) was founded in 1913
It succeeded the Commission International de Photometrie
The recognized international standards body for questions of human perception and
colour
The CIE colourimetric system is the standard from which all others are dervied
Published the Basic Colourimetric Terms (BCT)
CIE XYZ
To solve these problems, a tristimulus system derived from RGB and based on
imaginary primaries referred to as XYZ was defined in 1931
All three are outside the human visual gamut
Hence only positive XYZ values can occur!
CIE

22
CIE Chromaticity Diagram
comparing color gamuts
identifying complementary colors
determining dominant wavelength, purity spectral color positions are along the
boundary curve
color gamuts defined for a two color and a three color system of primaries

3. Digitize the line with end points (0,0) and (4,6) using DDA line drawing algorithm.
[APR/MAY 2018]
DDA Algorithm (Digital differential analyzer)
1. Get the two end points
2. Calculate the Horizontal and vertical difference between two end points (dx,dy)
3. The greatest difference value is taken as the length value.
4. Calculate the step value dx=dx/length, dy=dy / length
5. Start plotting the line from the first point.
6. Repeat through 9 step up to length value times
7. if dx>dy and xa<xb then increment x by 1 and increment y by m
8. if dx>dy and xa>xb then decrement x by 1 and decrement y by m
9. if dx<dy ya<yb then increment y by 1 and increment x by 1/m

10. if dx<dy and ya>yb then decrement y by 1 and decrement x by 1/m

Advantages of DDA Algorithm


1. It is the simplest algorithm and it does not require special skills for implementation.
2. It is a faster method for calculating pixel positions than the direct use of equation y = mx
+ b. It eliminates the multiplication in the equation by making use of raster characteristics,
so that appropriate increments are applied in the x or v direction to find the pixel positions
along the line path.
Disadvantages of DDAAlgorithm

23
1. Floating point arithmetic in DDA algorithm is still time-consuming.
2. The algorithm is orientation dependent. Hence end point accuracy is poor.
Consider the line from (0,0) to (4,6). Use the simple DDA algorithm to rasterize this
line.
Sol. Evaluating steps 1 to 5 in the DDA algorithm we have

Xl = 0 Y1 = 0
X2 = 4 Y2 = 6
Length = |Y2-Y1l = 6
∆X = |X2- Xl | / Length
= 4
6
∆Y = |Y2- Yl | / Length
= 6/6=1
Initial value for
X = 0 + 0.5 * Sign (4) = 0.5
6
Y = 0 + 0.5 * Sign (1) = 0.5

Tabulating the results of each iteration in the step 6 we get,

24
4. Explain the properties of a circle. [NOV/DEC2017]
In geometry, a large number of facts about circles and their relations to straight lines,
angles and polygons can be proved. These facts are called the properties of the circle.
 Circles having equal radii are congruent.
 Circles having different radii are similar.
 The central angle which intercepts an arc is the double of any inscribed angle that
intercepts the same arc (proof).
 The radius perpendicular to a chord bisects the chord.
 The chords equidistant from the center are equal in length.
 A tangent to a circle is at a right angle to the radius at the point of contact.
 Two tangents drawn on a circle from a point outside are equal in length.
 The angle subtended at the center of a circle by its circumference is equal to four
right angles.
 The circumference of two different circles is proportional to their corresponding
radii.
 Arcs of the same circle are proportional to their corresponding angles.
 Radii of the same circle or equal circles are equal.
 Equal chords have equal circumferences.
 The diameter of a circle is the longest chord.

5. Discuss briefly about curve attributes.[NOV/DEC2015] [APR/MAY 2017] [OR]


Attributes of Output Primitives.
Any parameter that affects the way a primitive is to be displayed is referred to as an
attribute parameter. Example attribute parameters are color, size etc. A line drawing
function for example could contain parameter to set color, width and other properties.
1. Line Attributes
2. Curve Attributes
3. Color and Grayscale Levels
25
4. Area Fill Attributes
5. Character Attributes
6. Bundled Attributes
Line Attributes
Basic attributes of a straight line segment are its type, its width, and its color. In some
graphics packages, lines can also be displayed using selected pen or brush options
* Line Type
* Line Width
* Pen and Brush Options
* Line Color
Line type
Possible selection of line type attribute includes solid lines, dashed lines and dotted
lines. To set line type attributes in a PHIGS application program, a user invokes the
function
setLinetype (lt)
Where parameter lt is assigned a positive integer value of 1, 2, 3 or 4 to generate lines
that are solid, dashed, dash dotted respectively. Other values for line type parameter it
could be used to display variations in dot-dash patterns.
Line width
Implementation of line width option depends on the capabilities of the output device to
set the line width attributes.
setLinewidthScaleFactor (lw)
Line width parameter lw is assigned a positive number to indicate the relative width of
line to be displayed. A value of 1 specifies a standard width line. A user could set lw to a
value of 0.5 to plot a line whose width is half that of the standard line. Values greater than
1 produce lines thicker than the standard.
Line Cap
We can adjust the shape of the line ends to give them a better appearance by adding
line caps.
There are three types of line cap. They are
* Butt cap
* Round cap
* Projecting square cap
Butt cap obtained by adjusting the end positions of the component parallel lines so that

26
the thick line is displayed with square ends that are perpendicular to the line path.
Round cap obtained by adding a filled semicircle to each butt cap. The circular arcs are
centered on the line endpoints and have a diameter equal to the line thickness.
Projecting square cap extend the line and add butt caps that are positioned one-half of
the line width beyond the specified endpoints.

Three possible methods for smoothly joining two line segments


* Mitter Join
* Round Join
* Bevel Join
A miter join accomplished by extending the outer boundaries of each of the two lines
until they meet.
A round join is produced by capping the connection between the two segments with a
circular boundary whose diameter is equal to the width.
A bevel join is generated by displaying the line segment with but caps and filling in tri
angular gap where the segments meet.

Pen and Brush Options


With some packages, lines can be displayed with pen or brush selections. Options in

27
this category include shape, size, and pattern. Some possible pen or brush shapes are
given in Figure

Line color
A poly line routine displays a line in the current color by setting this color value in the
frame buffer at pixel locations along the line path using the set pixel procedure.
We set the line color value in PHlGS with the function
setPolylineColourIndex (lc)
Nonnegative integer values, corresponding to allowed color choices, are assigned to
the line color parameter lc
Example: Various line attribute commands in an applications program is given by the
following sequence of statements
setLinetype(2);
setLinewidthScaleFactor(2);
setPolylineColourIndex (5);
polyline(n1, wc points1);
setPolylineColorIindex(6);
poly line (n2, wc points2);
This program segment would display two figures, drawn with double-wide dashed lines.
The first is displayed in a color corresponding to code 5, and the second in color 6.
Curve attributes
Parameters for curve attribute are same as those for line segments. Curves displayed
with varying colors, widths, dot – dash patterns and available pen or brush options

28
6. Calculating the pixel location approximating the first octant of a circle having centre at (4,5) and
the radius 4 units using Bresenham's circle drawing algorithm.(8) [NOV/DEC2016]
Bresenham’s Algorithm :
We cannot display a continuous arc on the raster display. Instead, we have to choose the
nearest pixel position to complete the arc.

From the following illustration, you can see that we have put the pixel at (X, Y) location and now
need to decide where to put the next pixel − at N (X+1, Y) or at S (X+1, Y-1).

This can be decided by the decision parameter d.

 If d <= 0, then N(X+1, Y) is to be chosen as next pixel.

 If d > 0, then S(X+1, Y-1) is to be chosen as the next pixel.

Algorithm
Step 1 − Get the coordinates of the center of the circle and radius, and store them in x, y, and R
respectively. Set P=0 and Q=R.

Step 2 − Set decision parameter D = 3 – 2R.

Step 3 − Repeat through step-8 while X < Y.

29
Step 4 − Call Draw Circle (X, Y, P, Q).

Step 5 − Increment the value of P.

Step 6 − If D < 0 then D = D + 4x + 6.

Step 7 − Else Set Y = Y + 1, D = D + 4(X-Y) + 10.

Step 8 − Call Draw Circle (X, Y, P, Q).

Draw Circle Method(X, Y, P, Q).

Call Putpixel (X + P, Y + Q).


Call Putpixel (X - P, Y + Q).
Call Putpixel (X + P, Y - Q).
Call Putpixel (X - P, Y - Q).
Call Putpixel (X + Q, Y + X).
Call Putpixel (X - Q, Y + X).
Call Putpixel (X + Q, Y - X).
Call Putpixel (X - Q, Y - X).

7. Write down and explain the midpoint circle drawing algorithm. Assume 10 cm as the
radius and co-ordinate origin as the centre of the circle.(NOV/DEC
2009,2010,2011,2015)
Answer: Midpoint circle Algorithm
1. Input radius r and circle center (xc,yc) and obtain the first point on the circumference of
the circle centered on the origin as (x0,y0) = (0,r)
2. Calculate the initial value of the decision parameter as P0=(5/4)-r
3. At each xk position, starting at k=0, perform the following test. If Pk <0 the next point
along the circle centered on (0,0) is (xk+1,yk) and Pk+1=Pk+2xk+1+1 Otherwise the next
point along the circle is (xk+1,yk-1) and Pk+1=Pk+2xk+1+1-2 yk+1 Where 2xk+1=2xk+2
and 2yk+1=2yk-2
4. Determine symmetry points in the other seven octants.
5. Move each calculated pixel position (x,y) onto the circular path centered at (xc,yc) and
plot the coordinate values. x=x+xc y=y+yc
30
6. Repeat step 3 through 5 until x>=y.

Example : Midpoint Circle Drawing


Given a circle radius r=10
The circle octant in the first quadrant from x=0 to x=y.
The initial value of the decision parameter is
P0=1-r = - 9
or the circle centered on the coordinate origin,
the initial point is (x0,y0)=(0,10)
and initial increment terms for calculating the decision parameters are 2x0=0 , 2y0=20
Successive midpoint decision parameter values and the corresponding coordinate positions
along the circle path are listed in the following table 2
k pk (xk+1, 2xk+1 2yk+1
yk-1)
0 -9 (1,10) 2 20
1 -6 (2,10) 4 20
2 -1 (3,10) 6 20
3 6 (4,9) 8 18
4 -3 (5,9) 10 18
5 8 (6,8) 12 16
6 5 (7,7) 14 14

8. Explain midpoint ellipse algorithm with an example?


Answer: Midpoint Ellipse Algorithm
1.Input rx,ry and ellipse center (xc,yc) and obtain the first point on an ellipse centred on
the origin as (x0,y0) = (0,ry)
2. Calculate the initial value of the decision parameter in region 1 as
P10=ry2-rx2ry +(1/4)rx2
31
3. At each xk position in region1 starting at k=0 perform the following test. If P1k<0, the
next point along the ellipse centered on (0,0) is (xk+1, yk) and
p1k+1 = p1k +2 ry2xk +1 + ry2
Otherwise the next point along the ellipse is (xk+1, yk-1) and p1k+1 = p1k +2 ry2xk +1 -
2rx2 yk+1 + ry2 with 2 ry2xk +1 = 2 ry2xk + 2ry2 2 rx2yk +1 = 2 rx2yk + 2rx2 And continue
until 2ry2 x>=2rx2 y 3
4. Calculate the initial value of the decision parameter in region 2 using the last point
(x0,y0) is the last position calculated in region 1.
p20 = ry2(x0+1/2)2+rx2(yo-1)2 – rx2ry2
5. At each position yk in region 2, starting at k=0 perform the following test, If p2k>0 the
next point along the ellipse centered on (0,0) is (xk,yk-1) and
p2k+1 = p2k – 2rx2yk+1+rx2 Otherwise the next point along the ellipse is (xk+1,yk-1) and
p2k+1 = p2k + 2ry2xk+1 – 2rxx2yk+1 + rx2 Using the same incremental calculations for x
any y as in region 1.
6. Determine symmetry points in the other three quadrants.
7. Move each calculate pixel position (x,y) onto the elliptical path centered on (xc,yc) and
plot the coordinate values
x=x+xc, y=y+yc
8. Repeat the steps for region1 unit 2ry2x>=2rx2y

9. Explain the DDA and Bresenham Line drawing Algorithm.[NOV/DEC 2012]

A line connects two points. It is a basic element in graphics. To draw a line, you need two points
between which you can draw a line. In the following three algorithms, we refer the one point of
line as X0,Y0X0,Y0 and the second point of line as X1,Y1X1,Y1.

DDA Algorithm
Digital Differential Analyzer (DDA) algorithm is the simple line generation algorithm which is
explained step by step here.

Step 1 − Get the input of two end points (X0,Y0)(X0,Y0) and (X1,Y1)(X1,Y1).

Step 2 − Calculate the difference between two end points.

dx = X1 - X0
32
dy = Y1 - Y0

Step 3 − Based on the calculated difference in step-2, you need to identify the number of steps
to put pixel. If dx > dy, then you need more steps in x coordinate; otherwise in y coordinate.

if (absolute(dx) > absolute(dy))

Steps = absolute(dx);

else

Steps = absolute(dy);

Step 4 − Calculate the increment in x coordinate and y coordinate.

Xincrement = dx / (float) steps;

Yincrement = dy / (float) steps;

Step 5 − Put the pixel by successfully incrementing x and y coordinates accordingly and
complete the drawing of the line.

for(int v=0; v < Steps; v++)

x = x + Xincrement;

y = y + Yincrement;

putpixel(Round(x), Round(y));

Bresenham’s Line Generation


The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage
of this algorithm is that, it uses only integer calculations. Moving across the x axis in unit
intervals and at each step choose between two different y coordinates.

For example, as shown in the following illustration, from position (2, 3) you need to choose
between (3, 3) and (3, 4). You would like the point that is closer to the original line.

33
At sample position Xk+1,Xk+1, the vertical separations from the mathematical line are labelled
as dupperdupper and dlowerdlower.

From the above illustration, the y coordinate on the mathematical line at xk+1xk+1is −
Y = m(XkXk+1) + b
So, dupperdupper and dlowerdlower are given as follows −
dlower=y−ykdlower=y−yk

=m(Xk+1)+b−Yk=m(Xk+1)+b−Yk

and

dupper=(yk+1)−ydupper=(yk+1)−y

34
=Yk+1−m(Xk+1)−b=Yk+1−m(Xk+1)−b
You can use these to make a simple decision about which pixel is closer to the mathematical
line. This simple decision is based on the difference between the two pixel positions.

dlower−dupper=2m(xk+1)−2yk+2b−1dlower−dupper=2m(xk+1)−2yk+2b−1

Let us substitute m with dy/dx where dx and dy are the differences between the end-points.

dx(dlower−dupper)=dx(2dydx(xk+1)−2yk+2b−1)dx(dlower−dupper)=dx(2dydx(xk+1)−2yk+2b−1)

=2dy.xk−2dx.yk+2dy+2dx(2b−1)=2dy.xk−2dx.yk+2dy+2dx(2b−1)

=2dy.xk−2dx.yk+C=2dy.xk−2dx.yk+C

So, a decision parameter PkPk for the kth step along a line is given by −
pk=dx(dlower−dupper)pk=dx(dlower−dupper)

=2dy.xk−2dx.yk+C=2dy.xk−2dx.yk+C

The sign of the decision parameter PkPk is the same as that of dlower−dupperdlower−dupper.
If pkpk is negative, then choose the lower pixel, otherwise choose the upper pixel.
Remember, the coordinate changes occur along the x axis in unit steps, so you can do
everything with integer calculations. At step k+1, the decision parameter is given as −

pk+1=2dy.xk+1−2dx.yk+1+Cpk+1=2dy.xk+1−2dx.yk+1+C

Subtracting pkpk from this we get −


pk+1−pk=2dy(xk+1−xk)−2dx(yk+1−yk)pk+1−pk=2dy(xk+1−xk)−2dx(yk+1−yk)

But, xk+1xk+1 is the same as (xk)+1(xk)+1. So −


pk+1=pk+2dy−2dx(yk+1−yk)pk+1=pk+2dy−2dx(yk+1−yk)

Where, Yk+1–YkYk+1–Yk is either 0 or 1 depending on the sign of PkPk.


The first decision parameter p0p0 is evaluated at (x0,y0)(x0,y0) is given as −
p0=2dy−dxp0=2dy−dx

Now, keeping in mind all the above points and calculations, here is the Bresenham algorithm for
slope m < 1 −

Step 1 − Input the two end-points of line, storing the left end-point in (x0,y0)(x0,y0).
Step 2 − Plot the point (x0,y0)(x0,y0).
Step 3 − Calculate the constants dx, dy, 2dy, and (2dy – 2dx) and get the first value for the
decision parameter as −

p0=2dy−dxp0=2dy−dx

Step 4 − At each XkXk along the line, starting at k = 0, perform the following test −
If pkpk < 0, the next point to plot is (xk+1,yk)(xk+1,yk) and
pk+1=pk+2dypk+1=pk+2dy

Otherwise,

35
(xk,yk+1)(xk,yk+1)

pk+1=pk+2dy−2dxpk+1=pk+2dy−2dx

Step 5 − Repeat step 4 (dx – 1) times.

For m > 1, find out whether you need to increment x while incrementing y each time.

After solving, the equation for decision parameter PkPk will be very similar, just the x and y in
the equation gets interchanged.

36

Das könnte Ihnen auch gefallen