Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.

Slides:



Advertisements
Similar presentations
CSCE 643 Computer Vision: Template Matching, Image Pyramids and Denoising Jinxiang Chai.
Advertisements

Motion illusion, rotating snakes. Slide credit Fei Fei Li.
15-463: Computational Photography Alexei Efros, CMU, Spring 2010 Most slides from Steve Marschner Sampling and Reconstruction.
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Slides from Alexei Efros
CS 691 Computational Photography
Computational Photography: Sampling + Reconstruction Connelly Barnes Slides from Alexei Efros and Steve Marschner.
Templates, Image Pyramids, and Filter Banks Slides largely from Derek Hoeim, Univ. of Illinois.
Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/06/11.
Computational Photography Prof. Feng Liu Spring /06/2015.
Spatial Filtering Dan Witzner Hansen. Recap Exercises??? Feedback Last lectures?
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
Lecture 2: Edge detection and resampling
Image transformations, Part 2 Prof. Noah Snavely CS1114
Lecture 1: Images and image filtering
Linear filtering. Overview: Linear filtering Linear filters Definition and properties Examples Gaussian smoothing Separability Applications Denoising.
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
15-463: Computational Photography Alexei Efros, CMU, Fall 2011 Many slides from Steve Marschner Sampling and Reconstruction.
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
Lecture 2: Image filtering
Templates, Image Pyramids, and Filter Banks Computer Vision James Hays, Brown Slides: Hoiem and others.
Linear filtering.
CS4670: Computer Vision Kavita Bala Lecture 7: Harris Corner Detection.
Slides from Alexei Efros, Steve Marschner Filters & fourier theory.
Recap from Friday Pinhole camera model Perspective projections Lenses and their flaws Focus Depth of field Focal length and field of view.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
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.
Templates, Image Pyramids, and Filter Banks Computer Vision Derek Hoiem, University of Illinois 01/31/12.
CS 1699: Intro to Computer Vision Texture and Other Uses of Filters Prof. Adriana Kovashka University of Pittsburgh September 10, 2015 Slides from Kristen.
Templates, Image Pyramids, and Filter Banks
Image Resampling CS4670: Computer Vision Noah Snavely.
Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/03/15.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Linear Filters Monday, Jan 24 Prof. Kristen Grauman UT-Austin …
Linear Filters August 27 th 2015 Devi Parikh Virginia Tech 1 Slide credit: Devi Parikh Disclaimer: Many slides have been borrowed from Kristen Grauman,
Image Filtering Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/02/10.
Advanced Multimedia Image Content Analysis Tamara Berg.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
Linear filtering. Motivation: Noise reduction Given a camera and a still scene, how can you reduce noise? Take lots of images and average them! What’s.
CSE 473/573 Computer Vision and Image Processing (CVIP) Ifeoma Nwogu Lecture 7 – Linear Filters 1.
Templates, Image Pyramids, and Filter Banks
Pixels and Image Filtering Computer Vision Derek Hoiem, University of Illinois 02/01/11 Graphic:
CS 691B Computational Photography
Pixels and Image Filtering Computational Photography Derek Hoiem 08/26/10 Graphic:
Lecture 5: Fourier and Pyramids
Reconnaissance d’objets et vision artificielle
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.
CSE 185 Introduction to Computer Vision Image Filtering: Spatial Domain.
Grauman Today: Image Filters Smooth/Sharpen Images... Find edges... Find waldo…
Images and Filters CSEP 576 Ali Farhadi Many slides from Steve Seitz and Larry Zitnick.
Lecture 1: Images and image filtering CS4670/5670: Intro to Computer Vision Noah Snavely Hybrid Images, Oliva et al.,
Recall: Gaussian smoothing/sampling G 1/4 G 1/8 Gaussian 1/2 Solution: filter the image, then subsample Filter size should double for each ½ size reduction.
Slide credit Fei Fei Li.
Prof. Adriana Kovashka University of Pittsburgh September 14, 2016
CS 4501: Introduction to Computer Vision Filtering and Edge Detection
Linear Filters April 6th, 2017
Pixels and Image Filtering
Image Pyramids and Applications
Image gradients and edges
Image gradients and edges April 11th, 2017
More Image Manipulation
Sampling and Reconstruction
Motion illusion, rotating snakes
Linear filtering.
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.
Templates and Image Pyramids
Presentation transcript:

Computational Photography CSE 590 Tamara Berg Filtering & Pyramids

Image filtering Image filtering: compute function of local neighborhood at each position Really important! – Enhance images Denoise, resize, increase contrast, etc. – Extract information from images Texture, edges, distinctive points, etc. – Detect patterns Template matching

Slide credit: David Lowe (UBC) Example: box filter

Credit: S. Seitz Image filtering

Image filtering Credit: S. Seitz

Image filtering Credit: S. Seitz

Image filtering Credit: S. Seitz

Image filtering Credit: S. Seitz

Image filtering Credit: S. Seitz ?

Image filtering Credit: S. Seitz ?

Image filtering Credit: S. Seitz

What does it do? Replaces each pixel with an average of its neighborhood Achieve smoothing effect (remove sharp features) Slide credit: David Lowe (UBC) Box Filter

Smoothing with box filter

Practice with linear filters Original ? Source: D. Lowe

Practice with linear filters Original Filtered (no change) Source: D. Lowe

Practice with linear filters Original ? Source: D. Lowe

Practice with linear filters Original Shifted left By 1 pixel Source: D. Lowe

Practice with linear filters Original ? Source: D. Lowe

Practice with linear filters Original Sharpening filter - Accentuates differences with local average Source: D. Lowe

Sharpening Source: D. Lowe

Characterizing edges An edge is a place of rapid change in the image intensity function image intensity function (along horizontal scanline) first derivative edges correspond to extrema of derivative source: Svetlana Lazebnik

Edge filters Approximations of derivative filters: Source: K. Grauman Convolve filter with image to get edge map

Edge filters Approximations of derivative filters: Source: K. Grauman Respond highly to vertical edges

Edge filters Approximations of derivative filters: Source: K. Grauman Respond highly to horizontal edges

Edges: example source: Svetlana Lazebnik

Gaussian Kernel Constant factor at front makes volume sum to 1 (can be ignored, as we should re-normalize weights to sum to 1 in any case) x 5,  = 1 Source: C. Rasmussen

Example: Smoothing with a Gaussian source: Svetlana Lazebnik

Gaussian filters Remove “high-frequency” components from the image (low-pass filter) – Images become more smooth Convolution with self is another Gaussian – So can smooth with small-width kernel, repeat, and get same result as larger-width kernel would have Separable kernel – Factors into product of two 1D Gaussians Source: K. Grauman

Separability of the Gaussian filter Source: D. Lowe The filter factors into a product of 1D filters:

Practical matters What is the size of the output? MATLAB: imfilter(g, f, shape) – shape = ‘full’: output size is sum of sizes of f and g – shape = ‘same’: output size is same as f – shape = ‘valid’: output size is difference of sizes of f and g f gg gg f gg g g f gg gg full samevalid Source: S. Lazebnik

Practical matters What about near the edge? – the filter window falls off the edge of the image – need to extrapolate – methods: clip filter (black) wrap around copy edge reflect across edge Source: S. Marschner

Practical matters – methods (MATLAB): clip filter (black): imfilter(f, g, 0) wrap around:imfilter(f, g, ‘circular’) copy edge: imfilter(f, g, ‘replicate’) reflect across edge: imfilter(f, g, ‘symmetric’) Source: S. Marschner Q?

Template matching Goal: find in image Main challenge: What is a good similarity or distance measure between two patches? –Correlation –Zero-mean correlation –Sum Square Difference –Normalized Cross Correlation Side by Derek Hoiem

Matching with filters Goal: find in image Method 0: filter the image with eye patch Input Filtered Image What went wrong? f = image g = filter Side by Derek Hoiem

Matching with filters Goal: find in image Method 1: filter the image with zero-mean eye Input Filtered Image (scaled) Thresholded Image True detections False detections mean of f

Matching with filters Goal: find in image Method 2: SSD Input 1- sqrt(SSD) Thresholded Image True detections

Matching with filters Goal: find in image Method 2: SSD Input 1- sqrt(SSD) What’s the potential downside of SSD? Side by Derek Hoiem

Matching with filters Goal: find in image Method 3: Normalized cross-correlation mean image patch mean template Side by Derek Hoiem

Matching with filters Goal: find in image Method 3: Normalized cross-correlation Input Normalized X-Correlation Thresholded Image True detections

Matching with filters Goal: find in image Method 3: Normalized cross-correlation Input Normalized X-Correlation Thresholded Image True detections

Q: What is the best method to use? A: Depends Zero-mean filter: fastest but not a great matcher SSD: next fastest, sensitive to overall intensity Normalized cross-correlation: slowest, invariant to local average intensity and contrast Side by Derek Hoiem

Image half-sizing 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 Slide by Steve Seitz

Image sub-sampling 1/4 (2x zoom) 1/8 (4x zoom) Aliasing! What do we do? 1/2 Slide by Steve Seitz

Anti-aliasing 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 by Derek Hoiem

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 by Derek Hoiem

Gaussian (lowpass) pre-filtering G 1/4 G 1/8 Gaussian 1/2 Solution: filter the image, then subsample Slide by Steve Seitz

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

Compare with... 1/4 (2x zoom) 1/8 (4x zoom) 1/2 Slide by Steve Seitz

Image Pyramids Known as a Gaussian Pyramid [Burt and Adelson, 1983] In computer graphics, a mip map [Williams, 1983] A precursor to wavelet transform Slide by Steve Seitz

A bar in the big images is a hair on the zebra’s nose; in smaller images, a stripe; in the smallest, the animal’s nose Figure from David Forsyth

Coarse-to-fine Image Registration 1.Compute Gaussian pyramid 2.Align with coarse pyramid 3.Successively align with finer pyramids – Search smaller range Why is this faster?

What are pyramids good for? Improve Search –Search over translations Like HW1 Classic coarse-to-fine strategy –Search over scale Template matching E.g. find a face at different scales Pre-computation –Need to access image at different blur levels –Useful for texture mapping at different resolutions (called mip-mapping) –Useful for compositing/blending – coming soon!