1 / 30

Last Time

Last Time. Color Quantization Dithering. Today. Signal processing for graphics Homework 2 is available Project 2 is almost available. Enlarging an Image. To enlarge an image, you have to add pixels between the old pixels What values do you choose for those pixels?.

lynn-vang
Download Presentation

Last Time

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Last Time • Color Quantization • Dithering (C) University of Wisconsin 2002, CS 559

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

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

  4. 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 (C) University of Wisconsin 2002, CS 559

  5. 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 (C) University of Wisconsin 2002, CS 559

  6. A Striking Example (C) University of Wisconsin 2002, CS 559

  7. 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: (C) University of Wisconsin 2002, CS 559

  8. Boxes as Sum of Cosines (C) University of Wisconsin 2002, CS 559

  9. 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 (C) University of Wisconsin 2002, CS 559

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

  11. Example: Box Function (C) University of Wisconsin 2002, CS 559

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

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

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

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

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

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

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

  19. Qualitative Properties • 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 (C) University of Wisconsin 2002, CS 559

  20. 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 (C) University of Wisconsin 2002, CS 559

  21. 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 (C) University of Wisconsin 2002, CS 559

  22. Qualitative Filters F G H Low-pass  = High-pass  = Band-pass  = (C) University of Wisconsin 2002, CS 559

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

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

  25. 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 (C) University of Wisconsin 2002, CS 559

  26. Convolution Example (C) University of Wisconsin 2002, CS 559

  27. 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 (C) University of Wisconsin 2002, CS 559

  28. 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 (C) University of Wisconsin 2002, CS 559

  29. 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: Box Frequency: sinc (C) University of Wisconsin 2002, CS 559

  30. Filtering Algorithm • If Iinput is the input image, and Ioutput 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 (C) University of Wisconsin 2002, CS 559

More Related