INTRODUCTION TO
COMPUTER GRAPH Unit One
ICS 2019/2020 ACADEMIC YEAR
WHAT IS COMPUTER GR
APHICS?
The algorithms and hardware required to produce realistic a
nd/or useful images on a computer
Computer graphics is an art of drawing pictures on compute
r screens with the help of programming
It involves computations, creation, and manipulation of data
In other words, we can say that computer graphics is a rend
ering tool for the generation and manipulation of images
2019/2020 ACADEMIC YEAR
2019/2020 ACADEMIC YEAR
i t i on
e fi n
j ec t D Geometric Representation
Ob
Transformation
Scan Conversion
Alias Effect
Anti Aliasing
2019/2020 ACADEMIC YEAR
WHAT IS COMPUTER GR
APHICS?
Projection
Hidden Surface removal
Local Illumination model
Global Illumination model
Surface Texture
Shadow Generation
2019/2020 ACADEMIC YEAR
COMPUTER GRAPHICS PR
OCESS
2019/2020 ACADEMIC YEAR
APPLICATIONS OF COMP
UTER GRAPHICS
Simulation Design Display of Informatio
n
Computer Art Entertainment
Education and Traini
ng
…
2019/2020 ACADEMIC YEAR
GRAPHS AND CHARTS
Graphs and Charts are widely used for visualizing relationshi
ps and trends in scientific, mathematical, financial, economi
c data, and others
E.g. FusionChart, Microsoft Excel
2019/2020 ACADEMIC YEAR
COMPUTER-AIDED DESIG
N (CAD)
CAD and CADD involve using a computer application to ena
ble designers to construct and visualize 3-D models
They are commonly used in fields such as architecture, engin
eering and circuit design
Application program example: AutoCAD
Computer-Aided Manufacturing (CAM) is a similar concept
to CAD, except CAM is linked to the manufacturing process
i.e. the application will directly control, via a hardware communication lin
k, the machine that manufactures the object being designed
2019/2020 ACADEMIC YEAR
DATA VISUALIZATION
More complex, multidimensional, datasets often are difficult
to visualize without computer graphics
These complex datasets are particularly common in science
(scientific visualization) and business (business visualization)
E.g.1: Three-dimensional medical dataset E.g.2: A medical dataset acquired using a Magnetic
of a patient. Here we use computer Resonance Imaging (MRI) scanner. Computer
graphics to visualize the paths of blood graphics allow us to visualize this three-dimensional
vessels inside the patient’s head dataset as three slices through the 3-D volume
2019/2020 ACADEMIC YEAR
VIRTUAL REALITY AND A
UGMENTED REALITY
Virtual Reality (VR) allows users to be immersed in a compute
r generated world, and to interact with it as if they were inter
acting with the real world
VR-headset
2019/2020 ACADEMIC YEAR
VIRTUAL REALITY AND A
UGMENTED REALITY
Augmented Reality (AR) combines a computer-generated vir
tual world with the real world
In AR, computer-generated images are overlaid onto a user’
s view of the real world
E.g. AR system used for
surgery, in which computer-
generated images of hidden
features such as blood
vessels and tumours are
overlaid on the surgeon’s
view of the patient through
a surgical microscope
2019/2020 ACADEMIC YEAR
EDUCATION AND TRAINI
NG
Computer graphics can be very beneficial in education and training
Graphics are used to help students visualize the appearance and lo
cation of different organs inside the body
Another common application of computer graphics is in training
In many jobs it is difficult for workers to get direct experience of th
e environment that they are expected to work in.
This may be because the environment is inaccessible (e.g. space), d
angerous (e.g. bomb disposal), expensive (e.g. flying aircraft) or hi
gh-risk (e.g. surgery) Helicopter simulator
Track driving simulator
Anatomy 2019/2020 ACADEMIC YEAR
GRAPHICAL USER INTERF
ACES
Another possibility that has been opened up by the improve
ments in computer graphics technology is in the area of user
interfaces
Computer graphics improved visual appeal between an old t
ext-based user interface and a modern windows-based user
interface
Modern user interfaces have made multitasking much easier
and applications such as word-processors have become muc
h more powerful
2019/2020 ACADEMIC YEAR
ENTERTAINMENT
The applications of computer graphics in entertainment fall i
nto three categories: computer art, special effects and anim
ations, and games
Computer-generated images (CGI) have been widely used f
or producing special effects for films, and also for producing
completely computer-generated films
For computer games, images must be generated in real-tim
e in response to user actions
Therefore the graphics in games can be less realistic, since t
he emphasis is on speed of generation rather than realism
2019/2020 ACADEMIC YEAR
WHAT’S OUR SCOPE?
Not a Tutorial on Commercial Software
3DMax, Maya, Photoshop, etc.
Not about Graphics Business
3D online-game, E-commerce, etc.
Graphics = Algorithm for Visual Simulation
Imaging, Modeling, Rendering, Animation
2019/2020 ACADEMIC YEAR
WHAT’S OUR SCOPE?
Imaging
Warping, Metamorphosis, Non-Photorealistic Rendering
Modeling
Surface Modeling, Solid Modeling, Procedure Modeling, Simplification
Rendering
Polygonal Rendering, Global Rendering, Texture Mapping
Animation
Keyframe Animation, Inverse Kinematics, Dynamics, Motion Capture
2019/2020 ACADEMIC YEAR
ALLIED GRAPHICAL INFORM
ATION FIELDS
Image Processing
Begins with images in the image space
Performs pixel-based operations on the images
Produce new image
User Interface
Computer graphics focus on image production
Field of user interface concerned on communicat
ion between man and machine
When this two are joined => Graphical User Inter
face
2019/2020 ACADEMIC YEAR
IMAGE REPRESENTATION
Image is composed of discrete pixel or picture elements
The pixels arranged in row and column to form a rectangula
r picture area(raster)
Image resolution: number of pixels per unit length
If we want resize a 1024X768 image to one
Total number of pixel: (w*r)*(h*r) that is 640 pixels wide with the same aspect
E.g. image:3X2 inches, Resolution 300 ratio, what would be the height of the resized
image?
Size given in pixels vertically and horizontally, easy but:
Difficult to tell the size in units
If we want to cut 512X512 sub-image out
Don’t specify image resolution from the center of an 800X600 image, what
Aspect Ratio: Width/height are the coordinates of the pixel in the large
Image pixel reference: e.g. 640X480 image that is at the lower left of the small
image? left
• lower left (0,0) , lower right (639, 0), upper Soln=[(800-512)/2,(600-
(0, 479) and upper right
(639, 479) 512)/2]=(144,44)
2019/2020 ACADEMIC YEAR
THE RGB COLOR MODEL
Color coordinate system with three primary colors:
R(red), G(green), and B(blue)
2019/2020 ACADEMIC YEAR
THE RGB COLOR MODEL
Color matching using the RGB model is additive
Closely matches with the working principles of display monitors
The CMY color model
Defines color using subtractive process
This closely matches with the working principles of printer
2019/2020 ACADEMIC YEAR
CONVERSION BETWEEN R
GB & CMY
E.g. find the CMY coordinates of a
color at (0.15, 0.3, 1) in the RGB
space
2019/2020 ACADEMIC YEAR
DIRECT CODING
Image representation is essentially the representation of pix
el colors
E.g. 3bits representation
Bit 1 R Bit 2 G Bit 3 B Color
0 0 0 Black
0 0 1 Blue
0 1 0 Green
0 1 1 Cyan
1 0 0 Red
1 0 1 Magenta
1 1 0 Yellow
1 1 1 White
2019/2020 ACADEMIC YEAR
DIRECT CODING
The widely accepted standard: 3byte/24bits
256 different intensity levels (00000000-11111111)
256*256*256 or 16.7M color choices per pixel
Simple way of representation but high demand for space
E.g. image 1000X1000 requires 3 million bytes
2019/2020 ACADEMIC YEAR
LOOKUP TABLE
Images pixel values don’t code colors directly
They hold addresses or indices into a table of color values
2019/2020 ACADEMIC YEAR
DISPLAY MONITOR
Convert digitally represented image into visually perceivable
pictures
Anatomy of monochromatic CRT
2019/2020 ACADEMIC YEAR
DISPLAY MONITOR
Fluorescence: the light given off by the phosphor during exp
osure to the electron beam
Phosphorescence: the continuing glow given off after the b
eam is removed
Phosphor’s persistence: the duration of phosphorescence
The intensity of the beam at a particular pixel position is det
ermined by the intensity value of the corresponding pixel in
the image being displayed
Frame buffer/Refresh buffer: a system memory area to stor
e the image to be displayed
Refreshing Rate: the frequency at which the content of the f
rame buffer is sent to the display monitor
60 frames per second (60Hz) or higher
Interlacing: half of the scan line are refreshed at a time
2019/2020 ACADEMIC YEAR
COLOR DISPLAY
Three electron guns instead of one, one for each primary col
or
The screen coat consist dot patterns of three different types
of phosphors
2019/2020 ACADEMIC YEAR
PRINTER
A printer deposit color pigments onto a printer media, chan
ging the light reflected from its surface and making it possib
le for us to see the print result
In principle utilize three types of pigments(cyan, magenta, a
nd yellow) to regulate the amount of red, green and blue lig
ht reflected to yield all RGB colors
In practice additional black pigment is often used due to the
relatively high cost of color pigments and technical difficulty
associated with producing high quality black from several co
lor pigments
Half toning
Dithering
2019/2020 ACADEMIC YEAR
IMAGE FILES
A digital image is often encoded in the form of a binary file
• Windows Bitmap (BMP)
• Joint Photographic Experts Group Format/version identification
File Interchange Format (JPEG) Image width and height in pixels
Header
• Tagged Image File Format (TIFF) Image type
Image data format
Organization of information Compression type
etc.
Encoded in an image file consists
largely of two parts: Color map (if any)
• Header Pixel values Image data
• Image data
Compression type Reconstruct the string
e.g. Run Length Encoding (RLE)
“uuuutttttpppppp” => “4u5t6p” that has been compressed
to “981435” using RLE 2019/2020 ACADEMIC YEAR
SETTING THE COLOR ATT
RIBUTES OF PIXELS
Three element array is often used to represent the three pri
mary color components
Two possible protocols for the specification of pixel coordin
ates and color values:
Protocol one: both coordinate and color information is give
n simultaneously
setPixel(x, y, rgb)
Where: rgb is three element array
rgb[0] = r
rgb[1] = g
rgb[2] = b
setPixel(x, y, i) => if the image uses lookup table
Where i is the address of the entry containing rgb
2019/2020 ACADEMIC YEAR
SETTING THE COLOR ATT
RIBUTES OF PIXELS
Protocol two: based on the existence of current color, maint
ained by the system
setColor(rgb)
setColor(i) => if the image uses lookup table
setPixel(x, y)
Lookup table entry
Set color: setEntry(i, rgb)
Read color: getEntry(I, rgb)
Additional pixel based image processing operations
getPixel(x,y, rgb)
getPixel(x,y, i)
2019/2020 ACADEMIC YEAR
SETTING THE COLOR ATT
RIBUTES OF PIXELS
Reading Assignment
Mandelbrot Set
Julia Set
Exercise - Write a pseudo-code segment to:
Initialize a 24-bit 256-entry lookup table with gray-scale values
Swap the red and green components of all colors in a 256 entry lookup ta
ble
Draw a rectangular area of wXh pixels that starts at (x, y) using color rgb
2019/2020 ACADEMIC YEAR