CS 559 Computer Graphics Lecture 3 Digital Image

  • Slides: 31
Download presentation
CS 559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008

CS 559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008

Today • Eyes • Cameras

Today • Eyes • Cameras

Image as a discreet function Represented by a matrix

Image as a discreet function Represented by a matrix

Convolution 0 0 0. 5 0 0 I

Convolution 0 0 0. 5 0 0 I

What is image filtering? • Modify the pixels in an image based on some

What is image filtering? • Modify the pixels in an image based on some function of a local neighborhood of the pixels. 10 5 3 4 5 1 1 1 7 Local image data Some function 7 Modified image data

Linear functions • Simplest: linear filtering. – Replace each pixel by a linear combination

Linear functions • Simplest: linear filtering. – Replace each pixel by a linear combination of its neighbors. • The prescription for the linear combination is the “convolution kernel”. 10 5 3 0 4 5 1 0 0. 5 0 1 1 7 0 Local image data 0 0 7 1 0. 5 kernel Modified image data

coefficient Linear filtering (warm-up slide) 1. 0 0 original Pixel offset ?

coefficient Linear filtering (warm-up slide) 1. 0 0 original Pixel offset ?

coefficient Linear filtering (warm-up slide) 1. 0 0 original Pixel offset Filtered (no change)

coefficient Linear filtering (warm-up slide) 1. 0 0 original Pixel offset Filtered (no change)

Linear filtering coefficient 1. 0 0 Pixel offset original ?

Linear filtering coefficient 1. 0 0 Pixel offset original ?

shift coefficient 1. 0 0 Pixel offset original shifted

shift coefficient 1. 0 0 Pixel offset original shifted

coefficient Linear filtering 0. 3 0 Pixel offset original ?

coefficient Linear filtering 0. 3 0 Pixel offset original ?

coefficient Blurring 0. 3 0 Pixel offset original Blurred (filter applied in both dimensions).

coefficient Blurring 0. 3 0 Pixel offset original Blurred (filter applied in both dimensions).

8 impulse original coefficient Blur Examples 2. 4 0. 3 0 Pixel offset filtered

8 impulse original coefficient Blur Examples 2. 4 0. 3 0 Pixel offset filtered

Blur Examples impulse filtered 4 coefficient Pixel offset 8 original 0. 3 0 original

Blur Examples impulse filtered 4 coefficient Pixel offset 8 original 0. 3 0 original edge 2. 4 coefficient 8 8 4 0. 3 0 Pixel offset filtered

Linear filtering (warm-up slide) 2. 0 1. 0 0 original 0 ?

Linear filtering (warm-up slide) 2. 0 1. 0 0 original 0 ?

Linear Filtering (no change) 2. 0 1. 0 0 original 0 Filtered (no change)

Linear Filtering (no change) 2. 0 1. 0 0 original 0 Filtered (no change)

Linear Filtering 2. 0 0. 33 0 original 0 ?

Linear Filtering 2. 0 0. 33 0 original 0 ?

coefficient (remember blurring) 0. 3 0 Pixel offset original Blurred (filter applied in both

coefficient (remember blurring) 0. 3 0 Pixel offset original Blurred (filter applied in both dimensions).

Sharpening 2. 0 0. 33 0 original 0 Sharpened original

Sharpening 2. 0 0. 33 0 original 0 Sharpened original

Sharpening example 8 original 11. 2 8 coefficient 1. 7 -0. 3 -0. 25

Sharpening example 8 original 11. 2 8 coefficient 1. 7 -0. 3 -0. 25 Sharpened (differences are accentuated; constant areas are left untouched).

Sharpening before after

Sharpening before after

Noise • Image processing is also useful for noise reduction and edge enhancement. We

Noise • Image processing is also useful for noise reduction and edge enhancement. We will focus on these applications for the remainder of the lecture… • Common types of noise: – Salt and pepper noise: contains random occurrences of black and white pixels – Impulse noise: contains random occurrences of white pixels – Gaussian noise: variations in intensity drawn from a Gaussian normal distribution

Ideal noise reduction

Ideal noise reduction

Ideal noise reduction

Ideal noise reduction

Practical noise reduction • How can we “smooth” away noise in a single image?

Practical noise reduction • How can we “smooth” away noise in a single image? • Is there a more abstract way to represent this sort of operation? Of course there is!

Mean filters • How can we represent our noise-reducing averaging filter as a convolution

Mean filters • How can we represent our noise-reducing averaging filter as a convolution diagram (know as a mean filter)?

Effect of mean filters

Effect of mean filters

Gaussian filters • Gaussian filters weigh pixels based on their distance from the center

Gaussian filters • Gaussian filters weigh pixels based on their distance from the center of the convolution filter. In particular: • This does a decent job of blurring noise while preserving features of the image. • What parameter controls the width of the Gaussian? • What happens to the image as the Gaussian filter kernel gets wider? • What is the constant C? What should we set it to?

Effect of Gaussian filters

Effect of Gaussian filters

Median filters • A median filter operates over an mxm region by selecting the

Median filters • A median filter operates over an mxm region by selecting the median intensity in the region. • What advantage does a median filter have over a mean filter? • Is a median filter a kind of convolution?

Effect of median filters

Effect of median filters