image processing. overview imagespixel filters neighborhood filters dithering

56
Image Processing

Upload: chelsey-thurman

Post on 01-Apr-2015

239 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Image Processing

Page 2: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Overview

Images Pixel Filters

Neighborhood Filters Dithering

Page 3: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Image as a Function

Page 5: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

• 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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Point Operations

Page 8: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Point Processing

OriginalOriginal DarkenDarken

InvertInvert LightenLighten

Lower ContrastLower Contrast

Raise ContrastRaise ContrastNonlinear Raise Contrast

Nonlinear Raise Contrast

Nonlinear Lower Contrast

Nonlinear Lower Contrast

Page 9: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Point Processing

OriginalOriginal DarkenDarken

InvertInvert LightenLighten

Lower ContrastLower Contrast

Raise ContrastRaise ContrastNonlinear Raise Contrast

Nonlinear Raise Contrast

Nonlinear Lower Contrast

Nonlinear Lower Contrast

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

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

Page 10: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Neighborhood Operations

Page 12: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Convolution

0.2 0.1 -1.0

0.3 0.0 0.9

0.1 0.3 -1.0

Page 13: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Properties of Convolution

• Commutative

• Associativeabba

cbacba • Cascade system

f g1h 2h

f g21 hh

f g12 hh

Page 14: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Convolution

LSIS is doing convolution; convolution is linear and shift invariant

f

hfgdxhfxg

h

h

x

kernel h

Page 15: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Convolution - Example

fg

gf Eric Weinstein’s Math World

Page 16: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

1 2-1-2

xc

-1 1

1

xb

-1 1

1 xa

bac

1

Convolution - Example

Page 17: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Point Spread Function

OpticalSystemscene image

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

x xPSFOpticalSystem

point source point spread function

• However, optical systems are never ideal.

• Point spread function of Human Eyes

Page 18: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Point Spread Function

normal vision myopia hyperopia

Images by Richmond Eye Associatesastigmatism

Page 19: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Original Image

Page 20: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Blurred Image

Page 21: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Gaussian Smoothing

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

by Charles Allen Gillbert by Harmon & Julesz

Page 22: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Gaussian Smoothing

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

Page 23: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Original Image

Page 24: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Sharpened Image

Page 25: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Sharpened Image

Page 26: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Original Image

Page 27: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Noise

Page 28: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Blurred Noise

Page 29: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Median Filter

Can this be described as a convolution?

Page 31: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Original Image

Page 32: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Example: Noise Reduction

Image with noise Median filter (5x5)

Page 33: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

3x3

5x5

7x7

Salt and pepper noise Gaussian noise

Page 34: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Example: Noise Reduction

Original image Image with noise Median filter (5x5)

Page 35: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Original Image

Page 36: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

X-Edge Detection

Page 37: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Y-Edge Detection

Page 38: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

General Edge Detection

Can this be described as a convolution?

Page 39: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

• 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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Aliasing

Page 41: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Alias: n., an assumed name

Picket fence recedinginto the distance willproduce aliasing…

Input signal:

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

Matlab output:

WHY?

Alias!

Not enough samples

Page 42: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Image Scaling

This image is too big tofit on the screen. Howcan we reduce it?

How to generate a half-sized version?

Page 43: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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 44: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Image Sub-Sampling

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

Page 45: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Good and Bad Sampling

Good sampling:•Sample often or,•Sample wisely

Bad sampling:•see aliasing in action!

Page 46: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Really bad in video

Page 47: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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

Sub-Sampling with Gaussian Pre-Filtering

Page 49: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Compare with...

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

Page 50: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Aliasing

Page 51: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

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

From Rick Matthews website, images by Dave Etchells

Page 52: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Figure from David Forsyth

Page 53: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Original Image

Page 54: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Warped Image

Page 55: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Warped Image

=+

orig vector field warped

how?

Page 56: Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering

Advection (just like a fluid)