Image Filtering and Gaussian Pyramids

Similar documents
Sampling and Reconstruction

Sampling and Reconstruction

Sampling and Reconstruction

Sampling and reconstruction

Sampling and reconstruction

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

Motion illusion, rotating snakes

Sampling and reconstruction. CS 4620 Lecture 13

Sampling and Pyramids

CSCI 1290: Comp Photo

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

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

Images and Filters. EE/CSE 576 Linda Shapiro

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

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

Texture mapping from 0 to infinity

Prof. Feng Liu. Winter /10/2019

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

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

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

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);

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

Fourier analysis of images

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

Image filtering, image operations. Jana Kosecka

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

Overview. Neighborhood Filters. Dithering

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

Last Lecture. photomatix.com

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

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

Last Lecture. photomatix.com

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

Image Interpolation. Image Processing

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

Midterm is on Thursday!

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

Thinking in Frequency

Templates and Image Pyramids

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

Templates and Image Pyramids

ECE 484 Digital Image Processing Lec 09 - Image Resampling

Filters. Materials from Prof. Klaus Mueller

Image Filtering. Median Filtering

Vision Review: Image Processing. Course web page:

Thinking in Frequency

Image Enhancement II: Neighborhood Operations

Digital Image Processing

Lec 05 - Linear Filtering & Edge Detection

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

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

Midterm Examination CS 534: Computational Photography

Aliasing and Antialiasing. What is Aliasing? What is Aliasing? What is Aliasing?

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

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

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Computer Vision Lecture 3

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

ELEC Dr Reji Mathew Electrical Engineering UNSW

Image Enhancement using Histogram Equalization and Spatial Filtering

Image Processing. Image Processing. What is an Image? Image Resolution. Overview. Sources of Error. Filtering Blur Detect edges

Filip Malmberg 1TD396 fall 2018 Today s lecture

Digital Image Processing

Understanding Matrices to Perform Basic Image Processing on Digital Images

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

CS 445 HW#2 Solutions

Lec 04: Image Filtering and Edge Features

1.Discuss the frequency domain techniques of image enhancement in detail.

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

קורס גרפיקה ממוחשבת 2008 סמסטר ב' Image Processing 1 חלק מהשקפים מעובדים משקפים של פרדו דוראנד, טומס פנקהאוסר ודניאל כהן-אור

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

ELEC Dr Reji Mathew Electrical Engineering UNSW

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

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

Image Processing for feature extraction

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

Convolutional Networks Overview

Image Processing. What is an image? קורס גרפיקה ממוחשבת 2008 סמסטר ב' Converting to digital form. Sampling and Reconstruction.

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

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

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

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

Computer Vision, Lecture 3

EE482: Digital Signal Processing Applications

Introduction to DSP ECE-S352 Fall Quarter 2000 Matlab Project 1

CAP 5415 Computer Vision. Marshall Tappen Fall Lecture 1

Filters. Motivating Example. Tracking a fly, oh my! Moving Weighted Average Filter. General Picture

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

Image processing for gesture recognition: from theory to practice. Michela Goffredo University Roma TRE

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

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. Digital Image Fundamentals II 12 th June, 2017

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

Computer Graphics Fundamentals

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

Understanding Digital Signal Processing

Enhanced Sample Rate Mode Measurement Precision

ACM Fast Image Convolutions. by: Wojciech Jarosz

Image Processing Computer Graphics I Lecture 20. Display Color Models Filters Dithering Image Compression

Transcription:

Image Filtering and Gaussian Pyramids CS94: Image Manipulation & Computational Photography Alexei Efros, UC Berkeley, Fall 27

Limitations of Point Processing Q: What happens if I reshuffle all pixels within the image? A: It s histogram won t change. No point processing will be affected

What is an image? We can think of an image as a function, f, from R 2 to R: f( x, y ) gives the intensity at position ( x, y ) Realistically, we expect the image only to be defined over a rectangle, with a finite range: f: [a,b]x[c,d] [,] A color image is just three functions pasted together. We can write this as a vector-valued function: rxy (, ) f( xy, ) = gxy (, ) bxy (, )

Images as functions

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.4.4b / Wolberg] 26 Steve Marschner 6

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.4.4b / Wolberg] 26 Steve Marschner 7

D 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 9

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

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

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 2

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 3

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 8

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 9

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

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

Cross-correlation Let be the image, be the kernel (of size 2k+ x 2k+), and be the output image This is called a cross-correlation operation: Can think of as a dot product between local neighborhood and kernel for each pixel

In 2D: box filter h[, ] Slide credit: David Lowe (UBC)

Image filtering h[, ] f [.,.] g[.,.] 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 g[ m, n] = h[ k, l] k, l f [ m + k, n + l] Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 9 9 9 9 9 g[ m, n] = h[ k, l] k, l f [ m + k, n + l] Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 2 9 9 9 9 9 Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 2 3 9 9 9 9 9 Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 2 3 3 9 9 9 9 9 Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 2 3 3 9 9 9 9? 9 Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 2 3 3 9 9 9 9? 5 9 Credit: S. Seitz

Image filtering h[, ] f [.,.] g[.,.] 2 3 3 3 2 2 4 6 6 6 4 2 3 6 9 9 9 6 3 3 5 8 8 9 6 3 9 9 9 9 3 5 8 8 9 6 3 2 3 5 5 6 4 2 2 3 3 3 3 2 9 g[ m, n] = h[ k, l] k, l f [ m + k, n + l] Credit: S. Seitz

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

Linear filters: examples = Original Blur (with a mean filter) Source: D. Lowe

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 pixel Source: D. Lowe

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

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

Back to the box filter

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

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

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

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

Mean vs. Gaussian filtering 47 Slide by Steve Seitz

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

Gaussian Kernel σ = 2 with 3 x 3 kernel σ = 5 with 3 x 3 kernel Standard deviation σ: determines extent of smoothing 49 Source: K. Grauman

Gaussian filters = pixel = 5 pixels = pixels = 3 pixels

Choosing kernel width The Gaussian function has infinite support, but discrete filters use finite kernels 5 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 σ 52 Side by Derek Hoiem

Cross-correlation vs. 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: Convolution is commutative and associative Slide by Steve Seitz

Convolution Adapted from F. Durand

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

Gaussian and convolution Removes high-frequency components from the image (low-pass filter) Convolution with self is another Gaussian * = Convolving twice with Gaussian kernel of width = convolving once with kernel of width Source: K. Grauman

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 /8 /4 Throw away every other row and column to create a /2 size image - called image sub-sampling Slide by Steve Seitz

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

Sampling an image Examples of GOOD sampling

Undersampling Examples of BAD sampling -> Aliasing

Gaussian (lowpass) pre-filtering G /8 G /4 Gaussian /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 /2 G /4 G /8 Slide by Steve Seitz

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

Gaussian (lowpass) pre-filtering G /8 G /4 Gaussian /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, 983] In computer graphics, a mip map [Williams, 983] 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

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

What are they good for? Improve Search Search over translations Classic coarse-to-fine strategy Search over scale Template matching E.g. find a face at different scales