Computer Graphics
and Multimedia.
[email protected]
Introduction to Computer Graphics
Computer graphics is a rapidly evolving field. until the past two
decades graphics was mainly a realm of artist. now, computer
graphics has touched the lives of not only artist and Engineers but
also the common man in various ways.
Buy graphics we will refer to any sketch, drawing, special artwork
or other materials to pictorially depict an object or process or
otherwise convey information, as a supplement to or instead of
written description.
Introduction cont.
In computer graphics, pictures or graphic objects are represented
as a collection of discrete picture elements called pixels (picture
element).
The pixel is the smallest addressable screen elements. it is the
smallest piece of display screen which we can control. The control
is achieved by setting the intensity and colour of the pixel which
compose the screen.
Advantages of Computer Graphics
The advantages of computer graphics are as follows;
1. It provides tools for producing pictures not only of concrete
real-world object but also of abstract, synthetic object such as
mathematical surfaces in 4D and of data that have no inherent
geometry such as Survey results.
2. It has the ability to show moving pictures and thought it is
possible to produce animation with computer graphics.
3. With computer graphics users can also control the animation
speed, portion of the view and goniometric relationship of the
object in the scene to one another and the amount of detail shown.
4. Computer graphics provide tools called motion dynamics. With
this, the user can move and tumble object with respect to
stationary observer, or he can make an object stationary and the
viewer moves around them. A typical example is walk through
made by builders to show flat interior and building surroundings. in
many cases it is possible to move both objects and viewer.
5. Computer graphics also provides facility called update
dynamics. With update dynamics it is possible to change the shape
colour or other properties of the objects being viewed.
6. With the recent development of digital signal processing and
audio synthesis chip the interactive graphics can now provide audio
feedback along with the graphical feedback to make the simulated
environment even more realistic.
Application Areas of Comp. Graphics
Today, computer graphics is used in a variety of Fields ranging
from routine everyday activities to very specialised area in widely
different fields, including business, engineering, medicine,
government, education, training, advertising research, art and
entertainment and communication in general.
Some of the major application area are listed below;
Computer Aided Design/Drafting (CAD/CADD)
A major use of computer graphics is in design process, particularly
for engineering applications such as building and other structural
design, mechanical and industrial design as well as design of
manufacturing processes, including that of automobiles and
aircraft, ships and spacecrafts and many other products.
For some design applications, objects are first displayed in a
wireframe outline form that shows the overall shape and the
internal features of the objects. Wireframe display also allows
designers to quickly see the effect of interactive adjustment to
design shapes.
Current computer aided design (CAD) software packages range
from 2D vector based drafting systems to 3D solid and surface
modellers.
Modern CAD applications can also frequently allow rotation in 3D
allowing viewing of designed objects from a desired angle, even
from the inside looking out. Some CAD software is capable of
dynamic mathematical modelling in which case it may be marketed
as CADD (Computer Aided Design and Drafting).
Presentation Graphics
Presentation refers to the act of presenting important points of a
topic to;
a. the audience for a lecture,
b. potential customers for a new product or service.
The presentation of data in a condensed, visual, convenient form
has always been an aid to understanding and promoting any idea.
Graphics becomes a vital part of presenting ideas and promoting
organisations even in non business endeavours such as at
academic seminars or for proposing a new construction and so on.
Computer graphics has raised such presentations to an art by
making visuals more appealing colourful by incorporating
animations, sound effects, videos in presentations.
Entertainment
Computer graphics methods are used in making music videos
games cartoon movies television shows etc. Sometimes the
graphic scenes are displayed by themselves and sometimes
graphic objects are combined with the actors and live scenes
Several developers have used graphics sound animation of
multimedia to create variety of games.
Computer-Aided Learning
Computer generated models of physical financial and economic
system are used as educational aids. Needless to say, computer
graphics tools like MS Power Point are used heavily in teaching,
seminars and conference presentations on almost every subject at
every level.
Classification of Computer Graphics
Computer graphics can be classified into two main categories,
according to the application areas. They are passive and interactive
graphics.
1. Passive (off-line) computer graphics: The most common
example of passive computer graphics is a static website,
where users have no control over the contents on the monitor.
2. Interactive computer graphics: This is called interactive
graphics. Displays are controlled by mouse, trackball, joystick
etc. Video Games, dynamic websites, special effects in movies
and cartoons are all making use of interactive computer
graphics.
Components of Interactive Computer Graphics system.
Interactive computer graphics consists of three components such
as;
1. Digital Memory buffer
2. Monitor
3. Display controller
Using these components, we are able to see the output on the
screen in the form of pixels
Digital Memory Buffer
This is a place where images and pictures are stored as an array
(matrix of 0 & 1, 0 represents darkness and 1 represents image or
picture).
Frame buffer is the video RAM (V-RAM) that is used to hold or map
the images displayed on the screen
Memory in MB = ( X-resolution x Y-resolution x Bits per pixel )
8 x 1024 x 1024
Monitor
Monitor helps us to view the display and they make use of CRT
technology (Cathode ray Tube).
Display Controller
It is an interface between Memory Buffer and Monitor. Its job is to
pass the contents of frame buffer to the monitor. The image must
be passed repeatedly to the monitor to maintain a steady picture
on the screen.
The display controller reads each successive byte of data from FB
Memory and converts 0's and 1's into corresponding video signals.
This signal is then feed to the monitor to produce a black and white
picture on screen. In today's term, display controller is recognized
as a display card and one of our choices can be VGA card with a
resolution of 640x480.
Computer Vision
Computer vision is the field of computer science that focuses on
creating digital systems that can process, analyze, and make sense
of visual data (images or videos) in the same way that humans do.
The concept of computer vision is based on teaching computers to
process an image at a pixel level and understand it. Technically,
machines attempt to retrieve visual information, handle it, and
interpret results.
The primary goals of computer vision include:
1. Detection, segmentation, location and recognition of certain
objects in an image.
2. Tracking an object through image sequence.
3. Mapping a scene to a 3D model of the scene.
Computer Vision
These goals are achieved by means of pattern recognition,
statistical learning, image processing, graph theory and other
related fields. Cognitive computer vision is strongly related to
cognitive psychology and biological computation.
One interesting application of computer vision, commonly used in
creation of visual effects for cinema and broadcast, is camera
tracking. Computer Vision also finds its application in medicine,
military,industry, security, quality inspection, robotics and many
other Fields
Image Processing
Image processing is a method to perform some operations on an
image, in order to get an enhanced image or to extract some useful
information from it. It is a type of signal processing in which input is
an image and output may be image or characteristics/features
associated with that image. Nowadays, image processing is among
rapidly growing technologies. It forms core research area within
engineering and computer science disciplines too.
Image processing basically includes the following three steps:
1. Importing the image via image acquisition tools;
2. Analysing and manipulating the image;
3. Output in which result can be altered image or report that is
based on image analysis.
Graphics Primitives.
The interactive devices are the devices that give input to the
graphics system and provides necessary feedback to the user
about the accepted input.
Various devices are available for input on a graphics workstation.
Keyboard
A computer keyboard is an input device used to enter characters
and functions into the computer system by pressing buttons, or
keys.
It is the primary device used to enter text. A keyboard typically
contains keys for individual letters, numbers and special characters,
as well as keys for specific functions, it is connected to a computer
system using a cable or a wireless connection.
Standard Keyboard
The number of keys on a keyboard varies from the original standard
of 101 keys to the 104-key windows keyboard.
There are five parts of a standard keyboard;
1. The Alphanumeric Keys
2. The numeric keypad
3. Function keys
4. Modifier keys
5. Cursor movement keys.
How Computer Accepts Inputs From
Keyboard.
When we press a key, a tiny chip in the keyboard called keyboard
controller notes that a key has been pressed. The keyboard
controller places a code (Key Scan) in the buffer of the keyboard to
indicate which key was pressed (Keyboard buffer is a temporary
memory of the keyboard controller).
The keyboard controller sends a signal to the system software
notifying that something happened at the keyboard.
How Computer Accepts Inputs From
Keyboard.
When the system receives the signal it determines the appropriate
response. When a keystroke has occurred, the system reads the
memory location in the keyboard buffer that contains the code of
the key which was pressed. The system software then passes that
code to the CPU.
The Mouse
A computer mouse is a handheld hardware input device that
controls a cursor in a GUI (graphical user interface) for pointing,
moving and selecting text, icons, files, and folders on your
computer.
In addition to these functions, a mouse can also be used to
drag-and-drop objects and give you access to the right-click menu.
The two types of mouse are the (Mechanical and Optical mouse).
Trackball Spaceball
Other pointing device are; touchpad and Joystick.
Touch-Screen
A touch screen is a display device that allows the user to interact
with a computer using their finger or stylus.
They're a useful alternative to a mouse or keyboard for navigating a
GUI (graphical user interface). Touch screens are used on a variety
of devices, such as a computer and laptop displays, smartphones,
tablets, cash registers, and information kiosks.
Digitizers and Graphic Tablets
A graphics tablet ( digitizer, digital graphic tablet, pen tablet, or
digital art board) is an input device that enables a user to
hand-draw images, animations and graphics, with a special pen-like
stylus, similar to the way a person draws images with a pencil and
paper.
These tablets may also be used to capture data or handwritten
signatures. It can also be used to trace an image from a piece of
paper that is taped or otherwise secured to the tablet surface.
Capturing data in this way, by tracing or entering the corners of
linear polylines or shapes, is called digitizing.
Output Devices
Monitor display is good for the creation, checking and modification
of images.
Hardcopy in the form of printed or plotted output on paper is also a
necessity for some use cases.
Printer
A printer is a device that accepts text and graphic output from a
computer and transfers the information to paper, usually to
standard-size, 8.5" by 11" sheets of paper.
Printers vary in size, speed, sophistication and cost. In general, more
expensive printers are used for more frequent printing or
high-resolution color printing.
The major printer technologies available. These technology can be
broken down into two main categories(Impact and Non-impact)
Display Devices
The most important part of a PC is the display system. The display
systems is where the graphics are rendered in the screen of the
computer. It is responsible for graphic display.
Some of the common types of display systems are;
1. Random Scan display
2. Raster Scan display
3. Direct View storage tube
4. Flat Panel display
Display Devices
Display systems has 3 parts;
1. Display Adapter: Creates or holds the color information
2. Monitor: Display the information
3. Cable: Carries the information between the display adapter and
monitor.
Random Scan Display
In Random-Scan Display electron beam is directed only to the
areas of screen where a picture has to be drawn. It is also called
vector display, as it draws picture one line at time. It can draw and
refresh component lines of a picture in any specified sequence. Pen
plotter is an example of random-scan displays.
The number of lines regulates refresh rate on random-scan
displays. An area of memory called refresh display files stores
picture definition as a set of line drawing commands.
Random Scan Display
The system returns back to first-line command in the list, after all
the drawing commands have been processed. High-quality vector
systems can handle around 100, 00 short lines at this refresh rate.
Faster refreshing can burn phosphor. To avoid this every refresh
cycle is delayed to prevent refresh rate greater than 60 frames per
second.
Refresh Rate
Refresh rate refers to the frequency that a display updates the
onscreen image. The time between these updates is measured in
milliseconds (ms), while the refresh rate of the display is measured
in hertz (Hz).
The refresh rate of your display refers to how many times per
second the display is able to draw a new image. This is measured in
Hertz (Hz).
Refresh Rate
For example, if your display has a refresh rate of 144Hz, it is
refreshing the image 144 times per second. When paired with the
high frame rates produced by a GPU and CPU working together,
this can result in a smoother experience and potentially higher FPS.
Raster scan display
Raster Scan Displays are most common type of graphics monitor
which employs CRT. It is based on television technology. In raster
scan system electron beam sweeps across the screen, from top to
bottom covering one row at a time.
A pattern of illuminated pattern of spots is created by turning beam
intensity on and off as it moves across each row. A memory area
called refresh buffer or frame buffer stores picture definition. This
memory area holds intensity values for all screen points. Stored
intensity values are restored from frame buffer and painted on
screen taking one row at a time. Each screen point is referred to as
pixels.
Direct-View Storage Tube (DVST)
Both in the raster scan and random scan system, the screen images
are maintained (flicker free) by redrawing or refreshing the screen
many times per second by cycling through the picture data stored
in the refresh buffer.
A DVST gives the alternative method of maintaining the screen
image, it uses the storage grid which stores the picture information
as a charge distribution just behind the phosphor-coated screen.
It consists of two electron guns:
1. Primary gun
2. Flood gun
Direct-View Storage Tube (DVST)
The primary gun store stores the picture pattern and the flood gun
maintains the picture display.
DVST resembles CRT as it uses electron gun to draw picture and
phosphor coated screen to display it. The phosphor used in this is
of high persistence. DVST does not use refresh buffer or frame
buffer to store picture definition. Picture definition is stored inside
CRT in form positive charged distribution.
Because of this reason DVST is known as Storage Type CRT. In
DVST no refreshing is required as result picture drawn on DVST will
be seen for several minutes before fading.
Flat Panel Display
A flat panel display is a television, monitor or other display device
that uses a thin panel design instead of a traditional cathode ray
tube (CRT) design. These screens are much lighter and thinner, and
can be much more portable than traditional televisions and
monitors. They also have higher resolution than older models.
Examples of flat panel display are: Liquid crystal display (LCD), Gas
plasma display (GPD) and Electroluminescent display (ELD)
Scan Conversion
A straight line may be defined by two endpoints and an equation.
The two endpoints are described by points (x1,y1) and (x2,y2). The
equation of the line is used to determine the x, y coordinates of all
the points that lie between these two endpoints.
Scan Conversion
Scan Conversion
Using the equation of a straight line, y = mx + b where m = slope of a
line and b = the y intercept, we can find values of y by incrementing
x from x =x1, to x = x2. By scan-converting these calculated x, y
values, we represent the line as a sequence of pixels.
Vector Generation
Vector images are graphical representations of mathematical
objects such as lines, curves, and polygons. These graphics are
generated by computer and they follow x and y axis as their
reference definition.
The process of “turning on” the pixels for a line segment is called
Vector Generation.
The following are characteristics of a line:
1. The line should appear as a straight line and it should start and
end accurately.
2. The line should have equal brightness throughout their length
3. The line should be drawn rapidly.
Digital Differential Analyzer (DDA) Algorithm
In any 2-Dimensional plane if we connect two points (x0, y0) and (x1,
y1), we get a line segment.
But in the case of computer graphics, we can not directly join any
two coordinate points, for that we should calculate intermediate
points coordinates and put a pixel for each intermediate point, of
the desired color with help of functions.
Digital Differential Analyzer (DDA) Algorithm
Step 1 − Get the input of two endpoints (X0,Y0) and (X1,Y1).
Step 2 − Calculate the difference between two endpoints.
dx = X1 - X0
dy = Y1 - Y0
Step3 - 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);
Digital Differential Analyzer (DDA) Algorithm
Step 4 − Calculate the increment in x coordinate and y coordinate.
Xincrement = dx / (float) steps;
Yincrement = dy / (float) steps;
Step 5 − Put the pixel on by successfully incrementing x and y
coordinates accordingly and complete the drawing of the line.
for(int i=0; i < Steps; i++){
x = x + Xincrement;
y = y + Yincrement;
putpixel(Round(x), Round(y));
}
Advantages of (DDA) Algorithm
1. It is simple and easy to implement algorithm.
2. It avoid using multiple operations which have high time
complexities.
3. It is faster than the direct use of the line equation because it
does not use any floating point multiplication and it calculates
points on the line.
Advantages of (DDA) Algorithm
1. It deals with the rounding off operation and floating point
arithmetic so it has high time complexity.
2. As it is orientation dependent, so it has poor endpoint accuracy.
3. Due to the limited precision in the floating point representation
it produces cumulative error.
Bresenham’s Line Drawing Algorithm