Lecture 2
Lecture 2
Original
72dpi
1250dpi
150dpi
Image Interpolation – Nearest Neighbor
Assign each pixel in the output image with the nearest neighbor in the input image.
X
p
and
Connectivity
• Closed path: if the starting point is the same as the ending point
• p and q are connected: if there is a path from p to q in S
• Connected component: all the pixels in S connected to p
• Connected set: S has only one connected component
Are they connected sets?
(a) D( p, q) 0
(b) D( p, q) 0 if p q
(c) D( p, q) D(q, p)
(d) D( p, z) D( p, q) D(q, z)
Distance Measures
Euclidean distance De ( p, q) (x s) 2 ( y t) 2
D4 distance p
6
D8 distance
5 q
Euclidean distance
𝟏 + 𝟓𝟐
Array/Matrix operations
Linearity:
Arithmetic Operations – single pixel operations
• Image averaging, image subtraction, image multiplication
Set and logic operations
Spatial operations
• Single pixel operations and neighborhood operations
Image transformation
Mathematic Tools
Array Multiplications
𝒂𝟏𝟏 𝒂𝟏𝟐 ∙ 𝒃𝟏𝟏 𝒃𝟏𝟐
=
𝒂𝟏𝟏𝒃𝟏𝟏 𝒂𝟏𝟐𝒃𝟏𝟐
𝒂𝟐𝟏 𝒂𝟐𝟐 𝒃𝟐𝟏 𝒃𝟐𝟐 𝒂𝟐𝟏𝒃𝟐𝟏 𝒂𝟐𝟐𝒃𝟐𝟐
Matrix Multiplications
• Determined by
• Transformation function T
• Input intensity value
• Not depend on other pixels and position
Neighborhood Operations
Image smoothing
g(x, y)
1
f (r, c)
mn (r,c)S xy
Other examples:
•Interpolation
•Image filtering
Geometric Spatial Transformations
L1
nk
p(z k )
MN
, p(z
k 1
k ) 1
Probability Methods
Spatial Domain
g(x,y)=T [f(x,y)]
spatial filter
Contrast stretch
• Piecewise-linear transformation
• Histogram processing
Some Basic Intensity Transformation
Functions
original
https://janithabandara.medium.com/image-compression-using-bit-plane-
slicing-opencvsharp-without-pre-defined-functions-608a61d252b7
Histogram Processing
Histogram
h(rk ) nk
Normalized histogram
p(rk ) nk / MN
255
p(r ) 1
k
k 0