Lecture - 2
Lecture - 2
Lecture – 2
Raster Graphics
11
Outline
● Raster and Raster Images
● Image Compression
● Display Devices
● Pixel Values
● RGB Color
● Alpha Compositing
22
Raster (1/1)
• Most computer graphics
images are presented on
raster display.
• i.e. television
– has rectangular array of small
light-emitting pixels
• individually set to different colors
to create desired image.
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
Image source: https://commons.wikimedia.org/wiki/File:Bresenham_line.png
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
Image source: https://desktop.arcgis.com/en/arcmap/10.3/manage-data/raster-and-images/what-is-raster-data.htm
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
Image source: https://desktop.arcgis.com/en/arcmap/10.3/manage-data/raster-and-images/what-is-raster-data.htm
6
Image Compression (2/4)
Lossless Compression
● Don’t impact the image quality
● Only removes additional, non-essential data
automatically added by the device used to take the
photo
● No significant reduction in file size
● Lossless Compression algorithms: Run-length
encoding, Huffman coding
● Lossless formats are .RAW, .BMP, .GIF, and .PNG
Credit: Lossy vs Lossless Compression: Differences & Advantages | Adobe
7
How Run-Length Encoding (RLE) Works
Credit: https://www.youtube.com/watch?v=cAAeSn8_aCU&ab_channel=MizComputing
Image Compression (3/4)
Lossy Compression
● Reduces the file size considerably by removing
image data
● Quality might degrade
● This process is irreversible - can’t get back to the
original file
● Common algorithms - discrete wavelet transform,
fractal compression, transform encryption etc.
● Lossy format; JPEG, MPEG, AVC
Credit: Lossy vs Lossless Compression: Differences & Advantages | Adobe
8
Image Compression (4/4)
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
10
Emissive Displays (1/2)
• Emissive Displays:
• Example: light-emitting diode (LED)
– Each pixel is composed of one or more LEDs
(semiconductor devices)
• emit light with intensity ↔ electrical current passing through them
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
11
Emissive Displays (2/2)
• Sub-pixel:
―Pixels divided into three
independently controlled sub-
pixels (R, G, B)
• each with own LED
(different materials)
• emit light of different colors
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
12
Transmissive Displays (1/3)
• Transmissive Displays:
• Example: light
crystal display (LCD)
– Molecular structure of
liquid crystal rotates the
polarization of light that
passes through it
– LCDs also have sub-pixels.
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
13
Transmissive Displays (2/3)
• Degree of rotation ↔ applied voltage
OFF state
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
14
Transmissive Displays (2/3)
• Degree of rotation ↔ applied voltage
ON state
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
15
Transmissive Displays (3/3)
youtu.be/k7xGQKpQAWw?t=77
16
Pixel Values (1/1)
• Coordinate system for raster screen:
– Convention:
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
17
RGB Color (1/1)
black = (0, 0, 0), red = (1, 0, 0), green = (0, 1, 0),
blue = (0, 0, 1), yellow = (1, 1, 0), magenta = (1, 0, 1),
cyan = (0, 1, 1), white = (1, 1, 1)
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
18
Alpha Compositing (1/3)
• Partially overwriting the contents of a pixel.
– Where we have a background and want to insert a
foreground image over it.
• Transparent
• Opaque (not transparent)
• Partially Transparent
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
Image source: http://www.graphicalweb.org/2005/papers/abstractsvgopen/index.html
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
Image source: http://www.graphicalweb.org/2005/papers/abstractsvgopen/index.html
20
Alpha Compositing (3/3)
• Alpha Mask:
- The α values for all the pixels is stored in a
separate gray scale image.
Credit: Fundamentals of Computer Graphics 3rd Edition by Peter Shirley, Steve Marschner | http://www.cs.cornell.edu/courses/cs4620/2019fa/
21
What can you do with it? Get a photo with Einstein
Source: http://graphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures/blending.pdf 22
What can you do with it? Horror Photo!!
Source: http://graphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures/blending.pdf 23
Practice Question 1
• Given that, Cf = 1.0, Cb = 0.5 and C = 0.8, where,
Cf , Cb and C are the foreground, background and
composite intensities respectively. Determine
the alpha(α) value to perform alpha compositing.
24
Practice Question 2
Consider an image with resolution of 1500 x 1500. Each pixel in the
image can hold up to 8 bit of data.
a) What is the file size of the image in MB?
b) If the image is compressed with a compression ration of 1.5.
What is the file size of the compressed image?
25
Practice Question 2
Consider an image with resolution of 1500 x 1500. Each pixel in the
image can hold up to 8 bit of data.
a) What is the file size of the image in MB?
Solution:
Total number of pixels in the image = 1500 x 1500 = 2250000
Each pixel can hold 8 bit data.
So, the size of the original image = 2250000 x 8 = 1800,0000 bits
= 18000,000 / 8 = bytes = 2250000 bytes = ?? MB
26
Practice Question 2
Consider an image with resolution of 1500 x 1500. Each pixel in the
image can hold up to 8 bit of data.
27
Further Reading
● Fundamentals of Computer Graphics, 4th Edition -
Chapter 3
● https://www.adobe.com/uk/creativecloud/photograp
hy/discover/lossy-vs-lossless.html
28
Thank You
29