CSCI 1290: Comp Photo

Similar documents
Intelligent Visual Prosthesis

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

Slow mo guys Saccades.

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

Thinking in Frequency

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

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

The Frequency Domain. Many slides borrowed from Steve Seitz

Filtering, Frequency, and Edges

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

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

Image Filtering, Edges and Image Representation

Frequency Filtering CSC 767

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

ECE Digital Image Processing and Introduction to Computer Vision. Outline

Fourier Transform and Frequency Domain

Fourier Transform and Frequency Domain

Image pyramids and frequency domain

Frequency2: Sampling and Aliasing

Fourier Transform in Image Processing. CS/BIOEN 6640 U of Utah Guido Gerig (slides modified from Marcel Prastawa 2012)

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

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

Dr. David A. Clifton Group Leader Computational Health Informatics (CHI) Lab Lecturer in Engineering Science, Balliol College

6.003: Signals and Systems. Sampling and Quantization

Images have structure at various scales

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

SYDE 575: Introduction to Image Processing. Image Compression Part 2: Variable-rate compression

Objective: Reduction of data redundancy. Coding redundancy Interpixel redundancy Psychovisual redundancy Fall LIST 2

Fast Fourier Transform

Overview. Analog capturing device (camera, microphone) PCM encoded or raw signal ( wav, bmp, ) A/D CONVERTER. Compressed bit stream (mp3, jpg, )

Multimedia Networking ECE 599

ESE 250: Digital Audio Basics. Week 4 February 5, The Frequency Domain. ESE Spring'13 DeHon, Kod, Kadric, Wilson-Shah

Key Intuition: invertibility

Lecture 5. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

Computer Vision Lecture 3

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

Image Compression. Fundamentals: Coding redundancy. The gray level histogram of an image can reveal a great deal of information about the image

L. Yaroslavsky. Fundamentals of Digital Image Processing. Course

Multiscale Image Transforms

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

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

Linear Operators and Fourier Transform

CITS 4402 Computer Vision

ECG782: Multidimensional Digital Signal Processing

Multimedia & Computer Visualization. Exercise #5. JPEG compression

Image Data Compression

Digital Image Processing

Templates, Image Pyramids, and Filter Banks

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

Spatial Vision: Primary Visual Cortex (Chapter 3, part 1)

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


Lecture 3: Linear Filters

Subsampling and image pyramids

Introduction to Signal Processing

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

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

Signal Processing COS 323

Lecture 3: Linear Filters

EE 367 / CS 448I Computational Imaging and Display Notes: Image Deconvolution (lecture 6)

PHYSICS - CLUTCH CH 01: UNITS & VECTORS.

Computational Photography

Frequency Response and Continuous-time Fourier Series

IMAGE COMPRESSION-II. Week IX. 03/6/2003 Image Compression-II 1

Fourier Series and Recent Developments in Analysis

Wavelets and Multiresolution Processing

Chapter 4 Discrete Fourier Transform (DFT) And Signal Spectrum

Fourier Transform. sin(n# x)), where! = 2" / L and

Transform coding - topics. Principle of block-wise transform coding

Math 56 Homework 5 Michael Downs

EA2.3 - Electronics 2 1

CS168: The Modern Algorithmic Toolbox Lecture #11: The Fourier Transform and Convolution

Source Coding for Compression

Wavelets. Lecture 28

3. Lecture. Fourier Transformation Sampling

repetition, part ii Ole-Johan Skrede INF Digital Image Processing

Chapter 17: Fourier Series

MITOCW MITRES_6-007S11lec09_300k.mp4

ECG782: Multidimensional Digital Signal Processing

GBS765 Electron microscopy

Compressing a 1D Discrete Signal

Discrete Fourier Transform

Sequences and Series

Visual features: From Fourier to Gabor

Wavelet Analysis of Print Defects

Introduction to the Mathematics of Medical Imaging

(Refer Slide Time: 01:30)

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

Objectives List. Important Students should expect test questions that require a synthesis of these objectives.

Review of Linear Systems Theory

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

Inverse Problems in Image Processing

Geometric Modeling Summer Semester 2012 Linear Algebra & Function Spaces

The Australia Telescope. The Australia Telescope National Facility. Why is it a National Facility? Who uses the AT? Ray Norris CSIRO ATNF

Signal Processing With Wavelets

Math Practice Exam 3 - solutions

Name: INSERT YOUR NAME HERE. Due to dropbox by 6pm PDT, Wednesday, December 14, 2011

ECE Digital Image Processing and Introduction to Computer Vision

Introduction to Fourier Analysis. CS 510 Lecture #5 February 2 nd 2015

Fourier Series & The Fourier Transform

Transcription:

CSCI 1290: Comp Photo Fall 2018 @ Brown University James Tompkin Many slides thanks to James Hays old CS 129 course, along with all of its acknowledgements.

Capture Frequency - Rolling `Shutter James Hays

Image Pyramids Project 1 function: vis_hybrid_image.m Wikipedia Image Pyramids

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

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

Why do we get different, distance-dependent interpretations of hybrid images?? Slide: Hoiem

I understand frequency as in waves but how does this relate to the complex signals we see in natural images? to image frequency?

Fourier Series & Fourier Transforms Another way of thinking about frequency

Fourier series A bold idea (1807): Any univariate function can be rewritten as a weighted sum of sines and cosines of different frequencies. Jean Baptiste Joseph Fourier (1768-1830) Hays

Fourier series A bold idea (1807): Any univariate function can be rewritten as a weighted sum of sines and cosines of different frequencies. Our building block: Asin( t) + B cos( t) Add enough of them to get any signal g(t) you want! Hays

Time and Frequency example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)

Time and Frequency example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t) = +

Frequency Spectra example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t) = +

Square wave spectra

Square wave spectra = + =

Square wave spectra = + =

Square wave spectra = + =

Square wave spectra = + =

Square wave spectra = + =

Coefficient Square wave spectra = 1 A f sin(2πft) f=1

Frequency Spectra

Jean Baptiste Joseph Fourier (1768-1830) A bold idea (1807): Any univariate function can be rewritten as a weighted sum of sines and cosines of different frequencies. Don t believe it? Neither did Lagrange, Laplace, Poisson and other big wigs Not translated into English until 1878! But it s (mostly) true! Called Fourier Series There are some subtle restrictions...the manner in which the author arrives at these equations is not exempt of difficulties and...his analysis to integrate them still leaves something to be desired on the score of generality and even rigour. Laplace Lagrange Legendre Hays

Wikipedia Fourier transform

Sine/cosine and circle sin t cos t Wikipedia Unit Circle

Square wave (approx.) Mehmet E. Yavuz

Sawtooth wave (approx.) Mehmet E. Yavuz

One series in each of x and y Generative Art, じゃがりきん, Video, 2018

Example: Music We think of music in terms of frequencies at different magnitudes Slide: Hoiem

Coefficient Spatial domain Frequency Frequency domain

Fourier analysis in images Spatial domain images Fourier decomposition frequency amplitude images http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering More: http://www.cs.unm.edu/~brayer/vision/fourier.html

Signals can be composed Spatial domain images + = Fourier decomposition frequency amplitude images http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering More: http://www.cs.unm.edu/~brayer/vision/fourier.html

Natural image Natural image Fourier decomposition Frequency coefficients (amplitude) What does it mean to be at pixel x,y? What does it mean to be more or less bright in the Fourier decomposition image?

Can change spectrum, then reconstruct

Low and High Pass filtering

Brian Pauw demo Live Fourier decomposition images Using FFT2 function I hacked it a bit for MATLAB http://www.lookingatnothing.com/index.php/archives/991

Think-Pair-Share Match the spatial domain image to the Fourier magnitude image 1 2 3 4 5 B A C D E Hoiem

Fourier Bases Teases away fast vs. slow changes in the image. Blue = sine Green = cosine This change of basis is the Fourier Transform Hays

Basis reconstruction Danny Alexander

Fourier Transform Stores the amplitude and phase at each frequency: For mathematical convenience, this is often notated in terms of real and complex numbers Related by Euler s formula Hays

Fourier Transform Stores the amplitude and phase at each frequency: For mathematical convenience, this is often notated in terms of real and complex numbers Related by Euler s formula Hays

Fourier Transform Stores the amplitude and phase at each frequency: For mathematical convenience, this is often notated in terms of real and complex numbers Related by Euler s formula Amplitude encodes how much signal there is at a particular frequency: A = Re( 2 ) + Im( ) 2 Phase encodes spatial information (indirectly): = tan 1 Im( ) Re( ) Hays

Amplitude / Phase Amplitude tells you how much Phase tells you where Translate the image? Amplitude unchanged Adds a constant to the phase. Morse

What about phase? Efros

What about phase? Amplitude Phase Efros

What about phase? Efros

What about phase? Amplitude Phase Efros

John Brayer, Uni. New Mexico We generally do not display PHASE images because most people who see them shortly thereafter succumb to hallucinogenics or end up in a Tibetan monastery. https://www.cs.unm.edu/~brayer/vision/fourier.html

Think-Pair-Share In Fourier space, where is more of the information that we see in the visual world? Amplitude Phase

Cheebra Zebra phase, cheetah amplitude Cheetah phase, zebra amplitude Efros

The frequency amplitude of natural images are quite similar Heavy in low frequencies, falling off in high frequencies Will any image be like that, or is it a property of the world we live in? Most information in the image is carried in the phase, not the amplitude Not quite clear why Efros

What is the relationship to phase in audio? In audio perception, frequency is important but phase is not. In visual perception, both are important.??? : (

Hays Salvador Dali Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln, 1976

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

Properties of Fourier Transforms Linearity F[ ax ( t) + by( t)] = a F[ x( t)] + b F[ y( t)] Fourier transform of a real signal is symmetric about the origin The energy of the signal is the same as the energy of its Fourier transform See Szeliski Book (3.4)

The Convolution Theorem The Fourier transform of the convolution of two functions is the product of their Fourier transforms F[ g h] = F[ g]f[ h] Convolution in spatial domain is equivalent to multiplication in frequency domain! g * h = F 1 [F[ g]f[ h]] Hays

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

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

Now we can edit frequencies!

Low and High Pass filtering

Removing frequency bands Brayer

High pass filtering + orientation

Low-pass, Band-pass, High-pass filters low-pass: High-pass / band-pass:

Application: Hybrid Images When we see an image from far away, we are effectively subsampling it! A. Oliva, A. Torralba, P.G. Schyns, SIGGRAPH 2006

Hybrid Image in FFT Hybrid Image Low-passed Image High-passed Image

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

coefficient Why do we have those lines in the image? Sharp edges in the image need _all_ frequencies to represent them. = A k = 1 1 sin(2 kt ) k Efros

Box filter / sinc filter duality Hays What is the spatial representation of the hard cutoff (box) in the frequency domain? http://madebyevan.com/dft/

Evan Wallace demo Made for CS123 1D example Forbes 30 under 30 Figma (collaborative design tools) http://madebyevan.com/dft/ with Dylan Field

Box filter / sinc filter duality Hays What is the spatial representation of the hard cutoff (box) in the frequency domain? http://madebyevan.com/dft/ Box filter Sinc filter sinc(x) = sin(x) / x Spatial Domain Frequency Domain Frequency Domain Spatial Domain

Box filter (spatial) Frequency domain magnitude

Gaussian filter duality Fourier transform of one Gaussian is another Gaussian (with inverse variance). Why is this useful? Smooth degradation in frequency components No sharp cut-off No negative values Never zero (infinite extent) Box filter (spatial) Frequency domain magnitude Gaussian filter (spatial) Frequency domain magnitude

Is convolution invertible? If convolution is just multiplication in the Fourier domain, isn t deconvolution just division? Sometimes, it clearly is invertible (e.g. a convolution with an identity filter) In one case, it clearly isn t invertible (e.g. convolution with an all zero filter) What about for common filters like a Gaussian?

Convolution * = FFT FFT ifft.x = Hays

Deconvolution? ifft FFT FFT =./ Hays

But under more realistic conditions Random noise,.000001 magnitude ifft FFT FFT =./ Hays

But under more realistic conditions Random noise,.0001 magnitude ifft FFT FFT =./ Hays

But under more realistic conditions Random noise,.001 magnitude ifft FFT FFT =./ Hays

But you can t invert multiplication by 0! A Gaussian is only zero at infinity Hays

Deconvolution is hard. Active research area. Even if you know the filter (non-blind deconvolution), it is still hard and requires strong regularization to counteract noise. If you don t know the filter (blind deconvolution), then it is harder still.

How would math have changed if the onesie had been invented?!?! : ( Hays

A few questions If we have infinite frequencies, why does the image end? Sampling theory. Frequencies higher than Nyquist frequency end up falling on an existing sample. i.e., they are aliases for existing samples! Nyquist frequency is half the sampling frequency. (Nyquist frequency is not Nyquist-Shannon rate, which is sampling required to reconstruct aliasfree signal. Both are derived from same theory.)

A few questions Why is frequency decomposition centered in middle, and duplicated and rotated? From Euler: cos(x) + i sin(x) = e ix cos ωt = 1 2 e iωt + e +iωt Coefficients for negative frequencies (i.e., backwards traveling waves) FFT of a real signal is conjugate symmetric i.e., f(-x) = f*(x)

A few questions How is the Fourier decomposition computed? Intuitively, by correlating the signal with a set of waves of increasing signal! Notes in hidden slides. Plus: http://research.stowersinstitute.org/efg/report/fourieranalysis.pdf

Applications of Fourier analysis Fast filtering with large kernels Fourier Optics Fraunhofer diffraction is Fourier transform of slit in the far field. Light spectrometry for astronomy Circular aperture = Airy disc diffraction pattern Wikipedia for graphics

Thinking in Frequency - Compression How is it that a 4MP image can be compressed to a few hundred KB without a noticeable change?

Lossy Image Compression (JPEG) 8x8 blocks 8x8 blocks The first coefficient B(0,0) is the DC component, the average intensity The top-left coeffs represent low frequencies, the bottom right represent high frequencies Block-based Discrete Cosine Transform (DCT) Slides: Efros

Image compression using DCT Compute DCT filter responses in each 8x8 block Filter responses Quantize to integer (div. by magic number; round) More coarsely for high frequencies (which also tend to have smaller values) Many quantized high frequency values will be zero Quantization divisers (element-wise) Quantized values

JPEG Encoding Entropy coding (Huffman-variant) Quantized values Linearize B like this. Helps compression: - We throw away the high frequencies ( 0 ). - The zig zag pattern increases in frequency space, so long runs of zeros.

JPEG compression comparison 89k 12k

James Hays Color spaces: YCbCr Fast to compute, good for compression, used by TV Y=0 Y=0.5 Y (Cb=0.5,Cr=0.5) Cr Cb Y=1 Cb (Y=0.5,Cr=0.5) Cr (Y=0.5,Cb=05)

Most JPEG images & videos subsample chroma

JPEG Compression Summary 1. Convert image to YCrCb 2. Subsample color by factor of 2 People have bad resolution for color 3. Split into blocks (8x8, typically), subtract 128 4. For each block a. Compute DCT coefficients b. Coarsely quantize Many high frequency components will become zero c. Encode (with run length encoding and then Huffman coding for leftovers) http://en.wikipedia.org/wiki/ycbcr http://en.wikipedia.org/wiki/jpeg

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 autocorrelation) Images are mostly smooth Basis for compression Remember to low-pass before sampling