Frequency Filtering CSC 767

Similar documents
CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Thinking in Frequency

Slow mo guys Saccades.

Recap of Monday. Linear filtering. Be aware of details for filter size, extrapolation, cropping

Why does a lower resolution image still make sense to us? What do we lose? Image:

Fourier Transform and Frequency Domain

Fourier Transform and Frequency Domain

Image pyramids and frequency domain

CSCI 1290: Comp Photo

I Chen Lin, Assistant Professor Dept. of CS, National Chiao Tung University. Computer Vision: 4. Filtering

The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall Many slides borrowed from Steve Seitz

The Frequency Domain, without tears. Many slides borrowed from Steve Seitz

Intelligent Visual Prosthesis

Templates, Image Pyramids, and Filter Banks

CITS 4402 Computer Vision

Computer Vision Lecture 3

Image Filtering, Edges and Image Representation

Subsampling and image pyramids

CS 4495 Computer Vision. Frequency and Fourier Transforms. Aaron Bobick School of Interactive Computing. Frequency and Fourier Transform

Lecture 3: Linear Filters

Additional Pointers. Introduction to Computer Vision. Convolution. Area operations: Linear filtering

The Frequency Domain. Many slides borrowed from Steve Seitz

ECE Digital Image Processing and Introduction to Computer Vision

ECE Digital Image Processing and Introduction to Computer Vision. Outline

Frequency2: Sampling and Aliasing

Lecture 3: Linear Filters

Quality Improves with More Rays

Image Filtering. Slides, adapted from. Steve Seitz and Rick Szeliski, U.Washington

3. Lecture. Fourier Transformation Sampling

Images have structure at various scales

CS Sampling and Aliasing. Analog vs Digital

ECG782: Multidimensional Digital Signal Processing

G52IVG, School of Computer Science, University of Nottingham

Computational Photography

Filtering, Frequency, and Edges

FILTERING IN THE FREQUENCY DOMAIN

Lecture 4 Filtering in the Frequency Domain. Lin ZHANG, PhD School of Software Engineering Tongji University Spring 2016

E2.5 Signals & Linear Systems. Tutorial Sheet 1 Introduction to Signals & Systems (Lectures 1 & 2)

Image Processing /6.865 Frédo Durand A bunch of slides by Bill Freeman (MIT) & Alyosha Efros (CMU)

Linear Operators and Fourier Transform

6.869 Advances in Computer Vision. Bill Freeman, Antonio Torralba and Phillip Isola MIT Oct. 3, 2018

GBS765 Electron microscopy

Computer Problems for Fourier Series and Transforms

ECE Digital Image Processing and Introduction to Computer Vision. Outline

Wavelets. Lecture 28

Lecture 04 Image Filtering

Taking derivative by convolution

Discrete Fourier Transform

Today s lecture. The Fourier transform. Sampling, aliasing, interpolation The Fast Fourier Transform (FFT) algorithm

DISCRETE FOURIER TRANSFORM

Computer Vision Lecture 3

ECG782: Multidimensional Digital Signal Processing

Mathematics for Chemists 2 Lecture 14: Fourier analysis. Fourier series, Fourier transform, DFT/FFT

Image Processing 2. Hakan Bilen University of Edinburgh. Computer Graphics Fall 2017

EE16B - Spring 17 - Lecture 11B Notes 1

SEISMIC WAVE PROPAGATION. Lecture 2: Fourier Analysis

Outline. Convolution. Filtering


Introduction to the Fourier transform. Computer Vision & Digital Image Processing. The Fourier transform (continued) The Fourier transform (continued)

PART 1. Review of DSP. f (t)e iωt dt. F(ω) = f (t) = 1 2π. F(ω)e iωt dω. f (t) F (ω) The Fourier Transform. Fourier Transform.

CS 3710: Visual Recognition Describing Images with Features. Adriana Kovashka Department of Computer Science January 8, 2015

Fourier Series Example

Edges and Scale. Image Features. Detecting edges. Origin of Edges. Solution: smooth first. Effects of noise

Filtering and Edge Detection

Fourier transforms and convolution

Math 56 Homework 5 Michael Downs

Introduction to Computer Vision

Today s lecture. Local neighbourhood processing. The convolution. Removing uncorrelated noise from an image The Fourier transform

There and back again A short trip to Fourier Space. Janet Vonck 23 April 2014

Analysis II: Fourier Series

Transform methods. and its inverse can be used to analyze certain time-dependent PDEs. f(x) sin(sxπ/(n + 1))

Fourier Matching. CS 510 Lecture #7 February 8 th, 2013

We know that f(x, y) and F (u, v) form a Fourier Transform pair, i.e. f(ax, by)e j2π(ux+vy) dx dy. x x. a 0 J = y y. = 0 b

Contents. Signals as functions (1D, 2D)

2A1H Time-Frequency Analysis II Bugs/queries to HT 2011 For hints and answers visit dwm/courses/2tf

Key Intuition: invertibility

Contents. Signals as functions (1D, 2D)

Project IV Fourier Series

Contents. Signals as functions (1D, 2D)

26. The Fourier Transform in optics

Signal Processing COS 323

Module 3 : Sampling and Reconstruction Lecture 22 : Sampling and Reconstruction of Band-Limited Signals

From Fourier Series to Analysis of Non-stationary Signals - II

2A1H Time-Frequency Analysis II

Index. p, lip, 78 8 function, 107 v, 7-8 w, 7-8 i,7-8 sine, 43 Bo,94-96

The Discrete Fourier Transform

3 rd class Mech. Eng. Dept. hamdiahmed.weebly.com Fourier Series

2.2 The derivative as a Function

Frequency Response and Continuous-time Fourier Series

and lim lim 6. The Squeeze Theorem

Introduction to Fourier Analysis Part 2. CS 510 Lecture #7 January 31, 2018

Image Acquisition and Sampling Theory

Visual features: From Fourier to Gabor

Tangent Lines Sec. 2.1, 2.7, & 2.8 (continued)

Correlation, discrete Fourier transforms and the power spectral density

Edge Detection. Computer Vision P. Schrater Spring 2003

Section 6: Summary Section 7

Filtering in the Frequency Domain

encoding without prediction) (Server) Quantization: Initial Data 0, 1, 2, Quantized Data 0, 1, 2, 3, 4, 8, 16, 32, 64, 128, 256

Math 3150 HW 3 Solutions

Transcription:

Frequency Filtering CSC 767

Outline Fourier transform and frequency domain Frequency view of filtering Hybrid images Sampling Slide: Hoiem

Why does the Gaussian give a nice smooth image, but the square filter give edgy artifacts? Gaussian Box filter

Hybrid Images A. Oliva, A. Torralba, P.G. Schyns, Hybrid Images, SIGGRAPH 2006

Fourier Transform 1-D Fourier transform pair Forward transform Inverse transform f(x) is the original signal ˆf() = f(x) = Z 1 1 Z 1 1 f(x)e 2 ix dx ˆf()e 2 ix d ˆf() is representation of f in Fourier space

Fourier Transform Useful identity e ı = cos( )+ı sin( ) Hence Z 1 f(x) = = 1 Z 1 1 ˆf()e 2 ıx d ˆf() (cos(2 x)+ı sin(2 x)) d f(x) is a sum of sine and cosine functions The sine and cos functions have increasing frequencies They are weighted by ˆf()

The building block: A sum of sines Asin(ωx +φ) Add enough of them to get almost any signal g(x) you want g(x) A 0 2 + n X k=1 A k sin(2 kx/p + k ) Slide: J. Hays

Frequency Spectra example : g(t) = sin(2πf t) + (1/3)sin(2π(3f) t) = + Slide: J. Hays Slides: Efros

Frequency Spectra Slide: J. Hays Slides: Efros

Frequency Spectra = + = Slide: J. Hays Slides: Efros

Frequency Spectra = + = Slide: J. Hays Slides: Efros

Frequency Spectra = + = Slide: J. Hays Slides: Efros

Frequency Spectra = + = Slide: J. Hays Slides: Efros

Frequency Spectra = + = Slide: J. Hays Slides: Efros

Frequency Spectra = A k = 1 1 sin(2 π kt ) k Slide: J. Hays Slides: Efros

Example: Music We think of music in terms of frequencies at different L Low frequencies High frequencies Slide: Hoiem

2-D Fourier transforms Discrete 2-D Fourier pair Forward transform Inverse transform F (u, v) = f(x, y) = NX 1 x=0,y=0 NX 1 u=0,v=0 f(x, y)e 2 ı(ux+vy)/n F (u, v)e 2 ı(ux+vy)/n Forward 2-D transform in Matlab >> g = imread('puppy.jpg'); >> g = double(rgb2gray(g)); >> G = fft2(g);

Fourier analysis in images Intensity Image Fourier Image http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering

Signals can be composed + = http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering More: http://www.cs.unm.edu/~brayer/vision/fourier.html

2-D Fourier Transform The 2-D Fourier transform stores the magnitude and phase at each frequency Magnitude encodes how much signal there is at a particular frequency Phase encodes direction information of the image content In Matlab A(u, v) = p Real(G(u, v)) 2 + Imag(G(u, v)) 2 (u, v) = tan 1 Imag(G(u, v)) Real(G(u, v)) >> A = abs(g); >> Phase = atan(imag(g)./real(g)); Slide: J. Hays

Examples of 2-D Fourier representation

Single Letters

Words

License plates

People and Animals

Man-made and natural objects

The Convolution Theorem The Fourier transform of the convolution of two functions is the product of their Fourier transforms g h = X k X F{g h} = F{g}F{h} Convolu;on in spatial domain is equivalent to mul;plica;on in frequency domain ` g(i k, j `)h(k, `) For large filter functions h, convolution via the Fourier transform is a lot faster than computing it in the spatial domain Slide: J. Hays

Filtering in spatial domain 1 2 0 0-1 - 2 1 0-1 * =

Filtering in frequency domain FFT FFT = Inverse FFT Slide: Hoiem

Frequency filtering in Matlab Filtering with fft im = double(imread( '))/255; im = rgb2gray(im); % im should be a gray-scale floating point image [imh, imw] = size(im); hs = 50; % filter half-size fil = fspecial('gaussian', hs*2+1, 10); fftsize = 1024; % should be order of 2 (for speed) and include padding im_fft = fft2(im, fftsize, fftsize); % 1) fft im with padding fil_fft = fft2(fil, fftsize, fftsize); % 2) fft fil, pad to same size as image im_fil_fft = im_fft.* fil_fft; % 3) multiply fft images im_fil = ifft2(im_fil_fft); % 4) inverse fft2 im_fil = im_fil(1+hs:size(im,1)+hs, 1+hs:size(im, 2)+hs); % 5) remove padding Displaying with fft figure(1), imagesc(log(abs(fftshift(im_fft)))), axis image, colormap jet Slide: Hoiem

Filtering Why does the Gaussian give a nice smooth image, but the square filter give edgy artifacts? Gaussian Box filter Slide: J. Hays

Gaussian Slide: J. Hays

Box Filter Slide: J. Hays

Sampling Why does a lower resolution image still make sense to us? What do we lose? Slide: J. Hays Image: http://www.flickr.com/photos/igorms/136916757/

Aliasing problem 1D example (sinewave): Source: S. Marschner

Aliasing problem 1D example (sinewave): Source: S. Marschner

Aliasing problem Sub- sampling may be dangerous. Characteristic errors may appear: Wagon wheels rolling the wrong way in movies Checkerboards disintegrate in ray tracing Striped shirts look funny on color television Source: D. Forsyth

Aliasing in video Slide by Steve Seitz

Aliasing in graphics Source: A. Efros

Sampling and aliasing Slide: J. Hays

Nyquist- Shannon Sampling Theorem When sampling a signal at discrete intervals, the sampling frequency must be 2 f max f max = max frequency of the input signal This will allows to reconstruct the original perfectly from the sampled version v v v good bad Slide: J. Hays

Anti- aliasing Solutions: Sample more often Get rid of all frequencies that are greater than half the new sampling frequency Will lose information But it s better than aliasing Apply a smoothing filter Slide: J. Hays

Algorithm for downsampling by factor of 2 1. Start with image(h, w) 2. Apply low- pass filter im_blur = imfilter(image, fspecial( gaussian, 7, 1)) 3. Sample every other pixel im_small = im_blur(1:2:end, 1:2:end); Slide: J. Hays

Anti- aliasing Forsyth and Ponce 2002

Subsampling without pre- filtering 1/2 1/4 (2x zoom) 1/8 (4x zoom) Slide by Steve Seitz

Subsampling with Gaussian pre- filtering Gaussian 1/2 G 1/4 G 1/8 Slide by Steve Seitz

Things to Remember Sometimes it makes sense to think of images and filtering in the frequency domain Fourier analysis Can be faster to filter using FFT for large images (N logn vs. N 2 for auto- correlation) Images are mostly smooth Basis for compression Remember to low- pass before sampling Slide: J. Hays

Practice question 1. Match the spatial domain image to the Fourier magnitude image 1 2 3 4 5 B A C E D Slide: J. Hays

Credit: Slide set developed by J. Hays, Brown University.