Presentation is loading. Please wait.

Presentation is loading. Please wait.

09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.

Similar presentations


Presentation on theme: "09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering."— Presentation transcript:

1 09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering

2 09/19/2002 (C) University of Wisconsin 2002, CS 559 Today Signal processing for graphics Homework 2 is available Project 2 is almost available

3 09/19/2002 (C) University of Wisconsin 2002, CS 559 Enlarging an Image To enlarge an image, you have to add pixels between the old pixels What values do you choose for those pixels?

4 09/19/2002 (C) University of Wisconsin 2002, CS 559 Images as Samples of Functions We can view an image as a set of samples from an ideal function –This is particularly true if we are plotting a function, but it is also the case that a digital photograph is a sample of some function If we knew what the function was, we could enlarge the image by resampling the function Failing that, we can reconstruct the function and then resample it

5 09/19/2002 (C) University of Wisconsin 2002, CS 559 Why Signal Processing? Signal processing provides the tools for understanding sampling and reconstruction Sampling: –How do we know how many pixels are required, and where to place them? Reconstruction: –What happens when a monitor converts a set of points into a continuous picture? –How do we enlarge, reduce, rotate, smooth or enhance images? Jaggies, Aliasing –How do we avoid jagged, pixelated lines

6 09/19/2002 (C) University of Wisconsin 2002, CS 559 A Striking Example

7 09/19/2002 (C) University of Wisconsin 2002, CS 559 Periodic Functions Fact: Any periodic signal can be represented as a sum of sine and cosine waves with harmonic frequencies –If one function has frequency f, then its harmonics are function with frequency nf for integer n Sequence of boxes is:

8 09/19/2002 (C) University of Wisconsin 2002, CS 559 Boxes as Sum of Cosines

9 09/19/2002 (C) University of Wisconsin 2002, CS 559 General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function f(x) –The spectrum is how much of each frequency is present in the function –We’re talking about functions, not colors, but the idea is the same

10 09/19/2002 (C) University of Wisconsin 2002, CS 559 Fourier Transform F(  ) is computed from f(x) by the Fourier Transform:

11 09/19/2002 (C) University of Wisconsin 2002, CS 559 Example: Box Function

12 09/19/2002 (C) University of Wisconsin 2002, CS 559 Box Function and Its Transform

13 09/19/2002 (C) University of Wisconsin 2002, CS 559 Cosine and Its Transform 1  If f(x) is even, so is F(  )

14 09/19/2002 (C) University of Wisconsin 2002, CS 559 Sine and Its Transform 1  -- If f(x) is odd, so is F(  )

15 09/19/2002 (C) University of Wisconsin 2002, CS 559 Constant Function and Its Transform The constant function only contains the 0 th frequency – it has no wiggles

16 09/19/2002 (C) University of Wisconsin 2002, CS 559 Delta Function and Its Transform Fourier transform and inverse Fourier transform are qualitatively the same, so knowing one direction gives you the other

17 09/19/2002 (C) University of Wisconsin 2002, CS 559 Shah (Spikes) and Its Transform

18 09/19/2002 (C) University of Wisconsin 2002, CS 559 Gaussian and Its Transform (the same)

19 09/19/2002 (C) University of Wisconsin 2002, CS 559 The spectrum of a functions tells us the relative amounts of high and low frequencies –Sharp edges give high frequencies –Smooth variations give low frequencies A function is bandlimited if its spectrum has no frequencies above a maximum limit –sin, cos are band limited –Box, Gaussian, etc are not Qualitative Properties

20 09/19/2002 (C) University of Wisconsin 2002, CS 559 Functions to Images Images are 2D, discrete functions 2D Fourier transform uses product of sin’s and cos’s (things carry over naturally) Fourier transform of a discrete, quantized function will only contain discrete frequencies in quantized amounts –In particular, we can store the Fourier transform of a discrete image in the same amount of space as we can store the image Numerical algorithm: Fast Fourier Transform (FFT) computes discrete Fourier transforms

21 09/19/2002 (C) University of Wisconsin 2002, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize in the frequency domain, where filtering is defined as multiplication: Here, F is the spectrum of the function, G is the spectrum of the filter, and H is the filtered function. Multiplication is point-wise

22 09/19/2002 (C) University of Wisconsin 2002, CS 559 Qualitative Filters  FG =   = = H Low-pass High-pass Band-pass

23 09/19/2002 (C) University of Wisconsin 2002, CS 559 Low-Pass Filtered Image

24 09/19/2002 (C) University of Wisconsin 2002, CS 559 High-Pass Filtered Image

25 09/19/2002 (C) University of Wisconsin 2002, CS 559 Filtering in the Spatial Domain Filtering the spatial domain is achieved by convolution Qualitatively: Slide the filter to each position, x, then sum up the function multiplied by the filter at that position

26 09/19/2002 (C) University of Wisconsin 2002, CS 559 Convolution Example

27 09/19/2002 (C) University of Wisconsin 2002, CS 559 Convolution Theorem Convolution in the spatial domain is the same as multiplication in the frequency domain –Take a function, f, and compute its Fourier transform, F –Take a filter, g, and compute its Fourier transform, G –Compute H=F  G –Take the inverse Fourier transform of H, to get h –Then h=f  g Multiplication in the spatial domain is the same as convolution in the frequency domain

28 09/19/2002 (C) University of Wisconsin 2002, CS 559 Filtering Images Work in the discrete spatial domain Convert the filter into a matrix, the filter mask Move the matrix over each point in the image, multiply the entries by the pixels below, then sum –eg 3x3 box filter –averages

29 09/19/2002 (C) University of Wisconsin 2002, CS 559 Box Filter Box filters smooth by averaging neighbors In frequency domain, keeps low frequencies and attenuates (reduces) high frequencies, so clearly a low-pass filter Spatial: BoxFrequency: sinc

30 09/19/2002 (C) University of Wisconsin 2002, CS 559 Filtering Algorithm If I input is the input image, and I output is the output image, M is the filter mask and k is the mask size: Care must taken at the boundary –Make the output image smaller –Extend the input image in some way


Download ppt "09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering."

Similar presentations


Ads by Google