Chapter 2 - Digital Image Funtamental
Chapter 2 - Digital Image Funtamental
The light falls on the object, then the light reflects back after
striking the object and allowed to enter inside the camera.
Quantization:
converting each
sample gray-
level value into
discrete digital
quantity.
Now:
the digital scanned line AB
representation on computer:
Every pixel Is an
intersection ﺗﻘﺎطﻊ
between a row and a
column.
Binary Images
Binary images are images that have been
quantized to two values, usually denoted 0
and 1, but often with pixel values 0 and
255, representing black and white.
Binary Images
Grayscale Images -monochromatic
A grayscale (or graylevel) image is simply
one in which the only colors are shades of
gray (0 – 255)
Grayscale Images -monochromatic
Color Images - chromatic
Color image: A color image contains pixels
each of which holds three intensity values
corresponding to the red, green, and blue
or( RGB)
Color Images - chromatic
Index Image
Representing digital images
Q: Suppose a pixel has 1 bit, how many gray levels can it represent?
Answer: 2 intensity levels only, black and white.
1 Bit (0,1) 0:black , 1: white
Q: Suppose a pixel has 2 bit, how many gray levels can it represent?
Answer: 4 gray intensity levels
2 Bit (00, 01, 10 ,11).
Now ..
if we want to represent 256 intensities of grayscale, how many bits do we
need?
Answer: 8 bits which represents: 28=256
so, the gray intensities ( L ) that the pixel can hold, is calculated according
to according to number of bits it has (k).
L= 2k
2 intensities: 2 intensities:
256 intensities
Black(0) and white(1) Black(0) and
Size= 200×200×8 white(255)
size= 320,000 bit Size= 200×200×1 Size= 200×200×8
size= 40,000 bit size= 320,000 bit
Image Size
(200 × 200) 24-bit color image
Size= 200×200×8×3
Size= 960,000 bit
Number of storage of bits:
N * M: the no. of pixels in all the image.
K: no. of bits in each pixel
L: grayscale levels the pixel can represent
L= 2K
all bits in image= N*N*k
Number of storage of bits:
EX: Here: N=32, K=3, L = 23 =8
# of pixels=N*N = 1024 . (because in this example: M=N)
# of bits = N*N*K = 1024*3= 3072
08/07/2020 36
Spatial Resolution
Reducing Spatial Resolution
(subsampling)
The lower resolution images are smaller than the original
subSampling is performed by deleting rows and columns from the original image.
Spatial and gray-level resolution
Re sampling
(pixel replication)
A special case of nearest
neighbor zooming.
In this example,
all images has 452*374 pixels, but different #
of bits per pixel (as shown in yellow)
Remember that:
2 bits, L=4 1 bits, L=2
every pixel has # of bits k
And # of gray levels is L=2k
More pixels more resolution
More bit/pixel more accuracy
False Contouring
Effect of False Contouring – Under the low
intensity resolution it has an imperceptible set
of very fine ridge like structure in areas of
smooth gray levels ( particularly in the skull).
08/07/2020 61
Zooming (over sampling) images
Zooming requires 2 steps:
1. Stretch the original image to the size of the new scaled image
2. overlaid the stretched grid of the original image onto the new scaled
image.
3. For any point in the overlay, look for the closest pixel in the original
image, and assign its gray level to the new pixel in the grid. (copy)
? ? ? ?
50 100 ? ? ? ?
180 250 ? ? ? ?
? ? ? ?
original image
New scaled image
Nearest Neighbor Interpolation
? ? ? ? ? ? ? ?
50 100 50 100
50 100 ? ? ? ? ? ? ? ?
180 250 ? ? ? ? ? ? ? ?
180 250 180 250
original image ? ? ? ? ? ? ? ?
50 50 100 100
50 100
Next, for each point in 50 50 100 100
the scaled image, the
nearest point in the 180 180 250 250
texture is found. 180 250
180 180 250 250
Nearest Neighbor Interpolation
Pixel replication (re sampling) is a special case that is
applicable when the size of the image needs to be increased
an integer number of times (like 2 times not 1.5 for
example).
Example: if we want to enlarge the following image from
2×2 into 4×4
50 50 100 100
50 100
50 100 50 100 50 50 100 100
Duplicate Duplicate
rows Column 180 180 250 250
180 250 180 250
180 250 180 180 250 250
Shrinking
Similar to image zooming.
Shrinking an image an integer number of times
08/07/2020 71
Bilinear Interpolation
The closer point has more influence than the farther point.
Thus, the weights are normalized distances between the unknown
point and each of the end points.
Bilinear Interpolation
0.5 0.5
0.2
0.8
0.5 0.5
Bicubic Interpolation:
Involves 16 nearest neighbours of a point.
08/07/2020 74
PIXEL’S RELATIONSHIPS
Some basic relationships between pixels
Neighbors of a pixel
Relationships Between Pixels: Neighbors of a Pixel
08/07/2020 78
Neighbors of a pixel
Neighbors of a pixel
Neighbors of a pixel
Adjacency
Adjacent pixels:
0 0 0 0 0 They must be neighbors
and have gray value
0 1 1 1 0
from the same set V
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
3 types of adjacency
3 1 3 3 1 3 (q)
3 2 (q) 4 3 (p) 2 4
(p) 2 0 1 2 0 1
where
3 1 1 3
(q)
1 3 2 4
3 2 1 4
(p) 2 0 0 1
Digital Path
Let V = {2,3}, then there are many 8-paths between p and q
in the following image:
3 1 1 3 3
(q)
3 1 1
(q)
1 3 2 4 1 3 2 4
3 2 1 4 3 2 1 4
(p) 2 0 0 1 (p) 2 0 0 1
Digital Path
Let V = {2,3}, then there are one m-paths between p and q
in the following image:
3 1 1 3
(q)
1 3 2 4
3 2 1 4
(p) 2 0 0 1
Digital Path (Example)
Connectivity
S: a subset of pixels in an image.
1 1 0 0 1 1 0 0
1 1 0 0 1 1 0 0
0 0 1 1 0 0 1 1
0 0 1 1 0 0 1 1
1 1 0 0 1 1 0 0
4-adjacency: 3
connected components
4-adjacency: 4
connected components
Regions and Boundaries
R: a subset of pixels in an image.
R is a region of the image if R is a
connected set.
R1 U R2 U R3 U ….. U Rk = Foreground
D(p,q) = 0 iff p = q
D(p,q) = D(q,p)
D(p,z) ≤ D(p,q) + D(q,z)
Example :
Use the city block distance to prove 4-
neighbors ? 1 2 3
1
2 d
Pixel A : | 2-2| + |1-2| = 1 3
a p c
Pixel B: | 3-2|+|2-2|= 1
b
Pixel C: |2-2|+|2-3| =1
Pixel D: |1-2| + |2-2| = 1
1 3 1 1 3 D4 = | 1-4| +|2-4|
(q)
D4 = 3 + 2 = 5
2 1 3 2 4
D8 = max(| 1-4|,|2-4|)
3 3 2 1 4 D8 = max(3, 2) = 3
4 2 (p) 2 0 1
Euc = ((1-4)2 + (2-4)2)1/2
Euc = (32 +22 )1/2
Euc = (9 + 4)1/2
= 3.6
Example: Distance Measures