You are on page 1of 33

Digital Image Processing

DIP

Digital Image Fundamentals and


Image Acquisition
Image Acquisition
Image Description
f (x,y): intensity/brightness of the image at spatial coordinates
(x,y)

0< f (x,y)<∞ and determined by 2 factors:


illumination component i(x,y): amount of source light
incident
reflectance component r(x,y): amount of light reflected by
objects

f (x,y) = i(x,y)r(x,y)
Where 0< i(x,y)<∞: determined by the light source
0< r(x,y)<1: determined by the characteristics of objects
Sampling and Quantization
Sampling and Quantization

Sampling: Digitization of the spatial coordinates (x,y)


Quantization: Digitization in amplitude (also called gray-
level quantization)

8 bit quantization: 28 =256 gray levels (0: black, 255: white)


Binary (1 bit quantization):2 gray levels (0: black, 1: white)

Commonly used number of samples (resolution)


Digital still cameras: 640x480, 1024x1024, up to 4064 x 2704
Digital video cameras: 640x480 at 30 frames/second 1920x1080
at
60 f/s
Sampling and Quantization
Digital image is expressed as
Sampling
Effect of Sampling and Quantization
RGB (color) Images
Image Acquisition
Image Acquisition
Image Acquisition
Basic Relationships between Pixels
Neighbors of a pixel -Connectivity

A pixel p at coordinate (x, y) has neighbors as:

N4(p) : 4-neighbors of p

ND(p) : 4-diagonal neighbors of p

N8(p) : 8-neighbors of p :
Is a combination of N4(p) and ND(p)
R=M
N C=N

Boundary Pixels
R=M
Regions N C=N

M
R=M
N C=N

S2
M

S1 (x-1, y)

(x,y-1) (x, y) (x,y+1) N4(p)


(x+1,
y)
R=M
N C=N

S2
M

S1 (x-1,y-1) (x-1, y) (x-1,y+1)


ND(p)
(x,y-1) (x, y) (x,y+1)

(x+1,
(x+1, y) (x+1, y+1)
y+1) N8(p)
ADJACENCY

A pixel p is adjacent to a pixel q if they are connected.


Two image area subsets S1 and S2 are adjacent if some pixel in
S1 is adjacent to some pixel S2.

• Let V be the set of gray-level values used to define


adjacency.
• 4-adjacent:
• Two pixels p and q with values from V are 4-adjacent if q is in the set N4(p)
• 8-adjacent :
• Two pixels p and q with values from V are 8-adjacent if q is in the set N8(p)
ADJACENCY
• m-adjacent (mixed adjacency):
• Two pixels p and q with values from V are m-adjacent if

(a) q is in N4(p), or

(b) q is in ND(p) and the set N4(p) П N4(q) has no pixels whose values are from V.
R=M
N C=N

S2
M
Are S1 and S2 adjacent over V = {1}
using N4(p) connectivity?

S1 (x-1, y)

(x,y-1) (x, y) (x,y+1) N4(p)


(x+1,
y)
Basic Relationships between Pixels
Basic Relationships between Pixels
Path from pixel ‘p’ to ‘q’
We can define 4-path,8-path, or m-path from pixel p with
coordinates (x, y) to pixel q with coordinates (s, t) depending on
type of adjacency specified.
A digital path (or curve) from pixel p to q is a sequence of
distinct pixels with coordinates:
(x0, y0), (x1, y1),…(xn, yn)
where (xi, yi) and (xi-1,yi-1) are adjacent for 1 <= i <= n,
and n is the length of the path.

If (x0,y0) = (xn, yn) p(x, y)


q(s, t)
Then the path is closed path.
Distance Measures

For pixel p, q and z with coordinates (x, y), (s, t) and (v,
w) respectively
D is a distance function or metric if

(a) D(p, q) ≥ 0 ; (D(p, q) = 0 iff p=q) q(s, t)


(b) D(p, q) = D(q, p), and
(c) D(p, z) ≤ D(p, q) + D(q, z)
D(p, q)

p(x, y)
EUCLIDEAN DISTANCE

The Euclidean distance is the straight-line distance


between p(x,y) and q(s,t).

D(p, q)=
City-block distance: D4 distance
The path between the pixels based on a 4-connected
neighbors. Pixels whose edges touch are 1 unit apart;
pixel diagonally touching are 2 units apart.
D4(p,q) = |x – s| + |y – t |
Diamond centered at (x, y) D4 =1 are 4-neighbors of (x,
y)
Chessboard distance: D8 Distance
The path between the pixels based on an 8-neighborhood.
Pixels whose edges or corners touch are 1 unit apart.
Square centered at (x, y)
D8 (p, q) = Max (|x – s|, |y – t |)
Arithmetic Operations

Used extensively in most branches of image processing.


Arithmetic operations b/w two pixels p and q :
Addition : p + q used in image average to reduce noise.
Subtraction : p - q basic tool in medical imaging.
Multiplication : p x q
To correct gray-level shading result from non-uniformities in
illumination or in the sensor used to acquire the image.
Division : p ÷ q
In Arithmetic Operations, entire images are carried out
pixel by pixel
Distance measures
• For pixel p, q and z with coordinates (x,
y), (s, t) and (u, v) respectively
• D is a distance function or metric if q(s, t)

D(p, q)
(a) D(p, q) ≥ 0 ; D(p, q) = 0 iff p=q
(b) D(p, q) = D(q, p) p(x, y)
(c) D(p, z) ≤ D(p, q) + D(q,z)

18
City-block distance:
D4 distance
• D4(p,q) = |x – s| + |y – t |
• Diamond centered at (x, y) D4 =1 are
4- neighbors of (x, y)

20
Chessboard distance:
D8 Distance
D8 (p, q) = max |x – s|, |y – t |
Square centered at (x, y)

21

You might also like