Lecture 5: Fourier and Pyramids

Slides:



Advertisements
Similar presentations
CS 691 Computational Photography Instructor: Gianfranco Doretto Frequency Domain.
Advertisements

Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
CS 691 Computational Photography
Computational Photography: Sampling + Reconstruction Connelly Barnes Slides from Alexei Efros and Steve Marschner.
Thinking in Frequency Computer Vision Brown James Hays Slides: Hoiem, Efros, and others.
Computer Vision University of Illinois Derek Hoiem
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.
Lecture 2: Filtering CS4670/5670: Computer Vision Kavita Bala.
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
Edges and Scale Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski – From Sandlot ScienceSandlot.
Lecture 2: Edge detection and resampling
Image transformations, Part 2 Prof. Noah Snavely CS1114
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Image Sampling Moire patterns
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Lecture 1: Images and image filtering
Lecture 3: Edge detection, continued
CSCE 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
CPSC 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Lecture 2: Image filtering
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Linear filtering.
The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall 2008 Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve.
Computational Photography: Fourier Transform Jinxiang Chai.
Slides from Alexei Efros, Steve Marschner Filters & fourier theory.
Image Sampling Moire patterns -
Fourier Analysis : Rendering and Image Processing Alexei Efros.
Image Sampling CSE 455 Ali Farhadi Many slides from Steve Seitz and Larry Zitnick.
CSC589 Introduction to Computer Vision Lecture 9 Sampling, Gaussian Pyramid Bei Xiao.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
CSE 185 Introduction to Computer Vision Image Filtering: Frequency Domain.
Slide credit Fei Fei Li. Image filtering Image filtering: compute function of local neighborhood at each position Really important! – Enhance images.
Applications of Image Filters Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/04/10.
The Frequency Domain Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve Seitz CS194: Image Manipulation & Computational Photography Alexei.
Computer Vision James Hays Thinking in Frequency Computer Vision James Hays Slides: Hoiem, Efros, and others.
Image Resampling CS4670: Computer Vision Noah Snavely.
CSE 185 Introduction to Computer Vision Image Filtering: Frequency Domain.
Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 4: Image Resampling and Reconstruction CS4670: Computer Vision Kavita Bala.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
Recap of Monday linear Filtering convolution differential filters filter types boundary conditions.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Image Processing.
Linear filtering. Motivation: Image denoising How can we reduce noise in a photograph?
Projects Project 1a due this Friday Project 1b will go out on Friday to be done in pairs start looking for a partner now.
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
Lecture 1: Images and image filtering CS4670/5670: Intro to Computer Vision Noah Snavely Hybrid Images, Oliva et al.,
Image Resampling & Interpolation
Computer Vision Brown James Hays 09/16/11 Thinking in Frequency Computer Vision Brown James Hays Slides: Hoiem, Efros, and others.
Many slides from Steve Seitz and Larry Zitnick
Image Sampling Moire patterns
The Frequency Domain : Computational Photography
Image Sampling Moire patterns
More Image Manipulation
CSCE 643 Computer Vision: Image Sampling and Filtering
CSCE 643 Computer Vision: Thinking in Frequency
Samuel Cheng Slide credits: Noah Snavely
Filtering Part 2: Image Sampling
Image Sampling Moire patterns
Oh, no, wait, sorry, I meant, welcome to the implementation of 20th-century science fiction literature, or a small part of it, where we will learn about.
Image Resampling & Interpolation
Resampling.
Samuel Cheng Slide credits: Noah Snavely
Presentation transcript:

Lecture 5: Fourier and Pyramids CS4670/5670: Computer Vision Kavita Bala Lecture 5: Fourier and Pyramids

Announcements PA1-A will be out tonight, due in a week Written part alone Coding part in pairs Monday: numPy lecture

Fourier Transform Given a signal compute (co)sine waves that contribute to signal For each frequency k, contribution of that frequency to signal: X[k] W (angular frequency) = 2 pi f

Fourier Transform Fourier transform stores the magnitude and phase at each frequency Magnitude encodes how much signal there is at a particular frequency Phase encodes spatial information (indirectly) For mathematical convenience, this is often notated in terms of real and complex numbers Amplitude: Phase:

Derivation for Gaussian http://mathworld.wolfram.com/FourierTransformGaussian.html

Mandrill © Kavita Bala, Computer Science, Cornell University

Process Convert to frequency domain Multiply by low pass filter Sample Eliminate high frequencies Sample Reconstruct

Filtering Lost some detail in this process But ensure that you eliminate objectionable high frequency artifacts Have to transform to frequency domain? Expensive Not necessary because of relationship between spatial and frequency domain

The Convolution Theorem The Fourier transform of the convolution of two functions is the product of their Fourier transforms Convolution in spatial domain is equivalent to multiplication in frequency domain!

Don’t multiply in frequency domain Just convolve in spatial domain

http://mathworld.wolfram.com/Convolution.html

Types of Filters Spatial Sine Gaussian Box Sinc Frequency Impulse

Pre-Filtering Ideal is box/pulse in frequency space Sinc in spatial domain But infinite spread

Truncated sinc © Kavita Bala, Computer Science, Cornell University

Gaussian Filter Gaussian is preferred because it is same in frequency and spatial domain Not perfect: attenuates

Mean vs. Gaussian filtering

Gaussian filter Removes “high-frequency” components from the image (low-pass filter) Convolution with self is another Gaussian Convolving twice with Gaussian kernel of width = convolving once with kernel of width * = Linear vs. quadratic in mask size Source: K. Grauman

Gaussian filters = 1 pixel = 5 pixels = 10 pixels = 30 pixels

Image Resampling

Image Scaling This image is too big to fit on the screen. How can we generate a half-sized version? Source: S. Seitz

Image sub-sampling 1/16 1/4 Throw away every other row and column to create a 1/2 size image - called image sub-sampling Source: S. Seitz

Image sub-sampling 1/2 1/4 (2x zoom) 1/16 (4x zoom) Why does this look so crufty? Source: S. Seitz

Image sub-sampling Source: F. Durand

Wagon-wheel effect (See http://www.michaelbach.de/ot/mot_wagonWheel/index.html) Source: L. Zhang

Aliasing Occurs when your sampling rate is not high enough to capture the amount of detail in your image Can give you the wrong signal/image—an alias To do sampling right, need to understand the structure of your signal/image Enter Monsieur Fourier… Source: L. Zhang

Nyquist-Shannon Sampling Theorem When sampling a signal at discrete intervals, the sampling frequency must be  2  fmax fmax = max frequency of the input signal This will allows to reconstruct the original perfectly from the sampled version v v v good bad

Nyquist limit – 2D example Good sampling Bad sampling

Aliasing When downsampling by a factor of two How can we fix this? Original image has frequencies that are too high How can we fix this?

Gaussian pre-filtering Solution: filter the image, then subsample Source: S. Seitz

Subsampling with Gaussian pre-filtering Solution: filter the image, then subsample Source: S. Seitz

Compare with... 1/2 1/4 (2x zoom) 1/8 (4x zoom) Source: S. Seitz

Gaussian pre-filtering Solution: filter the image, then subsample F1 F2 … blur subsample blur subsample F0 H * F1 H *

{ … F0 F0 H * Gaussian pyramid F1 F1 H * F2 blur subsample blur

Gaussian pyramids [Burt and Adelson, 1983] In computer graphics, a mip map [Williams, 1983] Gaussian Pyramids have all sorts of applications in computer vision Source: S. Seitz

The Gaussian Pyramid Low resolution sub-sample blur sub-sample blur High resolution

Gaussian pyramid and stack Source: Forsyth

Memory Usage What is the size of the pyramid? 4/3

The Laplacian Pyramid Gaussian Pyramid Laplacian Pyramid - = - = - =

Laplacian pyramid Source: Forsyth

A. Oliva, A. Torralba, P.G. Schyns, “Hybrid Images,” SIGGRAPH 2006 PA1 (A): Hybrid Images A. Oliva, A. Torralba, P.G. Schyns, “Hybrid Images,” SIGGRAPH 2006 Gaussian Filter Laplacian Filter Source: Hays

Source: Hays Salvador Dali invented Hybrid Images? Salvador Dali “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976 Source: Hays

Source: Hays Salvador Dali invented Hybrid Images? Salvador Dali “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976 Source: Hays

Major uses of image pyramids Compression Object detection Scale search Features Registration Course-to-fine