55
Image Processing

Lecture 24 Slides

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 24 Slides

Image Processing

Page 2: Lecture 24 Slides

Overview

Images Pixel Filters

Neighborhood Filters Dithering

Page 3: Lecture 24 Slides

Image as a Function

• We can think of an image as a function, f,

• f: R2 R

– f (x, y) gives the intensity at position (x, y)

– Realistically, we expect the image only to be

defined over a rectangle, with a finite range:

• f: [a,b]x[c,d] [0,1]

• A color image is just three functions pasted together. We can write this as a “vector-

valued” function: ( , )

( , ) ( , )

( , )

r x y

f x y g x y

b x y

Page 4: Lecture 24 Slides

Image as a Function

Page 5: Lecture 24 Slides

Image Processing

• Define a new image g in terms of an existing

image f

– We can transform either the domain or the range of f

• Range transformation:

What kinds of operations can this perform?

Page 6: Lecture 24 Slides

• Some operations preserve the range but change

the domain of f :

What kinds of operations can this perform?

• Still other operations operate on both the

domain and the range of f .

Image Processing

Page 7: Lecture 24 Slides

Point Operations

Page 8: Lecture 24 Slides

Point Processing

Original Darken

Invert Lighten

Lower Contrast

Raise Contrast Nonlinear Raise Contrast

Nonlinear Lower Contrast

Page 9: Lecture 24 Slides

Point Processing

Original Darken

Invert Lighten

Lower Contrast

Raise Contrast Nonlinear Raise Contrast

Nonlinear Lower Contrast

x + 128 x * 2 255 - x ((x / 255.0) ^2) * 255.0

x - 128 x / 2 x ((x / 255.0) ^ 0.33) * 255.0

Page 10: Lecture 24 Slides

Gamma correction

= 1.0; f(v) = v = 2.5; f(v) = v1/2.5 = v0.4

Monitors have a intensity to voltage response curve which is roughly a 2.5 power function

Send v actually display a pixel which has intensity equal to v2.5

Page 11: Lecture 24 Slides

Neighborhood Operations

Page 12: Lecture 24 Slides

Convolution

0.2 0.1 -1.0

0.3 0.0 0.9

0.1 0.3 -1.0

Page 13: Lecture 24 Slides

Properties of Convolution

• Commutative

• Associative

abba

cbacba

• Cascade system

f g1h 2h

f g21 hh

f g12 hh

Page 14: Lecture 24 Slides

Convolution

Convolution is linear and shift invariant

f

hfgdxhfxg

h

h

x

kernel h

Page 15: Lecture 24 Slides

Convolution - Example

fg

gf Eric Weinstein’s Math World

Page 16: Lecture 24 Slides

1 2 -1 -2

xc

-1 1

1

xb

-1 1

1 xa

bac

1

Convolution - Example

Page 17: Lecture 24 Slides

Point Spread Function

Optical

System scene image

• Ideally, the optical system should be a Dirac delta function.

x xPSFOptical

System point source point spread function

• However, optical systems are never ideal.

• Point spread function of Human Eyes

Page 18: Lecture 24 Slides

Point Spread Function

normal vision myopia hyperopia

Images by Richmond Eye Associates astigmatism

Page 19: Lecture 24 Slides

Original Image

Page 20: Lecture 24 Slides

Blurred Image

Page 21: Lecture 24 Slides

Gaussian Smoothing

http://www.michaelbach.de/ot/cog_blureffects/index.html

by Charles Allen Gillbert by Harmon & Julesz

Page 22: Lecture 24 Slides

Gaussian Smoothing

http://www.michaelbach.de/ot/cog_blureffects/index.html

Page 23: Lecture 24 Slides

Original Image

Page 24: Lecture 24 Slides

Sharpened Image

Page 25: Lecture 24 Slides

Sharpened Image

Page 26: Lecture 24 Slides

Original Image

Page 27: Lecture 24 Slides

Noise

Page 28: Lecture 24 Slides

Blurred Noise

Page 29: Lecture 24 Slides

Median Filter

• Smoothing is averaging

(a) Blurs edges

(b) Sensitive to outliers

(a)

(b)

– Sort values around the pixel

– Select middle value (median)

– Non-linear (Cannot be implemented with convolution)

• Median filtering

12 N

sort median

Page 30: Lecture 24 Slides

Median Filter

Can this be described as a convolution?

Page 31: Lecture 24 Slides

Original Image

Page 32: Lecture 24 Slides

Example: Noise Reduction

Image with noise Median filter (5x5)

Page 33: Lecture 24 Slides

3x3

5x5

7x7

Salt and pepper noise Gaussian noise

Page 34: Lecture 24 Slides

Example: Noise Reduction

Original image Image with noise Median filter (5x5)

Page 35: Lecture 24 Slides

Original Image

Page 36: Lecture 24 Slides

X-Edge Detection

Page 37: Lecture 24 Slides

Y-Edge Detection

Page 38: Lecture 24 Slides

General Edge Detection

Can this be described as a convolution?

Page 39: Lecture 24 Slides

• Some operations preserve the range but change

the domain of f :

What kinds of operations can this perform?

• Still other operations operate on both the

domain and the range of f .

Image Processing

Page 40: Lecture 24 Slides

Image Scaling

This image is too big to

fit on the screen. How

can we reduce it?

How to generate a half-

sized version?

Page 41: Lecture 24 Slides

Image Sub-Sampling

Throw away every other row and

column to create a 1/2 size image

- called image sub-sampling

1/4

1/8

Page 42: Lecture 24 Slides

Image Sub-Sampling

1/4 (2x zoom) 1/8 (4x zoom) 1/2

Page 43: Lecture 24 Slides

Good and Bad Sampling

Good sampling: •Sample often or,

•Sample wisely

Bad sampling: •see aliasing in action!

Page 44: Lecture 24 Slides

Aliasing

Page 45: Lecture 24 Slides

Alias: n., an assumed name

Picket fence receding

into the distance will

produce aliasing…

Input signal:

x = 0:.05:5; imagesc(sin((2.^x).*x))

Matlab output:

WHY?

Alias!

Not enough samples

Page 46: Lecture 24 Slides

Really bad in video

Page 47: Lecture 24 Slides

Sub-Sampling with Gaussian Pre-Filtering

G 1/4

G 1/8

Gaussian 1/2

• Solution: filter the image, then subsample – Filter size should double for each ½ size reduction. Why?

Page 48: Lecture 24 Slides

G 1/4 G 1/8 Gaussian 1/2

Sub-Sampling with Gaussian Pre-Filtering

Page 49: Lecture 24 Slides

Compare with...

1/4 (2x zoom) 1/8 (4x zoom) 1/2

Page 50: Lecture 24 Slides

Canon D60 (w/ anti-alias filter) Sigma SD9 (w/o anti-alias filter)

From Rick Matthews website, images by Dave Etchells

Page 51: Lecture 24 Slides

Figure from David Forsyth

Page 52: Lecture 24 Slides

Original Image

Page 53: Lecture 24 Slides

Warped Image

Page 54: Lecture 24 Slides

Warped Image

= +

orig vector field warped

how?

Page 55: Lecture 24 Slides

Advection (just like a fluid)