ECE 468 / CS 519: Digital Image Processing Interpolation, Intensity Transforms
ECE 468 / CS 519: Digital Image Processing Interpolation, Intensity Transforms
[email protected]
Spatial Image Transformations
Affine transforms:
• Translation
• Scaling
• Rotation
• Shear
Example
(x , y ) = T {(x, y)}
⇥ ⇥
x x
⇤ y ⌅=T⇤ y ⌅ homogeneous
coordinates
1 1
2D Translation
⇥
x
=
y displacement
⇥
tx
t=
ty homogeneous
coordinates
⇤ ⌅
⇥ ⇥ x
x + tx 1 0 tx ⇧
P =P +t= = y ⌃
y + ty 0 1 ty
1
⇥ ⇥ ⇥
x + tx 1 0 tx x
P ⇤ y + ty ⌅ = ⇤ 0 1 ty ⌅⇤ y ⌅
1 0 0 1 1
⇤
⇥
translation matrix
source: S. Savarese
2D Scaling
⇥
sx x
=
sy y
⇥
x
=
y
⇥ S ⇥ ⇥
sx x sx 0 0 x
⇧ ⌃ ⇧ ⌃⇧ ⌃
⇤ sy y ⌅ = ⇤ 0 sy 0 ⌅⇤ y ⌅
1 0 0 1 1
⇤
⇥
P =S·P
P = (T · S) · P
P =T ·P
⇥ ⇥ ⇥ ⇥
x 1 0 tx sx 0 0 x
⇧ ⌃ ⇧ ⌃⇧ ⌃⇧ ⌃
⇤ y ⌅ = ⇤ 0 1 ty ⌅ ⇤ 0 sy 0 ⌅⇤ y ⌅
1 0 0 1 0 0 1 1
⇥
sx 0 tx
⇧ ⌃ scaling + translation
A=⇤ 0 sy ty ⌅ matrix
0 0 1 source: S. Savarese
2D Rotation
counter-clockwise
by angle ⇥
cos x sin y
P =
y sin x + cos y
⇥
y x
P =
y
x x
⇥ R ⇥ ⇥
x cos sin 0 x
⇧ ⌃ ⇧ ⌃⇧ ⌃
⇤ y ⌅ = ⇤ sin cos 0 ⌅⇤ y ⌅
1 0 0 1 1
⇤
⇥
rotation matrix
source: S. Savarese
Complex: First Scaling, Then Rotation, Finally Translation
t R S
⇤
⇥
⇤
⇥
⇤
⇥
⇤ ⌅ ⇤ ⌅
x ⇥ x
⌥ RS t ⌥
⇧ y ⌃= ⇧ y ⌃
0 1
1 1
Estimating the Spatial Transform
transformed
input
input
inverse estimation
transform error
MATLAB Example
>>imshow(img_out)
Image Interpolation
f (x, y) = ax + by + cxy + d
f (x, y) = ax + by + cxy + d
?
Bilinear Interpolation
f (x, y) = ax + by + cxy + d
nearest neighbor
Bilinear Interpolation
f (x, y) = ax + by + cxy + d
?
Bilinear Interpolation
f (x, y) = ax + by + cxy + d
nearest neighbor
Bilinear Interpolation
f (x, y) = ax + by + cxy + d
?
4 3
nearest neighbor
Bilinear Interpolation
f (x, y) = ax + by + cxy + d
a, b, c, d
Example: Zooming-in
• Bilinear N = 1
• Bicubic N = 3
N N
f (x, y) = i j
aij x y
i=0 j=0
transformed input
input
Example: Shading Correction
input output
Image Negatives
g(x, y) = L 1 f (x, y)
Contrast Stretching
input
output thresholded
Gamma Correction
s = cr
Example: Gamma Correction