Image Fundamentals
Digital image
Image Matrix Image
3
Digital Image
• An image is a 2D array of pixels
o N pixels wide (columns)
o M pixels high (row)
• Each pixel is a small square on the screen
• For gray image, each pixel has intensity associated with it
(3rd Dimension)
• For color image each pixel has a color associated with it
• Image requires 3D representation (row, column and pixel
value)
• Digital image requires sampling and quantization of
Camera Image
4
Image Resolution
• Gives the degree of distinguishable details of image
• Depends on sampling and quantization
• Broadly classified into
(i) spatial resolution
• smallest discernible detail in an image
• depends on the number of pixels
(ii) gray-level resolution
• refers to the smallest discernible change in the
gray level of pixels
• depends on the number of gray levels
5
Image Sampling and Quantization
• Formation of digital image involves two
processes:
• sampling
• quantisation
• Digitizing coordinates is called sampling
• Digitizing the amplitude values is called
quantization
6
Image Sampling and Quantization
(a) Continuous image sampled in
coordinates
7
Image Sampling and Quantization
(a) Continuous image to be (b) Result of image sampling (14×12)
sampled in coordinates
Intensity is assumed to be constant within each pixel (quantization)
8
Intensity Resolution of Image (n-bit image)
▫ Also called Gray level Resolution
▫ Represents value of each pixel
Binary image (1-bit)
Monochrome images (8 bit grey scale)
Colour images (24 bit colour scale)
9
Binary Image (1bit/pixel)
• One bit to represent each pixel
• Pixel values are 0 or 255 (‘0’ or ‘1’ if normalized)
Image matrix (normalized)
• 11010
1 0 … 1
0 1 … 1
: : … :
1 1 … 1
A part of single row of image
10
Binary Image (1 bit/pixel)
• Example: width 800 pixels (columns)
height 600 pixels (rows)
• Size = 800*600 bits
= 60,000 bytes
11
Pixel Intensity of Grey Image
0
For 8-bit image,
128 intensity range is 0-255
255
Pixel brightness Pixel value
12
Digital Image and Image Matrix
0 255 0 0 255
0 255 0 0 255
0 255 0 0 255
0 255 0 0 255
0 255 0 0 255
Binary Image Image matrix
255 255 255 255 255
100 100 100 100 100
50 50 50 50 50
0 0 0 0 0
50 50 50 50 50
Grey Image Image matrix
13
Grey-scale 8-bit image
Image matrix (m×n)
10 0 … 86
22 33 … 75
: : … :
255 51 … 100
Intensity range is 0-255
14
Grey-scale image (8 bits/pixel)
binary decimal
0
255
256 shades of grey
15
Gray Image (8 bits/pixel)
• Example: width 800 pixels (columns)
height 600 pixels (rows)
• Size = 800×600×8 bits
= 480,000 bytes
16
Compare binary and grey image
Binary
grey
1 pixel = 8 bits 1 pixel = 1 bit
= 480,000 bytes = 60,000 bytes
17
Color Image Representation
• Each pixel is a combination of Red, Blue and Green color
• Each pixel is a combination of 3 colors (Red, Green, Blue)
• Therefore there are 3 values for each pixel
• Ex: at location (6,75), pixel value is (100, 20, 234)
(100, 20, 234)
= (R, G, B)
18
RGB Colours (Red Green Blue)
19
RGB Colours (Red Green Blue)
20
RGB Colours (Red Green Blue)
21
RGB Colours (Red Green Blue)
22
Color Image Representation
• Three planes (R, G and B) for each image
• Each plane uses 8 bits for each pixel
• Therefore each pixel is represented by 24 bits
23
Digital Color Image and Image Matrix
255 255 0 0 0
255 255 0 0 0
255 255 0 0 0
255 255 0 0 0 255 0 0 255 0
255 255 0 0 0 255 0 0 255 0
Red component 255 0 0 255 0
255 0 0 255 0
255 0 0 0 255
255 0 0 255 0
Image
255 0 0 0 255 Green component
255 0 0 0 255
255 0 0 0 255
255 0 0 0 255
Blue component
24
Size for grey (M x N) Image
• If k bits are is used to represent gray levels
• Then number of levels
L = 2k where k= 1 , 2, …, 24
• Number of bits required to store a digitised
image
=M×N×k
• It is a common practice to refer to the image as a
“k-bit image”
25
Change 8-bit Image to b-bit Image
• 8 bits have 256 values with the range, {0, 1, 2,…,255}
step size, S = 1 (=difference between 2 consecutive values)
• For 8-bit (256 values) to 1 bit (2 values),
256 values are converted to two values, {0, 255} ‘0’, ‘1’
S = 255/ (21-1) = 255
• For 8-bit (256 values) to 2 bits
256 values are converted to four values,
{0, 85, 170, 255} ’00’, ’01’, ’10’, ’11’
S = 255/ (22-1) = 85
• b bits have 2b values, {0, S, 2S, …, 255},
S = 255/(2b -1)
26
Ex: Change 8-bit Image to 3-bit Image
• Number of intensity levels in 8-bit image= 256 = 28
• Number of intensity levels in 3-bit image= 23
• S = 255/(23-1) = integer(255/7) =36
• New intensity values are
{0, 36, 72, 108, 144, 180, 216, 252(or 255)}
8-bit 0-18 19 -55 .. 182-218 219-255
Equiva 0 36 .. 200 252
lent
values
for 3-
bit
27
Change 8-bit Image to 3-bit Image
Intensity values of 3-bit image {0, 36, 72, 108, 144, 180, 216, 252}
8-bit 0-18 19 -55 … 182-218 219-255
3-bit 0 36 … 200 252
3-bit 000 001 … 110 111
binary
10 29 0 230 0 36 0 255
236 35 12 37 252 36 0 36
200 21 38 240 216 36 36 252
235 255 16 15 255 255 0 0
8-bit image 3-bit image
28
Various Grey Levels of monochrome images
1 bit/pixel
29
Various Grey Levels of monochrome images
1 bit/pixel 2 bits/pixel
30
Various Grey Levels of monochrome images
1 bit/pixel 2 bits/pixel 8 bits/pixel
31
Intensity Resolution (number of bits/pixel)
Good resolution
useful for reading
number plate
32
Intensity Resolution (number of bits/pixel)
Good resolution • Poor resolution
useful for reading • useful for counting
number plate number of cars
33
File Size for color image (800 x 600 )
• 1 pixel = 24 bits = 3 bytes
• Image requires 800×600×3= 1,440,000 bytes
• Therefore files for colour images are large
• Since 24 bits are used to represent each pixel
• 224 = 16 million colours are possible
• However, human eye can only perceive 10 million colors
• Therefore some levels can be avoided to compress image
34
Spatial Resolution (M x N)
8x8 image 32x32 image
35
Spatial Resolution (M x N)
8x8 image 32x32 image
36
Spatial Resolution (M x N)
8x8 image 32x32 image
37
Spatial Resolution (M x N)
8x8 image 32x32 image
64x64 image
38
Spatial Resolution
• Depends on the number of pixels in an image
• It depends on the rows and columns
• An image can be either down sampled to reduce
resolution or
• upsampled to increase resolution in spatial
domain
39
2 1 0 2 2 5
Down sampling 0 1 6 1 1 6
4 0 6 0 6 4
2 1 0 2 2 5 6 2 5 1 7 6
0 1 6 1 1 6 7 5 7 0 4 0
4 0 6 0 6 4 1 3 3 0 5 7
6 2 5 1 7 6 down sampled with sampling rate 2
7 5 7 0 4 0
1 3 3 0 5 7 2 0 2
4 6 6
Original Image Matrix
7 7 4
Down sampled Image Matrix
For color image, each plane is sampled
40
Up sampling 2 0 0 0 2 0
0 0 0 0 0 0
2 0 2 4 0 6 0 6 0
4 6 6 0 0 0 0 0 0
7 7 4 7 0 7 0 4 0
0 0 0 0 0 0
Original Image Matrix
To be up sampled with sampling rate 2
2 0 0 0 2 0
2 1 0 1 2 0
3 0 3 0 4 0
3 3 3 3 4 0
4 0 6 0 6 0
4 5 6 6 6 0
6 0 6 0 5 0
6 6 6 5 5 0
7 0 7 0 4 0
7 7 7 5 4 0
0 0 0 0 0 0
0 0 0 0 0 0
Up sampled Image Matrix using averaging
Method on columns Up sampled Image Matrix using averaging
Method on rows
41