0% found this document useful (0 votes)
12 views45 pages

Chapter 4 - Image and Graphis Data Presentation

The document discusses the representation of image data, focusing on pixels, pixmaps, image dimensions, and resolutions. It explains how resolution affects image quality and storage requirements, as well as the differences between various types of digital images, such as binary, grayscale, and color images. Additionally, it covers techniques like dithering and color quantization to manage color depth and improve image quality in different contexts.

Uploaded by

Resika Umayantha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views45 pages

Chapter 4 - Image and Graphis Data Presentation

The document discusses the representation of image data, focusing on pixels, pixmaps, image dimensions, and resolutions. It explains how resolution affects image quality and storage requirements, as well as the differences between various types of digital images, such as binary, grayscale, and color images. Additionally, it covers techniques like dithering and color quantization to manage color depth and improve image quality in different contexts.

Uploaded by

Resika Umayantha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Graphics and

Image Data
Representations
Chapter 4
Image Data
Representation
 Image is a digital representation
of a scene.
 Pixels:
 Digital images are
composed of pixels (picture
elements).
 Each pixel represents the
color at a single point in the
image
 Pixmaps:
 A digital image is a
rectangular array of pixels
sometimes called a pixmap
Image dimension and image resolution

 Image size/dimension: measures the


number of pixels along an image’s
width and height. (e.g. 600x400 pixels)
 Resolution is often considered
equivalent to pixel count, though it
refers to pixel density (fineness of
detail)
 Pixel density in a bitmap image is
measured in pixels per inch (ppi).
 The more pixels per inch, the
greater the resolution
 The higher the resolution, the more
information the image contains
Image dimension and image resolution
 Increasing resolution → pixel density increases → increases the pixel
dimensions → improves the detail

A circle at a resolution of A finer circle at a resolution


10 pixels/inch of 20 pixels/inch
5 Image resolution
 Low resolution image - will appear ‘pixelated’, blurry and unfocussed.
 Very high resolution - needs larger storage space, and are slower to load on websites.

Needs 25 bytes Needs 100x100 bytes

Assumption: each pixel needs 1 byte to store


Exercise

1. A typical uncompressed bitmap image has resolution 1600X900 pixels. Each


pixel is 24-bit depth. What is the size of the bitmap in bytes?

2.
7 Resolution (camera)
 A selling point of digital cameras is the number of pixels it can capture. A 16 Mega Pixel (MP) camera
can capture images that are 4920 pixels wide x 3264 pixels hight.
 A 5MP camera can take larger image than a 3MP camera
Monitor Resolution
 How large an image appears on screen depends on a combination
of factors – the pixel dimensions of the image, the monitor
resolution setting, and the monitor size.

The same image displayed on monitors of various resolutions


(640x480, 832x624, 1024x768)

8
Screen/Monitor Resolution
9

Image size = 1458x401


• If your monitor is set to 1920x1080 and you open up an image that
is 1458x401, it will only fill up a part of your screen.
• If you open the same image on a 800x600 resolution monitor you
will find yourself moving the slider bar around to see all the
different parts of the image. It just won't fit.
Screen/Monitor Resolution

 Some 17" monitors has a resolution of 1280 X 1024.


 But, some 7.9" mini iPad Retina has a resolution of 2048 X 1536.
 Even though the iPad is smaller in size, the resolution is higher, so you can see
more content on the iPad than on the monitor even though its bigger in size
 However, the contents will be small. So if you are far away you cant see the
details of the contents.

10
Printer Resolution
• Printer resolution is measured in dots per inch, also known as
dpi.
• Generally, the more dpi, the finer the printed output you’ll
get.
• Printer resolution is different from, but related to image
resolution.
• To print a high quality photo on an inkjet printer, an image
resolution of at least 200 dpi should provide good results.

11
Printer Resolution
12

The more dpi, the finer the printed output you’ll get
Print size versus resolution
Assume that you have an image of 640 x 480 dimension. How
big a print you can make?
• You can make as big a print as you want but very quickly
you will start to see "blocks" (pixelization) and the quality will
drop off.
• You have a 640 x 480 image and you want to print it at 200
dpi.
640 480
• = 3.2, = 2.4
200 200
• So print size = 3.2" x 2.4" (when you use 200 dpi).
Exercise: If you want to print a 8 X 10" picture at 300 dpi
what would be the image dimension you will prefer?
(8x300) x (10x300) = 2400x3000 pixels

13
14 Print size versus resolution
Types of digital images
15
 Binary images (1-bit images / monochrome images)
 Grey level (grey scale) images
 Color images
Binary (1-bit/ monochrome) images
16
• Each pixel is stored as a single bit (0 or 1), so also referred to as
binary image.
• Such an image is also called a 1-bit monochrome image since it
contains no color.
• Each pixel requires 1 bits to store. Hence, saving an image of size
10x10 pixels require 100 bits
Gray-level (8-bit) Images
17
• Each pixel has a gray-value between 0 and 255.
• Each pixel is represented by a single byte
• The value of black pixel is 0, and
• The value of white pixel is 255
• In between we have the gray-level values

Bitmap: The two-dimensional array of pixel values that represents


the graphics/image data.
In gray-scale images each pixel is usually stored as a byte (a value
between 0 to 255), so a 640 x 480 grayscale image requires 300kB of
storage (640 x 480 = 307, 200).
24-bit Color images
18
In a 24-bit color image, each pixel is represented by three bytes, usually
representing RGB.

 First byte represents R, second byte represents G, and the last byte
represents B values

 This format supports 256 x 256 x 256 possible combined colors, or a total
of 16,777,216 possible colors.

 However such flexibility does result in a storage penalty: A 640 x 480 24-bit
color image would require 921.6 kB of storage without any compression.
24-bit Color images
19
Color quantization
20
• If space is concern (and it almost always is), reasonably accurate
color images can be obtained by quantizing the color information.
• Color quantization - is a process that reduces the number of distinct
colors used in an image, usually with the intention that the new
image should be as visually similar as possible to the original image.
• It makes sense to carefully choose just which colors to represent
best in the image: if an image is mostly red sunset, it’s reasonable to
represent red with precision and store only a few greens.
256 colors (8 bits)
Quantization 0 255

4 colors (2 bits)

0 1 2 3
Color quantization
21

Original color
image, 8 bits for
each color
Color Lookup Table
22
• Such image files use the concept of a lookup table to store color
information.
• Basically, the image stores not color, but instead just a set of bytes,
each of which is actually an index into a table with 3-byte values that
specify the color for a pixel with that lookup table index.
Color Lookup Table - animation
23
• A simple animation process is possible via simply changing the
color table: This is called color cycling or palette animation.
• Since updates from the color table are fast, this can result in a
simple, pleasing effect.
How to devise a Color Lookup Table
24
Median-cut algorithm: A simple alternate solution that does a better
job for this color reduction problem – It is an image-based, color-
quantization algorithm that gives good results for many images.

Idea: Each of the colors in the palette should represent an approximately


equal number of pixels in the original image.
Median-cut algorithm (reduce to 2 colors)
25

100 25 25 Quantizing to 1 0 0
2-levels (1-bit)
90 85 45 1 1 1

20 10 5 0 0 0

𝐼𝑖
𝐼𝑖′

5, 10, 20, 25, 25, 45, 85, 90, 100


0, 𝐼𝑖 < 25
𝐼𝑖′ = ቊ
1, 𝐼𝑖 ≥ 25
Median = 25
Median-cut algorithm (reduce to 4 colors)
26
5,5,5,10,10,10,10,15,15,15,20,25,25,30,40,50
10 15 10 15

50 40 30 25

20 15 10 5 5,5,5,10,10,10,10 15,15,15,20,25,25,30,40,50

5 5 10 25
5,5,5 10,10,10,10 15,15,15,20 25,25,30,40,50

1 2 1 2
0, 10 < 𝐼𝑖
1, 10 ≥ 𝐼𝑖 > 15 3 3 3 3
𝐼𝑖′ =
2, 15 ≥ 𝐼𝑖 > 25
2 2 1 0
3, 25 ≤ 𝐼𝑖
0 0 1 3
27 Dithering

Thresholding

Dithering Random
Technoques Dithering

Ordered
dithering
Dithering
28

How to print a gray scale image using a


1-bit printer?
29 Dithering
 The central problem when printing/displaying is color depth of the output device.
 How to achieve the illusion of large color depth (e.g. 8 bits = 256 intensity values) using
output devices (e.g. printer or monitor) of low color depth (e.g. 1-bit = 2 intensity values)?

• Dithering is the process to approximate a color from a


mixture of other colors when the required color is not
available.
• E.g. producing different shades of gray levels using black and
white pixels.
What is Dithering?
30
• Dithering is based on the fact that the eye will perceive a
grouping of small areas of different colors as a blend of those
colors.
For example,
• Different shades of gray can be produced from different
patterns of closely spaced black and white pixels.
• Combination of red and yellow pixels can produce orange, and
so on.

• This technique is also often used in color printing.


An illustration of dithering. Red and
blue are the only colors used but, as
the red and blue squares are made
smaller, the patch appears purple.
Thresholding
31
 A dithering technique, generates a binary image from a gray
scale image.
 A point processing technique, result depends on the threshold
 The pixels in the source image darker than the threshold value
are replaced with black and those lighter than it with white.

Original image T=128 T = 170 T = 50


Random dither
32
 As the name implies, chooses the threshold value at random
from a uniform distribution of values in the dynamic range of the
source.
 Algorithm:
 Generate a random (0-255) number for each pixel
 Replace that pixel by white, if the random number is greater than the value of the
pixel, otherwise replace it with black

 Crude and “noisy”, Almost never used

Original image Thresholded Random Dither


33 Ordered Dither
Dithering Matrices
• A dither matrix is a rectangular pattern of threshold values that
seeks to produce optimal output for a local region of the source.
• When dithering a WxH source image with a NxN dither matrix, the
dithering matrix is generally much smaller than the source and is
therefore repetitively tiled to generate threshold values for every
source sample.
• Dither matrices are generally square and must be scaled to the
color depth of the source.
Ordered Dither
34
• By sliding the dithering matrix over the image (n pixels in the
horizontal and vertical direction at a time) each pixel has a
corresponding entry in the dithering matrix.
• A pixel with intensity level higher than the corresponding
dithering matrix entry is mapped to a white pixel and
otherwise a black pixel.

• Result of the ordered dithering depends on the size of the


dithering matrix, generally larger matrices give better results
0 128

192 64
35 Dither Matrix Example

033 128
45 88 123 200 210 222 255 255 0
45
192 51
64 93 113 173 221 233 240 0 0
12 61 87 120 188 200 235 254
3 43 73 152 193 199 221 223
0 23 55 135 199 200 210 201
0 10 21 110 183 173 198 177
0 3 2 32 18 98 100 123
0 0 0 1 12 33 73 110

Position the dither matrix at the upper-left and compute the


outputs using matrix entries as threshold values.
36 Dither Matrix Example

33 45 0
88 128 200
123 210 222 255 255 0 255 0
45 51 93
192 113
64 173 221 233 240 0 0 0 255
12 61 87 120 188 200 235 254
3 43 73 152 193 199 221 223
0 23 55 135 199 200 210 201
0 10 21 110 183 173 198 177
0 3 2 32 18 98 100 123
0 0 0 1 12 33 73 110

Move the matrix and repeat.


37 Dither Matrix Example

33 45 88 123 0
200 128
210 222 255 255 0 255 0 255 255
45 51 93 113 192
173 221
64 233 240 0 0 0 255 0 255
12 61 87 120 188 200 235 254
3 43 73 152 193 199 221 223
0 23 55 135 199 200 210 201
0 10 21 110 183 173 198 177
0 3 2 32 18 98 100 123
0 0 0 1 12 33 73 110

Move the matrix and repeat.


38 Image file formats

 BMP
 GIF
 JPEG
 PNG

We will study very simplified formats


39 Bitmap (BMP) image format

 It is capable of storing two-dimensional digital images both


monochrome and color, in various color depths, and optionally
with data compression, and alpha channels.
 Typically, BMP files are uncompressed, and therefore large and
lossless; their advantage is their simple structure.
Graphical Interchange (GIF) image format
40
 The format includes some key features which make it a unique and valuable
format for the internet. These features include limited number of colors,
compression, interlacing and storage of multiple images within a single file
which allows for a primitive form of animation.

 Due to GIF's simplicity it is widely used to provide image animation effects,


despite its low compression ratio compared to modern video formats.

 Limited number of colors and compression


 GIF is in normal use limited to an 8-bit palette, or 256 colors.
 Hence, it is most suitable for storing graphics with few colors, such as
simple diagrams, shapes, logos, and cartoon style images,
 It uses LZW lossless compression, which is more effective when large
areas have a single color, and less effective for photographic images.
Graphical Interchange (GIF) image format
41
Interlacing
Interlacing is a web-specific feature of GIF. It is a mechanism that makes images appear
faster on-screen by first displaying a low-resolution version of the image and gradually
showing the full version.
 The first pass displays pixel rows 1, 9, 17, etc. (every eighth row)
 The second pass displays rows 5, 13, 21, etc. (every remaining fourth row)
 The third pass displays rows 3, 7, 11, 15, etc. (every remaining odd row)
 The last pass displays rows 2, 4, 6, etc. (all the even-numbered rows).
Graphical Interchange (GIF) image format
42
Animation
GIF allows displaying multiple images in a timed and/or looped sequence
to make small animations.
JPEG image format
43
• JPEG (Joint Photographic Experts Group): The most important current
standard for image compression (.jpg, .jpeg).
• The human vision system has some specific limitations (The eye-brain
system cannot see extremely fine detail; those are dropped) and JPEG
takes advantage of these to achieve high rates of compression.
• It is commonly used by digital cameras to store photos since it supports
224 or 16,777,216 colors.
• The JPEG compression algorithm may reduce the file size of a bitmap
(BMP) image by ten times with almost no degradation in quality, but it
uses a lossy compression algorithm.
• The format also supports varying levels of compression, which makes
it ideal for web graphics.
• Disadvantage: the lossy compression can cause an issue called
"artifacting," in which parts of the image become noticeably blocky.
44 PNG image format

• PNG – Portable Network Graphics


• It uses a lossless compression algorithm.
• Special features of PNG files include:
• Support for up to 48 bits of color information – 281 Trillian colors.
• Files may contain gamma-correction information for correct display
of color images, as well as alpha-channel information for such uses
as control of transparency.
• The display progressively displays pixels in a 2-dimensional fashion
by showing a few pixels at a time over seven passes through each
8 X 8 block of an image.
45

You might also like