Image Interpolation
Image Interpolation
Interpolation Applications
Introduction
What is image interpolation?
An image f(x,y) tells us the intensity values at the integral lattice locations, i.e., when x and y are both integers Image interpolation refers to the guess of intensity values at missing locations, i.e., x and y can be arbitrary Note that it is just a guess (Note that all sensors have finite sampling distance)
EE465: Introduction to Digital Image Processing 2
A Sentimental Comment
Havent we just learned from discrete sampling (A-D conversion)? Yes, image interpolation is about D-A conversion Recall the gap between biological vision and artificial vision systems
Digital: camera + computer Analog: retina + brain
EE465: Introduction to Digital Image Processing 3
Engineering Motivations
Why do we need image interpolation?
We want BIG images
When we see a video clip on a PC, we like to see it in the full screen mode
Low-Res. High-Res.
Non-damaged
Damaged
6
Image Interpolation
Introduction Interpolation Techniques
What is image interpolation? Why do we need it? 1D linear interpolation (elementary algebra) 2D = 2 sequential 1D (divide-and-conquer) Directional(adaptive) interpolation* Digital zooming (resolution enhancement) Image inpainting (error concealment) Geometric transformations
EE465: Introduction to Digital Image Processing 8
Interpolation Applications
1D Zero-order (Replication)
f(n) n
f(x) x
f(x) x
10
1-a
f(n+a)=(1-a) f(n)+a f(n+1), 0<a<1 Note: when a=0.5, we simply have the average of two
11
Numerical Examples
f(n)=[0,120,180,120,0] Interpolate at 1/2-pixel f(x)=[0,60,120,150,180,150,120,60,0], x=n/2 Interpolate at 1/3-pixel f(x)=[0,20,40,60,80,100,120,130,140,150,160,170,180,], x=n/6
12
From 1D to 2D
Engineers wisdom: divide and conquer 2D interpolation can be decomposed into two sequential 1D interpolations. The ordering does not matter (row-column = column-row) Such separable implementation is not optimal but enjoys low computational complexity If you dont know how to solve a problem, there must be a related but easier problem you know how to solve. See if you can reduce the problem to the easier one. - rephrased from G. Polyas How to Solve It
EE465: Introduction to Digital Image Processing 14
row
column
f(m,n)
g(m,n)
15
Numerical Examples
a c b d first-order
zero-order a a c c a a c c b b d d b b d d
a (a+c)/2 c
16
Bicubic Interpolation*
http://en.wikipedia.org/wiki/Bicubic_interpolation
EE465: Introduction to Digital Image Processing 18
Z X X
EE465: Introduction to Digital Image Processing
Z
19
Edge-Sensitive Interpolation
Step 1: interpolate the missing pixels along the diagonal a x c d b Since |a-c|=|b-d| x has equal probability of being black or white
black or white?
Step 2: interpolate the other half missing pixels a d c Please refer to esi1.m and esi2.m in interp.zip
EE465: Introduction to Digital Image Processing 20
1 0 2
2
2
1 0 4
Geometric Duality
Step-I
Step-II
23
Image Interpolation
Introduction Interpolation Techniques
1D zero-order, first-order, third-order 2D zero-order, first-order, third-order Directional interpolation*
Interpolation Applications
Digital zooming (resolution enhancement) Image inpainting (error concealment) Geometric transformations (where your imagination can fly)
EE465: Introduction to Digital Image Processing 24
Pixel Replication
Bilinear Interpolation
Bicubic Interpolation
28
(Color-Filter-Array Interpolation)
Image Demosaicing
Bayer Pattern
29
Image Example
Error Concealment*
damaged
interpolated
EE465: Introduction to Digital Image Processing 31
Image Inpainting*
32
Image Mosaicing*
33
Geometric Transformation
In the virtual space, you can have any kind of apple you want! MATLAB functions: griddata, interp2, maketform, imtransform
EE465: Introduction to Digital Image Processing 34
Basic Principle
(x,y) (x,y) is a geometric transformation We are given pixel values at (x,y) and want to interpolate the unknown values at (x,y) Usually (x,y) are not integers and therefore we can use linear interpolation to guess their values
MATLAB implementation: z=interp2(x,y,z,x,y,method);
EE465: Introduction to Digital Image Processing 35
Rotation
y y x x
sin x cos y
36
MATLAB Example
z=imread('cameraman.tif'); % original coordinates [x,y]=meshgrid(1:256,1:256); % new coordinates a=2; for i=1:256;for j=1:256; x1(i,j)=a*x(i,j); y1(i,j=y(i,j)/a; end;end % Do the interpolation z1=interp2(x,y,z,x1,y1,'cubic');
EE465: Introduction to Digital Image Processing 37
Rotation Example
=3o
38
Scale
a=1/2
x' a 0 x y ' = 0 1 / a y
EE465: Introduction to Digital Image Processing 39
Affine Transform
square
parallelogram
x' a11 a12 x d x y + d y ' = a 21 a22 y
40
41
Shear
square
parallelogram
x' 1 0 x d x y ' = s 1 y + d y
42
Shear Example
x ' 1 0 x 0 y ' = .5 1 y + 1
EE465: Introduction to Digital Image Processing 43
Projective Transform
B A D B A C
C D
square
x '=
a1 x + a2 y + a3 a7 x + a8 y + 1
quadrilateral
a4 x + a5 y + a6 y' = a7 x + a8 y + 1
EE465: Introduction to Digital Image Processing 44
[ 0 0; 1 0; 1 1; 0 1]
Polar Transform
r= x +y
2
= tan
y x
46
47
http://astronomy.swin.edu.au/~pbourke/projection/imagewarp/
EE465: Introduction to Digital Image Processing 48
Seung-Yong Lee et al., Image Metamorphosis Using Snakes and Free-Form Deformations,SIGGRAPH1985, Pages 439-448
EE465: Introduction to Digital Image Processing 49
50