cs448f: image processing for photography and vision

68
CS448f: Image Processing For Photography and Vision Denoising

Upload: belva

Post on 25-Feb-2016

32 views

Category:

Documents


1 download

DESCRIPTION

CS448f: Image Processing For Photography and Vision. Denoising. How goes the assignment?. The course so far…. We have a fair idea what image processing code looks like We know how to treat an image as a continuous function We know how to warp images What should we do next?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CS448f: Image Processing For Photography and Vision

CS448f: Image Processing For Photography and Vision

Denoising

Page 2: CS448f: Image Processing For Photography and Vision

How goes the assignment?

Page 3: CS448f: Image Processing For Photography and Vision

The course so far…

• We have a fair idea what image processing code looks like

• We know how to treat an image as a continuous function

• We know how to warp images• What should we do next?

Page 4: CS448f: Image Processing For Photography and Vision

What are the big problems in Photography and Computer Vision,

and how can Image Processing help?

Page 5: CS448f: Image Processing For Photography and Vision

Today: Denoising

Page 6: CS448f: Image Processing For Photography and Vision

How do we know a pixel is bad?

• It’s not like its neighbours• Solution: Replace each pixel with the average

of its neighbors• I.e. Convolve by

1 1 1

1 1 1

1 1 1

Page 7: CS448f: Image Processing For Photography and Vision

3x3 Rect Filter

Page 8: CS448f: Image Processing For Photography and Vision

5x5 Rect Filter

Page 9: CS448f: Image Processing For Photography and Vision

Linear Filters

• Why should a far-away pixel contribute the same amount as a nearby pixel

• Gaussian blur:

Page 10: CS448f: Image Processing For Photography and Vision

Gaussian Blur

Page 11: CS448f: Image Processing For Photography and Vision

beta = 2

Page 12: CS448f: Image Processing For Photography and Vision

beta = 5

Page 13: CS448f: Image Processing For Photography and Vision

• It’s radially symettric and separable at the same time:

• Its Fourier transform is also a Gaussian• It’s not very useful for denoising

Some neat properties:

Page 14: CS448f: Image Processing For Photography and Vision

Linear Filters

• Convolve by some kernel• Equivalent to multiplication in Fourier domain• Reduces high frequencies– But we wanted those - that’s what made the

image sharp!– You don’t always need the high frequencies. The

first step in many computer vision algorithms is a hefty blur.

Page 15: CS448f: Image Processing For Photography and Vision

Probabilistically...

• What is the most probable value of a pixel, given its neighbors?

Page 16: CS448f: Image Processing For Photography and Vision

Probabilistically...

• This is supposed to be dark grey:

Page 17: CS448f: Image Processing For Photography and Vision

Let’s ignore color for now

Page 18: CS448f: Image Processing For Photography and Vision

And inspect the distribution

Page 19: CS448f: Image Processing For Photography and Vision

And inspect the distributionMost probable pixel value

Page 20: CS448f: Image Processing For Photography and Vision

And inspect the distributionmean = mode = median

Page 21: CS448f: Image Processing For Photography and Vision

Denoising

Page 22: CS448f: Image Processing For Photography and Vision

Denoising

Page 23: CS448f: Image Processing For Photography and Vision

The distribution

Page 24: CS448f: Image Processing For Photography and Vision

The distribution

The background The text

Page 25: CS448f: Image Processing For Photography and Vision

The distributionThe mean

Page 26: CS448f: Image Processing For Photography and Vision

The distributionThe mode

Page 27: CS448f: Image Processing For Photography and Vision

The distributionThe median

Page 28: CS448f: Image Processing For Photography and Vision

Median Filters

• Replace each pixel with the median of its neighbours

• Great for getting rid of salt-and-pepper noise• Removes small details

Page 29: CS448f: Image Processing For Photography and Vision

Before:

Page 30: CS448f: Image Processing For Photography and Vision

Gaussian Blur:

Page 31: CS448f: Image Processing For Photography and Vision

After Median Filter:

Page 32: CS448f: Image Processing For Photography and Vision

The distribution

• What is the most probable pixel value?

Page 33: CS448f: Image Processing For Photography and Vision

It depends on your current value

• The answer should vary for each pixel

Page 34: CS448f: Image Processing For Photography and Vision

An extra prior

• Method 1) Convolution– The pixel is probably looking at the same material

as all of its neighbors, so we’ll set it to the average of its neighbors.

• Method 2) Bilateral– The pixel is probably looking at the same material

as SOME of its neighbors, so we’ll set it to the average of those neighbors only.

Page 35: CS448f: Image Processing For Photography and Vision

The Bilateral Filter

• How do we select good neighbours? • The ones with roughly similar brightnesses are

probably looking at the same material.

Page 36: CS448f: Image Processing For Photography and Vision

Before:

Page 37: CS448f: Image Processing For Photography and Vision

Gaussian Blur:

Page 38: CS448f: Image Processing For Photography and Vision

After Median Filter:

Page 39: CS448f: Image Processing For Photography and Vision

After Bilateral:

Page 40: CS448f: Image Processing For Photography and Vision

Dealing with Color

• It turns out humans are only sensitive to high frequencies in brightness– not in hue or saturation

• So we can blur in chrominance much more than luminance

Page 41: CS448f: Image Processing For Photography and Vision

Chroma Blurring

• 1) Convert RGB to LAB– L is luminance, AB are chrominance

(hue and saturation)

• 2) Perform a small bilateral in L• 3) Perform a large bilateral in AB• 4) Convert back to RGB

Page 42: CS448f: Image Processing For Photography and Vision

Before:

Page 43: CS448f: Image Processing For Photography and Vision

After Regular Bilateral:

Page 44: CS448f: Image Processing For Photography and Vision

After Modified Bilateral:

Page 45: CS448f: Image Processing For Photography and Vision

Method Noise (Gaussian)

Page 46: CS448f: Image Processing For Photography and Vision

Method Noise (Bilateral)

Page 47: CS448f: Image Processing For Photography and Vision

Leveraging Similarity:Non-Local Means

Page 48: CS448f: Image Processing For Photography and Vision

What color should this pixel be?

Page 49: CS448f: Image Processing For Photography and Vision

What color should this pixel be?

Page 50: CS448f: Image Processing For Photography and Vision

Gaussian Blur:A weighted average of these:

(all nearby pixels)

Page 51: CS448f: Image Processing For Photography and Vision

Bilateral filterA weighted average of these:

(the nearby ones that have a similar color to me)

Page 52: CS448f: Image Processing For Photography and Vision

Non-Local MeansA weighted average of these:

(the ones that have similar neighbors to me)

Page 53: CS448f: Image Processing For Photography and Vision

Non-Local Means:

• For each pixel– Find every other (nearby) pixel that has a similar

local neighborhood around it to me– Set my value to be the weighted average of those

Page 54: CS448f: Image Processing For Photography and Vision

Before:

Page 55: CS448f: Image Processing For Photography and Vision

Gaussian Blur:

Page 56: CS448f: Image Processing For Photography and Vision

After Median Filter:

Page 57: CS448f: Image Processing For Photography and Vision

After Bilateral:

Page 58: CS448f: Image Processing For Photography and Vision

After Non-Local Means:

Page 59: CS448f: Image Processing For Photography and Vision

Before:

Page 60: CS448f: Image Processing For Photography and Vision

Method Noise (Gaussian)

Page 61: CS448f: Image Processing For Photography and Vision

Method Noise (Bilateral)

Page 62: CS448f: Image Processing For Photography and Vision

Method Noise (Non-Local Means)

Page 63: CS448f: Image Processing For Photography and Vision

Run-Times: Rect Filter

• For every pixel:– For every other nearby pixel:• Do a multiply and add

Page 64: CS448f: Image Processing For Photography and Vision

Run-Times: Gaussian Blur

• For every pixel:– For every other nearby pixel:• Compute a distance-based weight

– (can be precomputed)• Do a multiply and add

Page 65: CS448f: Image Processing For Photography and Vision

Run-Times: Median Filter

• For every pixel:– For every other nearby pixel:• Add into a histogram

– Compute the median of the histogram

Page 66: CS448f: Image Processing For Photography and Vision

Run-Times: Bilateral

• For every pixel:– For every other nearby pixel:• Compute a similarity weight• Compute a distance-based weight

– (can be precomputed)• Do a multiply and add

Page 67: CS448f: Image Processing For Photography and Vision

Run-Times: Non-Local Means

• For every pixel x:– For every other nearby pixel y:• Compute a distance weight• Compute a similarity weight:• For every pixel z in a patch around y

– Compare z to the corresponding pixel in the patch around x– Add to the similarity term

• Multiply and add

Page 68: CS448f: Image Processing For Photography and Vision

These methods are all fairly useless for large filter sizes

• ... unless you can speed them up