Filtering Robert Lin April 29, 2004. Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview.

Slides:



Advertisements
Similar presentations
Computer Vision Lecture 7: The Fourier Transform
Advertisements

3-D Computational Vision CSc Image Processing II - Fourier Transform.
Chap 4 Image Enhancement in the Frequency Domain.
Image Processing Frequency Filtering Instructor: Juyong Zhang
Medical Image Analysis Image Formation Figures come from the textbook: Medical Image Analysis, by Atam P. Dhawan, IEEE Press, 2003.
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Digital Image Processing
Monte Carlo Integration Robert Lin April 20, 2004.
Reminder Fourier Basis: t  [0,1] nZnZ Fourier Series: Fourier Coefficient:
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
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.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CSCE 641 Computer Graphics: Fourier Transform Jinxiang Chai.
CS5520 Image-Based Rendering © Chun-Fa Chang, Spring 2003 Sampling Theorem & Antialiasing April 15, 2003.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 7: Review, Reconstruction Ravi Ramamoorthi
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 6, Fri 10 Oct 2003 sampling.
CPSC 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Computational Photography: Fourier Transform Jinxiang Chai.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Transforms: Basis to Basis Normal Basis Hadamard Basis Basis functions Method to find coefficients (“Transform”) Inverse Transform.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 4 Image Enhancement in the Frequency Domain Chapter.
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
Sampling and Antialiasing CMSC 491/635. Abstract Vector Spaces Addition –C = A + B = B + A –(A + B) + C = A + (B + C) –given A, B, A + X = B for only.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 3 Ravi Ramamoorthi
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
G52IIP, School of Computer Science, University of Nottingham 1 Image Transforms Fourier Transform Basic idea.
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
Presentation Image Filters
Antialiasing CAP4730: Computational Structures in Computer Graphics.
Image Processing © 2002 R. C. Gonzalez & R. E. Woods Lecture 4 Image Enhancement in the Frequency Domain Lecture 4 Image Enhancement.
1 Lecture III Shobhit Niranjan Gaurav Gupta. 2 Convolution Definition: For discrete functions: Properties Commutativity Associativity Distributivity.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Lecture 7: Sampling Review of 2D Fourier Theory We view f(x,y) as a linear combination of complex exponentials that represent plane waves. F(u,v) describes.
ENG4BF3 Medical Image Processing Image Enhancement in Frequency Domain.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the.
Intelligent Vision Systems ENT 496 Image Filtering and Enhancement Hema C.R. Lecture 4.
02/05/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Mach Banding –Humans exaggerate sharp boundaries, but not fuzzy ones.
2D Sampling Goal: Represent a 2D function by a finite set of points.
1 CMPB 345: IMAGE PROCESSING DISCRETE TRANSFORM 2.
Sampling Theorem & Antialiasing
(c) 2002 University of Wisconsin, CS 559
2D Fourier Transform.
Many of the figures from this book may be reproduced free of charge in scholarly articles, proceedings, and presentations, provided only that the following.
Amity School of Engineering & Technology 1 Amity School of Engineering & Technology DIGITAL IMAGE PROCESSING & PATTERN RECOGNITION Credit Units: 4 Mukesh.
Image Enhancement in the Spatial Domain.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Digital Image Processing , 2008
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics
… Sampling … … Filtering … … Reconstruction …
Distributed Ray Tracing
Image Enhancement in the
Sampling Theorem & Antialiasing
(C) 2002 University of Wisconsin, 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.
Fourier Transform.
ENG4BF3 Medical Image Processing
Joshua Barczak CMSC435 UMBC
CSCE 643 Computer Vision: Image Sampling and Filtering
CSCE 643 Computer Vision: Thinking in Frequency
9th Lecture - Image Filters
Distributed Ray Tracing
Lecture 5: Resampling, Compositing, and Filtering Li Zhang Spring 2008
Distributed Ray Tracing
Presentation transcript:

Filtering Robert Lin April 29, 2004

Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview of common filters

Why Filter? Anti-aliasing Signal reconstruction Remove frequencies  Remove which frequencies?  Low-pass filter: removes high frequencies (blurring)  High-pass filter: removes low frequencies (sharpens, enhance edges)  Graphics: usually want low pass filtering to remove aliasing

Image Filtering Modify pixels of an image based on a function of local nearby pixels Filter determines weight of a pixel

Filtering for Sampling Filtering can be used to determine which rays to cast for a particular pixel (e.g., cast more rays near the center) Filtering can also be used to assign weights to the rays that determine how much they contribute to the pixel color

Photon Filtering We can filter the radiance estimate Weight closer photons more when calculating radiance estimate Can reduce blur at sharp edges when photon count is low – good for stuff like caustics

Sampling and Reconstruction Given a signal such as a sine wave with frequency 1 Hz:

Sampling and Reconstruction We can sample the points at a uniform rate of 3 Hz and reconstruct the signal:

Sampling and Reconstruction We can also sample the signal at a slower rate of 2 Hz and still accurately reconstruct the signal:

Sampling and Reconstruction However, if we sample below 2 Hz, we don’t have enough information to reconstruct the signal, and in fact we may construct a different signal:

Nyquist Frequency To reconstruct a signal with frequency f, we need to sample the signal at a rate of at least 2*f, which is the Nyquist Frequency Example  CD : SR = 44,100 Hz  Nyquist Frequency = SR/2 = 22,050

Nyquist Frequency Sampling below the Nyquist frequency can cause aliasing – the reconstructed signal is a false representation of the original signal. We can reduce aliasing by sampling more, or sampling intelligently (last lecture). We can also use filtering to reduce aliasing.

How do you filter? To filter a function f(x), we use a filter function g(x) and convolute f(x) with g(x). This is the same for filtering 2D images, and the functions become functions of x and y.

Convolution The convolution of a function f(x) and a function g(x) (usually a filter function), is defined to be: The value of h(x) at each point is the integral of the product of f(x) with the filter function g(x) flipped about the y axis and shifted so that its origin is at that point This is taking a weighted average of points near f(x), where g(x) defines what the weights are.

Convolution Green curve is the convolution of the Red curve, f(x), and the Blue curve, g(x). The grey region indicates the product g(u) f(t – u) The convolution Is thus the area of the grey region

The Fourier Transform A signal can be expressed as a sum of different sine curves The Fourier Transform determines which sine waves represent the original signal

The Fourier Transform The Fourier Transform F(k) of a function f(x) in spatial domain is defined to be: F(k) is now in frequency domain, usually plotted with the x-axis as frequency, and the y-axis as magnitude.

The Fourier Transform A signal composed of two sine waves with frequency 2 Hz and 50 Hz The Fourier Transform of the signal shows these two frequencies The domain of the graph of the Fourier transform is frequency; the range is magnitude

The Fourier Transform

Space Frequency

The Fourier Transform The convolution of f and g is the same as multiplying the Fourier transforms of f and g: This lets us look at the frequency domain of a filter function to figure out what the filter does.

Frequency Domain  =  = Low-pass High-pass In the frequency domain, multiplying by a filter function removes particular frequencies

Low Pass Filter in Frequency Domain

Low Pass Filter

High Pass Filter

The Sinc Filter Spatial: sincFrequency: box

The Sinc Filter Perfect low-pass filter Cuts off all frequencies above a threshold Oscillates to infinity: need too many samples We use other functions similar to a sinc to filter

The Box Filter Spatial: BoxFrequency: sinc

The Box Filter Smooths out function by averaging neighbors Keeps low frequencies and reduces high frequencies (low-pass filter) Equally weights all samples In frequency domain, contains sidelobes to infinity, which can cause rings on sharp edges

The Tent Filter Spatial: TentFrequency: sinc squared

The Tent Filter Reduces high frequencies more Weights center sample more Other samples weighted linearly

The Gaussian Filter Spatial: GaussianFrequency: Gaussian

The Gaussian Filter Reduces high frequences even more No sharp edges like in box, tent Generally

The B-Spline Filter Each row and column of the image is represented by a B-Spline curve Each pixel is a control point

The B-Spline Filter original L(x,y) = (1 + sin( 0.01*(x*x + y*y))) order 3 order 1 order 2 order 0

The B-Spline Filter Bilinear Bspline

Conclusion Filtering is good Reduces aliasing Makes the picture pretty Very similar to sampling We filter an image by convoluting it with the filter The FT gives information about the filter Try different filters, use the one that looks good

References Books:  Andrew Glassner. Principles of Digital Image Synthesis.  James D. Foley, Andries van Dam, Steven K. Feiner, John F. Hughes. Computer Graphics: Principles and Practice.  Peter Shirley, R. Keith Morley. Realistic Ray Tracing.  Henrik Wann Jensen. Realistic Image Synthesis Using Photon Mapping. Websites:     econstruction-new.pdf  