Convolution, Edge Detection, Sampling 15-463: Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.

Slides:



Advertisements
Similar presentations
Image Processing. Overview ImagesPixel Filters Neighborhood Filters Dithering.
Advertisements

Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Computational Photography: Sampling + Reconstruction Connelly Barnes Slides from Alexei Efros and Steve Marschner.
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.
1 Image filtering Hybrid Images, Oliva et al.,
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
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.
Recap from Monday Spectra and Color Light capture in cameras and humans.
Lecture 2: Edge detection and resampling
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.
Image transformations, Part 2 Prof. Noah Snavely CS1114
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Image Sampling Moire patterns
Edge Detection Today’s reading Forsyth, chapters 8, 15.1
Lecture 3: Edge detection, continued
CSCE 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
1 Image filtering
The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall 2011 Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve.
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
Convolution and Edge Detection : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz.
CPSC 641 Computer Graphics: Fourier Transform Jinxiang Chai.
1 Images and Transformations Images by Pawan SinhaPawan Sinha.
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.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
Computational Photography lecture 5 – filtering and frequencies CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30 – 11:50am.
Applications of Image Filters Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/04/10.
Recap of Friday linear Filtering convolution differential filters
Image Resampling CS4670: Computer Vision Noah Snavely.
Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection From Sandlot ScienceSandlot Science.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski, Ch 4.1.2, From Sandlot.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Instructor: S. Narasimhan
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
CS559: Computer Graphics Lecture 4: Compositing and Resampling Li Zhang Spring 2008.
The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall 2010 Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve.
Recap of Monday linear Filtering convolution differential filters filter types boundary conditions.
Image as a linear combination of basis images
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Image Processing.
Lecture 5: Fourier and Pyramids
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.
Image Resampling & Interpolation
Many slides from Steve Seitz and Larry Zitnick
Image Sampling Moire patterns
Gonzalez & Woods, and Efros)
Fourier Transform Analytic geometry gives a coordinate system for describing geometric objects. Fourier transform gives a coordinate system for functions.
The Frequency Domain : Computational Photography
Recap from Wednesday Spectra and Color Light capture in cameras and humans.
Image Sampling Moire patterns
More Image Manipulation
CSCE 643 Computer Vision: Thinking in Frequency
Samuel Cheng Slide credits: Noah Snavely
Filtering Part 2: Image Sampling
Image Sampling Moire patterns
Image Resampling & Interpolation
Resampling.
Samuel Cheng Slide credits: Noah Snavely
Presentation transcript:

Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz

Fourier spectrum

Fun and games with spectra

4 Gaussian filtering A Gaussian kernel gives less weight to pixels further from the center of the window This kernel is an approximation of a Gaussian function:

Convolution Remember cross-correlation: A convolution operation is a cross-correlation where the filter is flipped both horizontally and vertically before being applied to the image: It is written: Suppose H is a Gaussian or mean kernel. How does convolution differ from cross-correlation?

The Convolution Theorem The greatest thing since sliced (banana) bread! The Fourier transform of the convolution of two functions is the product of their Fourier transforms The inverse Fourier transform of the product of two Fourier transforms is the convolution of the two inverse Fourier transforms Convolution in spatial domain is equivalent to multiplication in frequency domain!

Fourier Transform pairs

2D convolution theorem example * f(x,y)f(x,y) h(x,y)h(x,y) g(x,y)g(x,y) |F(s x,s y )| |H(s x,s y )| |G(s x,s y )|

Low-pass, Band-pass, High-pass filters low-pass: band-pass: what’s high-pass?

Edges in images

Image gradient The gradient of an image: The gradient points in the direction of most rapid change in intensity The gradient direction is given by: how does this relate to the direction of the edge? The edge strength is given by the gradient magnitude

Effects of noise Consider a single row or column of the image Plotting intensity as a function of position gives a signal Where is the edge? How to compute a derivative?

Where is the edge? Solution: smooth first Look for peaks in

Derivative theorem of convolution This saves us one operation:

Laplacian of Gaussian Consider Laplacian of Gaussian operator Where is the edge?Zero-crossings of bottom graph

2D edge detection filters is the Laplacian operator: Laplacian of Gaussian Gaussianderivative of Gaussian

MATLAB demo g = fspecial('gaussian',15,2); imagesc(g) surfl(g) gclown = conv2(clown,g,'same'); imagesc(conv2(clown,[-1 1],'same')); imagesc(conv2(gclown,[-1 1],'same')); dx = conv2(g,[-1 1],'same'); imagesc(conv2(clown,dx,'same')); lg = fspecial('log',15,2); lclown = conv2(clown,lg,'same'); imagesc(lclown) imagesc(clown +.2*lclown)

Image Scaling This image is too big to fit on the screen. How can we reduce it? How to generate a half- sized version?

Image sub-sampling Throw away every other row and column to create a 1/2 size image - called image sub-sampling 1/4 1/8

Image sub-sampling 1/4 (2x zoom) 1/8 (4x zoom) Why does this look so crufty? 1/2

Even worse for synthetic images

Really bad in video

Alias: n., an assumed name Picket fence receding Into the distance will produce aliasing… Input signal: x = 0:.05:5; imagesc(sin((2.^x).*x)) Matlab output: WHY? Aj-aj-aj: Alias! Not enough samples

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 Where can it happen in images? During image synthesis: sampling continous singal into discrete signal e.g. ray tracing, line drawing, function plotting, etc. During image processing: resampling discrete signal at a different rate e.g. Image warping, zooming in, zooming out, etc. To do sampling right, need to understand the structure of your signal/image Enter Monsieur Fourier…

Fourier transform pairs

Sampling w Spatial domainFrequency domain 1/w sampling pattern sampled signal

Reconstruction Frequency domain 1/w w Spatial domain sinc function reconstructed signal

What happens when the sampling rate is too low?

Nyquist Rate What’s the minimum Sampling Rate 1/w to get rid of overlaps? Frequency domain 1/w w Spatial domain sinc function Sampling Rate ≥ 2 * max frequency in the image this is known as the Nyquist Rate

Antialiasing What can be done? Sampling rate ≥ 2 * max frequency in the image 1.Raise sampling rate by oversampling Sample at k times the resolution continuous signal: easy discrete signal: need to interpolate 2. Lower the max frequency by prefiltering Smooth the signal enough Works on discrete signals 3. Improve sampling quality with better sampling Nyquist is best case! Stratified sampling (jittering) Importance sampling (salaries in Seattle) Relies on domain knowledge

Sampling Good sampling: Sample often or, Sample wisely Bad sampling: see aliasing in action!

Gaussian pre-filtering G 1/4 G 1/8 Gaussian 1/2 Solution: filter the image, then subsample

Subsampling with Gaussian pre-filtering G 1/4G 1/8Gaussian 1/2 Solution: filter the image, then subsample

Compare with... 1/4 (2x zoom) 1/8 (4x zoom) 1/2