Sie sind auf Seite 1von 58

Digital Image Processing, 3rd ed.

Gonzalez & Woods


www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Lecture 6

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

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)
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

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

We want GOOD images


If some block of an image gets damaged during the
transmission, we want to repair it

We want COOL images


Manipulate images digitally can render fancy artistic
effects as we often see in movies
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Image Interpolation (Tool)

Zooming
Shrinking
Rotating
Geometric Correction

Zooming & Shrinking


Re-sampling

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Image Interpolation (Tool)

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Scenario I: Resolution Enhancement

Low-Res.
High-Res.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Scenario II: Image Inpainting

19922008 R. C. Gonzalez & R. E. Woods

Non-damaged

Damaged

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Scenario III: Image Wraping

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Concept
Interpolation works by using known data to estimate values at unknown points.

The more temperature measurements you have which are close to noon, the
more sophisticated (and hopefully more accurate) your interpolation algorithm
can be.
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Linear Interpolation Formula


Heuristic: the closer to a pixel, the higher weight is assigned
Principle: line fitting to polynomial fitting (analytical formula)
f(n)
f(n+a)

f(n+1)

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
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

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,

19922008 R. C. Gonzalez & R. E. Woods

], x=n/6

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Image Interpolation Algorithms


Non-adaptive algorithms include: nearest neighbor, bilinear, bicubic,
spline, sinc, lanczos, etc.
Adaptive algorithms include many proprietary algorithms in licensed
software such as: Qimage, PhotoZoom Pro, Genuine Fractals, etc.
Depending on their complexity, these use anywhere from 0 to 256 (or
more) adjacent pixels when interpolating. The more adjacent pixels they
include, the more accurate they can become, but this comes at the expense
of much longer processing time. These algorithms can be used to both
distort and resize a photo.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Image Interpolation Algorithms


Nearest Neighbor Interpolation
Intensity of the closest pixel is assigned.

Bilinear Interpolation
Four nearest neighbors are used to estimate the
intensity.

Bicubic Interpolation
Sixteen nearest neighbors of point are used to assign
the intensity.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Bilinear Interpolation
Use 4 nearest neighbor
Solve for 4 coefficients
Product of 2 linear functions

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Bilinear Interpolation

I20,14.5 = 150.5
I21,14.5 = 128.5
I20.2,14.5 = 146.1
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Enlargement by 1.5 times

Image is 500 500


Imaginary Array: 750 750 (same pixel spacing)
Set value from the closest pixel in original image
Expand it to the original expanded size
This is Nearest Neighbor Interpolation
Produces artifacts (distortion of straight edge)

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Nearest Neighbor Interpolation


Induces Voronoi Diagram

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Bilinear Interpolation

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Bicubic Interpolation
The function values f and the derivatives fx, fy and
fxy are known at the four corners (0,0), (1,0), (0,1),
and (1,1) of the unit square. The interpolated
surface can then be written

Yields a surface p(x,y) on the unit square which is


continuous and with continuous derivatives
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Bicubic Interpolation (Discrete)

Use 16 nearest neighbor


Solve for 16 coefficients
Used in Adobe Photoshop / Corel Photopaint
Used for image resampling over bilinear or nearest
neighbor method.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Interpolation Comparative

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Limitation with bilinear/bicubic


Edge blurring
Jagged artifacts
Edge blurring

Jagged artifacts

Z
X
X

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Limitation of Interpolation
Image details can be lost during Interpolation.

Rotate

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Edge-Sensitive Interpolation
Step 1: interpolate the missing pixels along the diagonal
a

b
x

black or white?

Since |a-c|=|b-d|
x has equal probability
of being black or white

Step 2: interpolate the other half missing pixels


a
x

d
c
19922008 R. C. Gonzalez & R. E. Woods

Since |a-c|>|b-d|
x=(b+d)/2=black

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

A common confusion

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Lecture 7

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Geometric Transformation

In the virtual space, you can have any kind of apple you want!
MATLAB functions: griddata, interp2, maketform, imtransform
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Rotation

19922008 R. C. Gonzalez & R. E. Woods

x'

cos

sin

y'

sin

cos

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Scale
a=1/2

x'
y'

19922008 R. C. Gonzalez & R. E. Woods

a 0 x
0 1/ a y

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Affine Transform

parallelogram

square
x'
y'

19922008 R. C. Gonzalez & R. E. Woods

a11 a12
a21 a22

x
y

dx
dy

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

x'
y'

Affine Transform
Example
19922008 R. C. Gonzalez & R. E. Woods

.5
.5

1 x
2 y

0
1

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Shear

parallelogram

square
x'
y'

19922008 R. C. Gonzalez & R. E. Woods

1 0 x
s 1 y

dx
dy

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

x'
y'

1 0 x
.5 1 y

0
1

Shear Example
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Extend you imagination

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Free Form Deformation

Seung-Yong Lee et al., Image Metamorphosis Using Snakes and Free-Form Deformations,
SIGGRAPH 1985, Pages 439-448
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Application into Image Metamorphosis


19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Which is good?
(1) Geometric Invariance: The interpolation method should preserve the
geometry and relative sizes of objects in an image. That is, the subject matter
should not change under interpolation.
(2) Contrast Invariance: The method should preserve the luminance values of
objects in an image and the overall contrast of the image.
(3) Noise: The method should not add noise or other artifacts to the image,
such as ringing artifacts near the boundaries.
(4) Edge Preservation: The method should preserve edges and boundaries,
sharpening them where possible.
(5) Aliasing: The method should not produce jagged or staircase edges.
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Which is good? (contd.)


(6) Texture Preservation: The method should not blur or smooth textured regions.
(7) Over-smoothing: The method should not produce undesirable piecewise
constant or blocky regions.
(8) Application Awareness: The method should produce results appropriate to
the type of image and order of resolution. For example, the interpolated results
should appear realistic for photographic images, but for medical images the results
should have crisp edges and high contrast. If the interpolation is for general images,
the method should be independent of the type of image.
(9) Sensitivity to Parameters: The method should not be too sensitive to internal
parameters that may vary from image to image and thus increase computational
overhead.
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Geometry

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Neighbors of Pixels P = (x,y) in 2-D


4Neighbours
N4(P) = {(x1,y), (x+1,y) , (x,y1), (x,y+1)}

DiagonalNeighbours
ND(P) = {(x1,y1), (x1,y+1) , (x+1,y1), (x+1,y+1)}

8Neighbours
N8(P) = N4(P)

19922008 R. C. Gonzalez & R. E. Woods

ND(P)

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Neighbors of Voxels P = (x,y,z) in 3-D


6Neighbours (Face), 18Neighbours (Edge) &
26Neighbours (Corner)

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Adjacency
V = Set of intensity values for adjacency
P & Q are considered adjacent iff g(P), g(Q)
V = {1} for binary

4adjacency: Q
8adjacency: Q
madjacency:
Q
Q

N4(P)
N8(P)

N4(P) OR
ND(P) and for all R

19922008 R. C. Gonzalez & R. E. Woods

N4(P) N4(Q), g(R)

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Path
Sequence of distinct pixels satisfying pair-wise
adjacency
Length of the path
Number of adjacencies
One less than the number of points

Shortest Path between two pixels can be nonunique


Closed Path: Same Start and End Points
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

2-D Path
Length of the path
Number of
adjacencies
One less than the
number of points

Shortest Path
between two pixels
can be non-unique
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

8-path

19922008 R. C. Gonzalez & R. E. Woods

m-path

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Connectivity
Let S represents a subset of pixels in an image. p, q
are said to be connected if there exists a path
between them consisting entirely of pixels in S.
For any pixel p S, the set of pixels that are
connected to it in S is called a connected
component
If S has only one connected component, then S is
called a connected set.
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Connectivity
Let R be a subset of pixels in an image. R is said to
be a region of the image if R is a connected set.
Region Ri and Rj are adjacent if their union form a
connected set; disjoint otherwise.
If S has only one connected component, then S is
called a connected set.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Two regions are 8-adjacent; but not 4-adjacent

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Foreground & Background


Foreground: Union of all disjoint Regions in an
Image
Background: Complement of Foreground

Boundary or Border or Contour


Inner Border
Set of points in R adjacent to complement of R

Outer Border
Set of points in complement of R adjacent to R
19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

The circled point is part of the boundary of the 1-valued pixels only if 8adjacency between the region and the background is used.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

The inner boundary of the 1-valued regions


does not form a closed path, but its outer
boundary does.

The distinction between inner and outer boundary is important for the
development of the border-following algorithm.
Such algorithms use outer boundary to guarantee a closed path.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

If region R happens to be the entire image then


what is the boundary?
Reason why?

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

Boundary and edge are they same or different?

Lets assume Edges are intensity discontinuities.


Boundaries are closed path.

19922008 R. C. Gonzalez & R. E. Woods

Digital Image Processing, 3rd ed.


Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 2

Digital Image Fundamentals

4 and 8Neighbours Dichotomy


Jordans Curve Theorem
Every simple closed curve divides the plane into an
"interior" region bounded by the curve and an "exterior"
region containing all far away points
Any continuous path connecting a point of one region to a
point of the other intersects that loop somewhere.

19922008 R. C. Gonzalez & R. E. Woods

Das könnte Ihnen auch gefallen