CG Unit 1
CG Unit 1
Ans: Computer graphics is an art of drawing pictures ,lines, charts etc. using computers with the help of
programming. Computer graphics image is made up of number of pixels. Computer graphics is a field of
computer science that is concerned with digitally synthesizing and manipulating visual contents.
Objects are real world entities defined in three-dimensional world coordinates. In computer graphics
we deal with both 2D and 3D descriptions of an object.
(ii)Presentation Graphics
(iii)Education
(iv)Training
Ans: Pixel is the smallest addressable graphical unit represented on the computer screen.
The special procedure determines which pixel will provide the best approximation to the desired picture
or graphics object this process is called Rasterization.
The process of representing continuous picture or graphics object as a collection of discrete pixels is
called as Scan Conversion
5.WRITE ANY TWO DIFFERENCE BETWEEN RANDOM SCAN AND RASTER SCAN DISPLAY.
Ans: Scanline is one line,or row,in a raster scanning pattern,such as a line of video on a cathode ray
tube(CRT) display of a television set or computer monitor.
7.WHAT IS DIGITAL ART?
Ans:Using computer graphics we can create fine and commercial art which include animation
packages, paint packages. Cartoon drawing, paintings, logo design can also be done.
8.WRITE ANY TWO DIFFERENCE BETWEEN RASTER AND VECTOR BASED GRAPHICS?
Ans:
RASTER BASED GRAPHICS VECTOR BASED GRAPHICS
Bitmap images/raster are usually created and Vector based images are usually created and
edited in photo or paint programs such as edited in software like CoralDRAW and
Adobe Photoshop Adobe Illustrator.
Bitmap images are mapped to a grid or an These images have smooth edges and create
array of pixels. curves or shapes.
2)Not suitable for very brightly environment and also produce a lot of heat.
Ans: The return to the left of the screen, after refreshing each scan line, is called the horizontal retrace
of the electron beam. And at the end of each frame (displayed in 1/80th to 1/60th of a second), the
electron beam returns to the top left comer of the screen to begin the next frame is called vertical
retrace.
Graphdriver is an integer that specifies the graphics driver to be used and graphmode is an integer
that specifies the initial that specifies the initial graphics mode.
18. Write the ‘C’ graphics function used to draw (any one)
a) Circle b) rectangle c) ellipse d) polygon
a) Circle:
circle(x,y,radius)
b) rectangle:
c) ellipse:
ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius)
d) polygon:
polygon(
Image Representation
Representations of shapes and images may be approximations of the real world or synthetic
constructs that exist only in the computer. Pictures are represented as a collection of discrete
picture element called pixels. It is the smallest addressable screen element. The process of
determining the appropriate pixels for representing pictures or objects is called rasterization.
The process of representing continuous pictures as graphical object(as a collection of discrete
pixel) is called scan conversion.
Rasterization is the task of taking an image described in a vector graphics format (shapes) and
converting it into a raster image (pixels or dots) for output on a video display or printer, or for
storage in a bitmap file format. Digital image is a 2D discrete signal
It is represented as follows:
F(x,y)= f(0,0) f(0,1)---------f(0,n-1)
f(0,0) f(1,1)---------f(0,n-1)
: :
: :
f(M-1,0) f(M-1,1)-------f(M-1,N-1)
Ans:Raster-Scan Displays: The most common type of CRT is the raster-scan display. 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. 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. Each screen point is referred to as a pixel or pel (shortened forms of picture
element). For a black and white system, each screen point is either on or off, so only one bit per
pixel is needed to control the intensity of screen positions. Fora bi-level system, a bit value of 1
indicates that the electron beam is to be turned on at that position, and a value of 0 indicates that
the beam intensity is to be off. Additional bits are needed when colour and intensity variations can
be displayed. On a black-and-white system with one bit per pixel, the frame buffer is commonly
called a bitmap.
Refreshing on raster-scan displays is carried out at the rate of 60 to 80frames per second.
Sometimes, refresh rates are described in units of cycles per second, or Hertz (Hz), where a cycle
corresponds to one frame. Using these units, we would describe a refresh rate of 60 frames per
second as simply 60 Hz. 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. The return to the left of the screen, after refreshing
each scan line, is called the horizontal retrace of the electron beam. And at the end of each frame
(displayed in 1/80th to 1/60th of a second), the electron beam returns to the top left comer of the
screen to begin the next frame is called vertical retrace.
Random-scan systems are designed for line-drawing applications and cannot display realistic
shaded scenes. Since picture definition is stored as a set off-line-drawing instructions and not as a
set of intensity values for all screen points, vector displays generally have higher resolution than
raster systems. Also, vector displays produce smooth line drawings because the CRT beam directly
follows the line path. A raster system, in contrast, produces jagged lines that are plotted as discrete
points.
5.DIFFERENCE BETWEEN RANDOM AND RASTER SCAN DISPLAY.
Ans:Difference between raster scan display and random scan display
Raster scan display Random scan display
It draws the image by scanning one row at a It draws the image by directing the electron
time. beam directly to the part of the screen, where
the image is to be drawn.
They generally have resolution limited to pixel They have higher resolution than the raster
size. scan system.
Lines are jiggered and curves are less smooth. Line plots are straight and curves are smooth.
They are more suited to geometric area They are more suited to line drawing
drawing applications, eg. Monitors, T.V application. Eg. CRO, pen plotter
Cost of raster are lesser than random scan It is costlier than raster scan display
display
Resolution is lesser or lower than random scan Resolution is higher than raster .
display
➢ Computer Art/Digital Art: Using computer graphics we can create fine and commercial
art which include animation packages, paint packages. Cartoon drawing, paintings, logo
design can also be done.
➢ Computer Aided Drawing: Designing of buildings, automobile, aircraft is done with the
help of computer aided drawing, this helps in providing minute details to the drawing and
producing more accurate and sharp drawings with better specifications.
➢ Presentation Graphics: For the preparation of reports or summarizing the financial,
statistical, mathematical, scientific, economic data for research reports, managerial reports,
moreover creation of bar graphs, pie charts, time chart, can be done using the tools present
in computer graphics.
➢ Entertainment/special effects: Computer graphics finds a major part of its utility in the
movie industry and game industry. Used for creating motion pictures, music video,
television shows, cartoon animation films. In the game industry where focus and
interactivity are the key players, computer graphics helps in providing such features in the
efficient way.
➢ Education: Computer generated models are extremely useful for teaching huge number of
concepts and fundamentals in an easy to understand and learn manner.
➢ Training: Specialized system for training like simulators can be used for training the
candidates in a way that can be grasped in a short span of time with better understanding.
Creation of training modules using computer graphics is simple and very useful.
➢ Video Games: It finds a good place in the gaming and animation industry.
➢ Medical Imaging: It can be used to train new doctors on understanding and experimenting
surgery. It is used in molecular biology to study the biological model in genes.
7.WRITE A NOTE ON FLAT PANEL DISPLAY.
Ans: Flat Panel Displays
The flat panel display technology is becoming increasingly common in a wide variety of consumer
devices that include cellular phones, digital cameras, liquid crystal display (LCD), televisions,
computer displays and personal digital assistants (PDAs). These FDPs are lighter and much thinner
than traditional television and video displays that use a CRT. The FDP can be divided into two
categories: volatile displays and static displays.
• Volatile displays
Volatile displays require constant power output to refresh the image on screen many times
a second. Examples of volatile flat panel displays include plasma displays, liquid crystal
displays (LCDs), light emitting diode displays and organic light emitting diode displays
(OLEDs).
A Plasma Panel Display is a type of flat panel display common to large tv displays 30
inches (76cm) or large. They are called “plasma” displays because they use small cells
containing electrically charged ionized gases which are plasmas. Plasma screens are made
out of glass. This may cause glare from reflected objects in the viewing area. Plasma has
superior uniformity than LCD but plasma panels consume very high electric power
compared to LCD and LED usually around 400 – 500 watts.
Plasma panels salso called gas-discharge displays, are constructed by filling the region
between two glass plates with a mixture of gases such as neon. A series of vertical
conducting ribbons is placed on one glass panel and a set of horizontal ribbons is built into
the other glass panel. Firing voltages applied to a pair of horizontal and vertical conductors
cause the gas at the intersection of the two conductors to break down into glowing plasma
of electrons and ions. Picture definition is stored in a refresh buffer, and the firing voltages
are applied to refresh the pixel positions (at the intersections of the conductors)60 times
per second. One disadvantage of plasma panels has been that they were strictly
monochromatic devices, but systems have been developed that are now capable of
displaying colour and grayscale.
Advantages :
• Refreshing is not required
• Produces a very steady image , totally free of
• flicker.
• Less bulky than a CRT.
• Allows selective writing and selective erasing,
• at a speed of about 20 Micro sec per cell.
Dis advantages:
• Relatively poor resolution of about 60 dots per inch.
• Costlier than CRT’s.
A beam of electrons (cathode rays), emitted by an electron gun, passes through focusing and
deflection systems that direct the beam towards specified positions on the phosphor coated screen.
The phosphor then emits a small spot of light at each position contacted by the electron beam.
Because the light emitted by the phosphor fades very rapidly, some method is needed for
maintaining the screen picture. One way to keep the phosphor glowing is to redraw the picture
repeatedly by quickly directing the electron beam back over the same points. This type of display
is called a refresh CRT.
The components of an electron gun in a CRT are the heated metal cathode and a control grid. Heat
is supplied to the cathode by directing current through a coil of wire, called the filament causes
electrons to be “boiled off”. The free electrons are then accelerated toward the phosphor coating
by a high positive voltage. An accelerating anode can be used to accelerate the electrons towards
the screen. Intensity of the electron beam is controlled by setting voltage levels on the control grid.
Since the amount of light emitted by the phosphor coating depends on the number of electrons
striking the screen.
The focusing system in a CRT is needed to force the electron beam to converge into a small spot
as it strikes the phosphor. Otherwise, the electrons would repel each other, and the beam would
spread out as it approaches the screen. Focusing is accomplished with either electric or magnetic
fields. (Fig: 2) With electrostatic focusing, the electron beam passes through a positively charged
metal cylinder that forms an electrostatic lens. The action of the electrostatic lens focuses the
electron beam at the centre of the screen. Spots of light are produced on the screen by the transfer
of the CRT beam energy to the phosphor. After a short time, the excited phosphor electrons begin
dropping back to their stable ground state. We can observe a glowing spot that quickly fades after
all the excited phosphor electrons have returned to their ground energy level.
Different kinds of phosphors are available for use in a CRT. Besides colour, a major difference
between phosphors is their persistence: how long they continue to emit light (that is, have excited
electrons returning to the ground state) after the CRT beam is removed. Persistence is defined as
the time it takes the emitted light from the screen to decay to one-tenth of its original
intensity.
Lower persistence phosphors require higher refresh rates to maintain a picture on the screen
without flicker. A phosphor with low persistence is useful for animation; ahigh-persistence
phosphor is useful for displaying highly complex, static pictures. The graphics monitors are usually
constructed with persistence in the range from 10 to 60microseconds.
The maximum number of points that can be displayed without overlap on a CRT is referred
to as the resolution. A more precise definition of resolution is the number of points per centimetre
that can be plotted horizontally and vertically.
Resolution of a CRT is dependent on the type of phosphor, the intensity to be displayed, and the
focusing and deflection systems. Typical resolution on high-quality systems is1280 by 1024. High
resolution systems are often referred to as high-definition systems. The physical size of a graphics
monitor is given as the length of the screen diagonal.
Another property of video monitors is aspect ratio. Aspect ratio is a number that gives the ratio
of vertical points to horizontal points necessary to produce equal-length lines in both
directions on the screen. (Sometimes aspect ratio is stated in terms of the ratio of horizontal to
vertical points.) An aspect ratio of 3/4 means that a vertical line plotted with three points has the
same length as a horizontal line plotted with four points.
Components of CRT
1. Electron Gun: Electron gun consisting of a series of elements, primarily a heating filament
(heater) and a cathode. The electron gun creates a source of electrons which are focused into a
narrow beam directed at the face of the CRT.
2. Control Grid: It is used to turn the electron beam on and off.
3. Focusing system: It is used to create a clear picture by focusing the electrons into a narrow
beam.
4. Deflection System: It is used to control the direction of the electron beam. It creates an electric
or magnetic field which will bend the electron beam as it passes through the area. In a conventional
CRT, the yoke is linked to a sweep or scan generator. The deflection yoke which is connected to
the sweep generator creates a fluctuating electric or magnetic potential.
5. Phosphorus-coated screen: The inside front surface of every CRT is coated with phosphors.
Phosphors glow when a high-energy electron beam hits them. Phosphorescence is the term used
to characterize the light given off by a phosphor after it has been exposed to an electron beam.
11. WRITE AND EXPLAIN STAGES OF STEREO 3D PRESENTATION.
Ans: A more recent advancement in display technology called holographic display.
Stereoscopy (also called stereoscopics or 3D imaging) is a technique for creating or enhancing the
illusion of depth in an image by means of stereopsis for binocular vision.
Main concept behind 3D display is to generate a sense of variation in depth.
Stages of stereo 3D presentation:
Source: It is responsible for stereo 3D content creation or playback. In this stage left and right
images are generated. It may be done in 2 ways- native stereo and 3D generation. native
stereo- produces images pairs by an application and 3d generation – uses additional software
of stereo image pairs using a monoscopic source.
Preparation and transmission: This is responsible for preparing 3D image pairs for display
and relaying them to the display device. The prepared images are transmitted to that disply
over a display interface in a format that the display can interpret and use.
Presentation: The presentation of the prepared image pairs is the responsibility of the display
device. There are two main approaches – use of active, frame sequential, display with shutter
glasses and passive display and polarized glasses. First approach uses active frame sequential
display with shutter glasses while second approach is to use passive display and polarized
glasses.
At sampling position xk+l, we label vertical pixel separations from the mathematical line path as
d1and d2(Fig. 2). They coordinate on the mathematical line at pixel column position xk+l is
calculated as y=m(xk+1) + C
then, d1= y - yk=m(xk+1) + C - yk
and d2= (yk + 1) – y = yk + 1 - m(xk+1) - C
calculate d1- d2 (substitute the value of d1 and d2)
(d1- d2 ) = [m(xk+1) + C - yk ]- [yk+1- m(xk+1) – C]
Fig: 5 shows the mid-point between the two candidate pixels at the sampling position xk+1.
Assume that (xk,yk) is the current pixel that is plotted, whether (xk+1, yk) or (xk+1, yk-1) is closer
to the circle is to be determined. The decision parameter is evaluated at the mid-point between
these two pixels:
1
pk=fcircle(xk+1, yk-2)
1
= (xk+1)2 + (yk-2 )2 – r2 (II)
If pk< 0, this midpoint is inside the circle and the pixel on scan line yk is closer to the circle
boundary. Otherwise, the mid position is outside or on the circle boundary, and we select the pixel
on scanline yk - 1.
Successive decision parameters are obtained using incremental calculations. So, the next
1
decision parameter is pk+1 = fcircle(xk+1+1, yk+1- 2)
1
= [(xk+1)+1]2 + (yk+1-2)2 – r2
2
Or pk+1=pk+ 2(xk+1) + (𝑦𝑘+1 -𝑦𝑘2 ) - (yk+1 – yk) +1 (III)
Where yk+1 is either yk or yk-1 depending on the sign of pk. If pk is negative pk+1 is 2xk+1; if pk is
positive pk+1 is 2xk+1+1-2yk+1.
At the starting point x=0 and y=r. The initial value of the decision variable is obtained by
1
evaluating the equation at the mid-point (1, r-2).
1 1
p0=fcircle(1, r-2) = 1+ (r-2)2 – r2
5
p0=4 - r or p0=1-r (IV)
The following procedure illustrates a recursive method for filling a 4- connected area with an
intensity specified in parameter fill up to a boundarycolor specified with parameter boundary. We
can extend this procedure to fill an8-connected -ion by including four additional statements to test
diagonal positions, such is (x + 1, y + 1).
void boundaryFill4(int x, int y, int fill, int boundary)
{
int current;
current=getpixel(x,y);
if((couurent!=boundary) && (current !=fill)
{
setColor(fill);
boundaryFill4(x+1, y, fill, boundary);
boundaryFill4(x-1, y, fill, boundary);
boundaryFill4(x, y+1, fill, boundary);
boundaryFill4(x, y-1, fill, boundary);
}
}