Sampling and Reconstruction

Similar documents
Image Filtering and Gaussian Pyramids

Sampling and Reconstruction

Motion illusion, rotating snakes

Motivation: Image denoising. How can we reduce noise in a photograph?

Motivation: Image denoising. How can we reduce noise in a photograph?

Sampling and Reconstruction

Sampling and reconstruction

02/02/10. Image Filtering. Computer Vision CS 543 / ECE 549 University of Illinois. Derek Hoiem

Sampling and reconstruction

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

CS4495/6495 Introduction to Computer Vision. 2C-L3 Aliasing

Templates and Image Pyramids

Sampling and reconstruction. CS 4620 Lecture 13

Templates and Image Pyramids

CSCI 1290: Comp Photo

Fourier analysis of images

Prof. Feng Liu. Winter /10/2019

Sampling and Pyramids

CS6670: Computer Vision Noah Snavely. Administrivia. Administrivia. Reading. Last time: Convolution. Last time: Cross correlation 9/8/2009

>>> from numpy import random as r >>> I = r.rand(256,256);

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

Texture mapping from 0 to infinity

>>> from numpy import random as r >>> I = r.rand(256,256);

Images and Filters. EE/CSE 576 Linda Shapiro

Announcements. Image Processing. What s an image? Images as functions. Image processing. What s a digital image?

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

06: Thinking in Frequencies. CS 5840: Computer Vision Instructor: Jonathan Ventura

Image filtering, image operations. Jana Kosecka

Next Classes. Spatial frequency Fourier transform and frequency domain. Reminder: Textbook. Frequency view of filtering Hybrid images Sampling

Overview. Neighborhood Filters. Dithering

Midterm is on Thursday!

Linear Filters Tues Sept 1 Kristen Grauman UT Austin. Announcements. Plan for today 8/31/2015. Image noise Linear filters. Convolution / correlation

Last Lecture. photomatix.com

More image filtering , , Computational Photography Fall 2017, Lecture 4

Thinking in Frequency

Matlab (see Homework 1: Intro to Matlab) Linear Filters (Reading: 7.1, ) Correlation. Convolution. Linear Filtering (warm-up slide) R ij

Thinking in Frequency

Last Lecture. photomatix.com

CSC 320 H1S CSC320 Exam Study Guide (Last updated: April 2, 2015) Winter 2015

Computer Vision Lecture 3

Image Interpolation. Image Processing

Image Pyramids. Sanja Fidler CSC420: Intro to Image Understanding 1 / 35

Image features: Histograms, Aliasing, Filters, Orientation and HOG. D.A. Forsyth

Image Sampling. Moire patterns. - Source: F. Durand

Image Filtering. Median Filtering

Digital Image Processing

ECE 484 Digital Image Processing Lec 09 - Image Resampling

Image Enhancement II: Neighborhood Operations

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

Vision Review: Image Processing. Course web page:

CS 445 HW#2 Solutions

Computer Graphics (Fall 2011) Outline. CS 184 Guest Lecture: Sampling and Reconstruction Ravi Ramamoorthi

Fourier Transform. Any signal can be expressed as a linear combination of a bunch of sine gratings of different frequency Amplitude Phase

Filip Malmberg 1TD396 fall 2018 Today s lecture

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

Filtering Images in the Spatial Domain Chapter 3b G&W. Ross Whitaker (modified by Guido Gerig) School of Computing University of Utah

Digital Image Processing

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Practical Image and Video Processing Using MATLAB

Capturing Light in man and machine. Some figures from Steve Seitz, Steve Palmer, Paul Debevec, and Gonzalez et al.

Robert Collins CSE486, Penn State. Lecture 3: Linear Operators

Image Filtering. Reading Today s Lecture. Reading for Next Time. What would be the result? Some Questions from Last Lecture

Image preprocessing in spatial domain

Capturing Light in man and machine

Image Processing for feature extraction

Convolution Pyramids. Zeev Farbman, Raanan Fattal and Dani Lischinski SIGGRAPH Asia Conference (2011) Julian Steil. Prof. Dr.

Image Enhancement using Histogram Equalization and Spatial Filtering

Filtering in the spatial domain (Spatial Filtering)

Midterm Examination CS 534: Computational Photography

Image analysis. CS/CME/BIOPHYS/BMI 279 Fall 2015 Ron Dror

Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

ELEC Dr Reji Mathew Electrical Engineering UNSW

EE482: Digital Signal Processing Applications

Midterm Review. Image Processing CSE 166 Lecture 10

Non Linear Image Enhancement

Filters. Materials from Prof. Klaus Mueller

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

Part I Feature Extraction (1) Image Enhancement. CSc I6716 Spring Local, meaningful, detectable parts of the image.

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

Lec 05 - Linear Filtering & Edge Detection

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

Analysis of the SUSAN Structure-Preserving Noise-Reduction Algorithm

TIRF, geometric operators

Subband coring for image noise reduction. Edward H. Adelson Internal Report, RCA David Sarnoff Research Center, Nov

Image Enhancement in spatial domain. Digital Image Processing GW Chapter 3 from Section (pag 110) Part 2: Filtering in spatial domain

Circular averaging filter (pillbox) Approximates the two-dimensional Laplacian operator. Laplacian of Gaussian filter

Sampling Theory. CS5625 Lecture Steve Marschner. Cornell CS5625 Spring 2016 Lecture 7

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Lecture 2: Color, Filtering & Edges. Slides: S. Lazebnik, S. Seitz, W. Freeman, F. Durand, D. Forsyth, D. Lowe, B. Wandell, S.Palmer, K.

Numerical Derivatives See also T&V, Appendix A.2 Gradient = vector of partial derivatives of image I(x,y) = [di(x,y)/dx, di(x,y)/dy]

Computer Graphics Fundamentals

Introduction. Computer Vision. CSc I6716 Fall Part I. Image Enhancement. Zhigang Zhu, City College of New York

Digital Image Processing 3/e

ELEC Dr Reji Mathew Electrical Engineering UNSW

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

CIS581: Computer Vision and Computational Photography Homework: Cameras and Convolution Due: Sept. 14, 2017 at 3:00 pm

Tonemapping and bilateral filtering

The Camera : Computational Photography Alexei Efros, CMU, Fall 2005

Transcription:

Sampling and Reconstruction Many slides from Steve Marschner 15-463: Computational Photography Alexei Efros, CMU, Fall 211

Sampling and Reconstruction

Sampled representations How to store and compute with continuous functions? Common scheme for representation: samples write down the function s values at many points [FvDFH fig.14.14b / Wolberg] 26 Steve Marschner 3

Reconstruction Making samples back into a continuous function for output (need realizable method) for analysis or processing (need mathematical method) amounts to guessing what the function did in between [FvDFH fig.14.14b / Wolberg] 26 Steve Marschner 4

1D Example: Audio low frequencies high

Sampling in digital audio Recording: sound to analog to samples to disc Playback: disc to samples to analog to sound again how can we be sure we are filling in the gaps correctly? 26 Steve Marschner 6

Sampling and Reconstruction Simple example: a sign wave 26 Steve Marschner 7

Undersampling What if we missed things between the samples? Simple example: undersampling a sine wave unsurprising result: information is lost 26 Steve Marschner 8

Undersampling What if we missed things between the samples? Simple example: undersampling a sine wave unsurprising result: information is lost surprising result: indistinguishable from lower frequency 26 Steve Marschner 9

Undersampling What if we missed things between the samples? Simple example: undersampling a sine wave unsurprising result: information is lost surprising result: indistinguishable from lower frequency also was always indistinguishable from higher frequencies aliasing: signals traveling in disguise as other frequencies 26 Steve Marschner 1

Aliasing in video Slide by Steve Seitz

Aliasing in images

What s happening? Input signal: Plot as image: x = :.5:5; imagesc(sin((2.^x).*x)) Alias! Not enough samples

Antialiasing What can we do about aliasing? Sample more often Join the Mega-Pixel craze of the photo industry But this can t go on forever Make the signal less wiggly Get rid of some high frequencies Will loose information But it s better than aliasing

Preventing aliasing Introduce lowpass filters: remove high frequencies leaving only safe, low frequencies choose lowest frequency in reconstruction (disambiguate) 26 Steve Marschner 15

Linear filtering: a key idea Transformations on signals; e.g.: bass/treble controls on stereo blurring/sharpening operations in image editing smoothing/noise reduction in tracking Key properties linearity: filter(f + g) = filter(f) + filter(g) shift invariance: behavior invariant to shifting the input delaying an audio signal sliding an image around Can be modeled mathematically by convolution 26 Steve Marschner 16

Moving Average basic idea: define a new function by averaging over a sliding window a simple example to start off: smoothing 26 Steve Marschner 17

Weighted Moving Average Can add weights to our moving average Weights [,, 1, 1, 1, 1, 1,, ] / 5 26 Steve Marschner 18

Weighted Moving Average bell curve (gaussian-like) weights [, 1, 4, 6, 4, 1, ] 26 Steve Marschner 19

Moving Average In 2D What are the weights H? 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 Slide 26 by Steve Seitz Marschner 2

Cross-correlation filtering Let s write this down as an equation. Assume the averaging window is (2k+1)x(2k+1): We can generalize this idea by allowing different weights for different neighboring pixels: This is called a cross-correlation operation and written: H is called the filter, kernel, or mask. Slide 26 by Steve Seitz Marschner 21

Gaussian filtering A Gaussian kernel gives less weight to pixels further from the center of the window 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 2 1 2 4 2 1 2 1 This kernel is an approximation of a Gaussian function: 22 Slide by Steve Seitz

Mean vs. Gaussian filtering 23 Slide by Steve Seitz

Convolution 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? Slide by Steve Seitz

Convolution is nice! Notation: Convolution is a multiplication-like operation commutative associative distributes over addition scalars factor out identity: unit impulse e = [,,, 1,,, ] Conceptually no distinction between filter and signal Usefulness of associativity often apply several filters one after another: (((a * b 1 ) * b 2 ) * b 3 ) this is equivalent to applying one filter: a * (b 1 * b 2 * b 3 ) 26 Steve Marschner 25

Tricks with convolutions =

Practice with linear filters 1? Original Source: D. Lowe

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

Practice with linear filters 1? Original Source: D. Lowe

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

Other filters 1 2 1 Sobel -1-2 -1 Vertical Edge (absolute value)

Other filters Q? 1-1 2-2 Sobel 1-1 Horizontal Edge (absolute value)

Important filter: Gaussian Weight contributions of neighboring pixels by nearness.3.13.22.13.3.13.59.97.59.13.22.97.159.97.22.13.59.97.59.13.3.13.22.13.3 5 x 5, σ= 1 Slide credit: Christopher Rasmussen

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 Convolving two times with Gaussian kernel of width σ is same as convolving once with kernel of width σ 2 Source: K. Grauman

Practical matters How big should the filter be? Values at edges should be near zero Rule of thumb for Gaussian: set filter half-width to about 3 σ Side by Derek Hoiem

Practical matters What is the size of the output? MATLAB: filter2(g, f, shape) or conv2(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 g full same valid g g g g g f f f g g g g g g 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 Q? methods (MATLAB): clip filter (black): imfilter(f, g, ) wrap around: imfilter(f, g, circular ) copy edge: imfilter(f, g, replicate ) reflect across edge: imfilter(f, g, symmetric ) Source: S. Marschner

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 : filter the image with eye patch h[ m, n] = k, l g[ k, l] f [ m + k, n + l] f = image g = filter What went wrong? Input Filtered Image Side by Derek Hoiem

Matching with filters Goal: find in image Method 1: filter the image with zero-mean eye h[ m, n] = k, l ( f [ k, l] f ) ( g[ m + k, n + l]) mean of f True detections False detections Input Filtered Image (scaled) Thresholded Image

Matching with filters Goal: find in image Method 2: SSD = h[ m, n] ( g[ k, l] f [ m + k, n + l]) k, l 2 True detections Input 1- sqrt(ssd) Thresholded Image

Matching with filters Can SSD be implemented with linear filters? = h[ m, n] ( g[ k, l] f [ m + k, n + l]) k, l 2 Side by Derek Hoiem

Matching with filters Goal: find in image Method 2: SSD = h[ m, n] ( g[ k, l] f [ m + k, n + l]) k, l What s the potential downside of SSD? 2 Input 1- sqrt(ssd) Side by Derek Hoiem

Matching with filters Goal: find in image Method 3: Normalized cross-correlation.5, 2,, 2,, ) ], [ ( ) ], [ ( ) ], [ )( ], [ ( ], [ + + + + = l k m n l k m n l k f l n k m f g l k g f l n k m f g l k g m n h mean image patch mean template Side by Derek Hoiem

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

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

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 halfsized version?

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

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

Gaussian (lowpass) pre-filtering G 1/8 G 1/4 Gaussian 1/2 Solution: filter the image, then subsample Filter size should double for each ½ size reduction. Why? Slide by Steve Seitz

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

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

Gaussian (lowpass) pre-filtering G 1/8 G 1/4 Gaussian 1/2 Solution: filter the image, then subsample Filter size should double for each ½ size reduction. Why? How can we speed this up? 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

What are they good for? Improve Search Search over translations Like project 1 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)

Gaussian pyramid construction filter mask Repeat Filter Subsample Until minimum resolution reached can specify desired number of levels (e.g., 3-level pyramid) The whole pyramid is only 4/3 the size of the original image! Slide by Steve Seitz

Denoising Gaussian Filter Additive Gaussian Noise

Reducing Gaussian noise Smoothing with larger standard deviations suppresses noise, but also blurs the image Source: S. Lazebnik

Reducing salt-and-pepper noise by Gaussian smoothing 3x3 5x5 7x7

Alternative idea: Median filtering A median filter operates over a window by selecting the median intensity in the window Is median filtering linear? Source: K. Grauman

Median filter What advantage does median filtering have over Gaussian filtering? Robustness to outliers Source: K. Grauman

Median filter Salt-and-pepper noise Median filtered MATLAB: medfilt2(image, [h w]) Source: M. Hebert

Median vs. Gaussian filtering 3x3 5x5 7x7 Gaussian Median