Top Banner
EECS 556 – Image Processing– W 09 Interpolation Interpolation techniques Bsplines
57

EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Mar 08, 2018

Download

Documents

buikhue
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

EECS 556 – Image Processing– W 09

Interpolation

• Interpolation techniques• B‐splines

Page 2: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

What is image processing?

Image processing is the application of 2D signal processing methods to images

• Image representation and modeling

• Image enhancement

• Image restoration/image filtering

• Compression(computer vision)

Page 3: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Image enhancement• Accentuate certain desired features for subsequent analysis or display.– Contrast stretching / dynamic range adjustment

– Color histogram normalization

– Noise reduction

– Sharpening

– Edge detection

– Corner detection

– Image interpolation

Page 4: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

What is interpolation?• given a discrete‐space image gd[n,m]

• This corresponds to samples of some continuous space image ga(x, y)

• Compute values of the CS image ga(x, y) at (x,y) locations other than the sample locations.

gd[n,m]ga(x, y) g’d[n,m]

Page 5: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

What is interpolation?

• Interpolation is critical for:

– Displaying

– Image zooming

– Warping

– Coding

– Motion estimation

Page 6: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Is perfect recovery always possible?

No, (never actually), unless some assumptions on ga(x,y) are made

There are uncountable infinite collection of functions ga(x, y) that agree with gd[n,m] at the sample points

What are these assumptions?• ga must be band‐limited

• Sampling rate must satisfy Nyquist theorem

Page 7: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

ga must be band‐limited

There exists such that

Page 8: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Sampling rate must satisfy Nyquisttheorem

v v v

Page 9: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Ideal Uniform Rectilinear Sampling

• 2D uniformly sampled grid

Page 10: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Ideal Uniform Rectilinear Sampling

ga(x,y)

gs(x,y)

Page 11: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

How to recover ga ?

ga(x,y,)

Page 12: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

How to recover ga ?

Page 13: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Sinc interpolationWe can recover ga(x, y) by interpolating the samples gd[n,m] using sinc functions

Page 14: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

InterpolationSampled gs

MATLAB’s interp2

Page 15: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

What’s the problem with sincinterpolation?

• Real world images need not be exactly band‐limited.

• Unbounded support

• Summations require infinitely many samples

• Computationally very expensive

Page 16: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear interpolation• sinc interpolation formula 

• Linear interpolation:

h(x, y) = interpolation kernel

Why this is a linear interpolation? Linear function of the samples gd[n,m] 

Page 17: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear interpolation

• Consider alternative linear interpolation schemes that address issues with:– Unbounded support

– Summations require infinitely many samples

– Computationally very expensive

Page 18: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Basic polynomial interpolation

Here kernels that are piecewise polynomials

• Zero‐order or nearest neighbor interpolation– Use the value at the nearest sample location

– Kernels are zero order polynomials 

Page 19: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Nearest neighbor interpolation

Page 20: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear or bilinear interpolation– tri function is a piecewise linear function of its (spatial) arguments 

Δ/2‐Δ/2

Page 21: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear or bilinear interpolation• For any point (x, y), we find the four nearest sample point

• fit a polynomial of the form

• Estimate alphas from system of 4 equations in 4 unknowns: 

Interpolating formula (x∈ [0, 1] × [0, 1]):

Page 22: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear or bilinear interpolation

1

1

If x∈ [‐1, 1] × [‐1, 1]: 

‐1

0

Page 23: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear
Page 24: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear or bilinear interpolation

Page 25: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Linear interpolation by Delaunay triangulation

Use a linear function within each triangle (three points determine a plane).

MATLAB’s griddata with the ’linear’ opt

Page 26: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear
Page 27: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear
Page 28: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

What’s the problem zero‐order or bilinear interpolation?

• neither the zero‐order or bilinear interpolator are differentiable.

• They are not continuous and smooth 

Page 29: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Desirable properties of interpolators

• “self consistency”:

• Continuous and smooth (differentiable):

• Short spatial extent to minimize computation

Page 30: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Desirable properties of interpolators

• Frequency response approximately rect().

• symmetric

• Shift invariant

• Minimum sidelobes to avoid ringing “artifacts”

Page 31: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Continuous and smoothLarge sidelobes

Non smoothSmall sidelobes

Page 32: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Non smooth; non shift invariant

Page 33: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Polynomial interpolation– Cubic

– Quadratic

– B‐splines

interpolation kernel:

Page 34: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear
Page 35: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline interpolation

• Motivation:– n‐order differentiable

– Short spatial extent to minimize computation

Page 36: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Background • Splines are piecewise polynomials with pieces that are smoothly connected together

• The joining points of the polynomials are called knots

Page 37: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Background • For a spline of degree n, each segment is a polynomial of degree n– Do i need n+1 coefficient to describe each piece?

• Additional smoothness constraint imposes the continuity of  the spline and its derivatives up to order (n‐1) at the knots

• only one degree of freedom per segment!

Page 38: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline expansion 

• Splines are uniquely characterized in terms of a B‐spline expansion

= central B‐spline = basis (B) spline

integer shifts of the central B‐spline of degree n

Page 39: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐splines• Symmetrical

• bell‐shaped functions

• constructed from the (n+1)‐fold convolution

Page 40: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐splines

Page 41: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐splines

• n‐order B‐spline:

• Derived using:

Page 42: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline

• Using cubic B‐splines is a popular choice:

• Important: compactly supported!

Page 43: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Cubic B−spline and its underlying components

support

Page 44: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline expansion 

Each spline is unambiguously characterized by its sequence of   B‐spline coefficients c(k)

Page 45: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Properties of B‐spline expansion 

• Discrete signal representation! (even though the underlying model is a continuous representation).

• Easy to manipulate; 

• E.g., derivatives:

Page 46: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline interpolation

• So far: B‐spline model of a given input signal s(x)

Interpolation problem: find coefficients c(k) such that spline function goes through the data points exactly

That is, reconstruct signal using a spline representation!

sd[n]

Page 47: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Reconstruct signal using a splinerepresentation

sd [n]

Page 48: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline interpolation

• Relationship between coefficients and samples

sd [n]

Obtained by sampling the B‐spline of degree n expanded by a factor of m (m=1)

= discrete B‐spline kernel

Page 49: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Cardinal B‐spline interpolation

Cardinal splines

Page 50: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

2D splines in images

• tensor‐product basis functions

Page 51: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

B‐spline interpolation

• Conclusion:–n‐order differentiable

– Short spatial extent to minimize computation

Page 52: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

General image spatial transformations 

• transform the spatial coordinates of an image f(x, y) so that (after being transformed), it better “matches” another image– Ex: warping brain images into a standard coordinate system to facilitate automatic image analysis

Page 53: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

image spatial transformations

Page 54: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

General image spatial transformations 

Form of transformations:

• Shift only g(x, y) = f(x − x0, y − y0)

• Affine g(x, y) = f(ax + by, cx + dy)

• thin‐plate splines (describes smooth warpings using control points)

• General spatial transformation (e.g., morphing or warping an image) 

MATLAB’s interp2 or griddata functions

Page 55: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear

Interpolation is critical!

Page 56: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear
Page 57: EECS 556 –Image Processing– W 09 Interpolationweb.eecs.umich.edu/~silvio/teaching/EECS556_2009/lectures/lecture... · EECS 556 –Image Processing– W 09. Interpolation ... bilinear