Templates, Image Pyramids, and Filter Banks

Slides:



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

CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 4 – Digital Image Representation Klara Nahrstedt Spring 2009.
Lecture 2: Convolution and edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Spatial Filtering (Chapter 3)
Motion illusion, rotating snakes. Slide credit Fei Fei Li.
Multiscale Analysis of Images Gilad Lerman Math 5467 (stealing slides from Gonzalez & Woods, and Efros)
CS 691 Computational Photography
CS 4487/9587 Algorithms for Image Analysis
Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.
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.
Lecture 4 Edge Detection
1 Image filtering Hybrid Images, Oliva et al.,
Computer Vision - A Modern Approach
1 Image Filtering Readings: Ch 5: 5.4, 5.5, 5.6,5.7.3, 5.8 (This lecture does not follow the book.) Images by Pawan SinhaPawan Sinha formal terminology.
Linear filters and edges. Linear Filters General process: Form new image whose pixels are a weighted sum of original pixel values, using the same set.
(1) Feature-point matching by D.J.Duff for CompVis Online: Feature Point Matching Detection, Extraction.
Texture Reading: Chapter 9 (skip 9.4) Key issue: How do we represent texture? Topics: –Texture segmentation –Texture-based matching –Texture synthesis.
15-463: Computational Photography Alexei Efros, CMU, Fall 2011 Many slides from Steve Marschner Sampling and Reconstruction.
Introduction to Computer Vision CS / ECE 181B Thursday, April 22, 2004  Edge detection (HO #5)  HW#3 due, next week  No office hours today.
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 2: Image filtering
Templates, Image Pyramids, and Filter Banks Computer Vision James Hays, Brown Slides: Hoiem and others.
Linear filtering.
The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall 2008 Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve.
1 Image filtering Hybrid Images, Oliva et al.,
Computational Photography: Image Processing Jinxiang Chai.
Chapter 2. Image Analysis. Image Analysis Domains Frequency Domain Spatial Domain.
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.
Edge Detection Computer Vision (CS 543 / ECE 549) University of Illinois Derek Hoiem 02/02/12 Many slides from Lana Lazebnik, Steve Seitz, David Forsyth,
Local invariant features Cordelia Schmid INRIA, Grenoble.
CS 1699: Intro to Computer Vision Texture and Other Uses of Filters Prof. Adriana Kovashka University of Pittsburgh September 10, 2015 Slides from Kristen.
Image Processing Xuejin Chen Ref:
DCT cs195g: Computational Photography James Hays, Brown, Spring 2010 Somewhere in Cinque Terre, May 2005 Slides from Alexei Efros.
Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/03/15.
Image Processing Edge detection Filtering: Noise suppresion.
AdeptSight Image Processing Tools Lee Haney January 21, 2010.
Image Filtering Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/02/10.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
Chapter 5: Neighborhood Processing
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.
G52IIP, School of Computer Science, University of Nottingham 1 G52IIP 2011 Summary Topic 1 Overview of the course Related topics Image processing Computer.
Templates, Image Pyramids, and Filter Banks
Recap of Monday linear Filtering convolution differential filters filter types boundary conditions.
Edges.
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.
CS 691B Computational Photography
CSE 6367 Computer Vision Image Operations and Filtering “You cannot teach a man anything, you can only help him find it within himself.” ― Galileo GalileiGalileo.
Pixels and Image Filtering Computational Photography Derek Hoiem 08/26/10 Graphic:
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 4 – Audio and Digital Image Representation Klara Nahrstedt Spring 2010.
Linear filtering. Motivation: Image denoising How can we reduce noise in a photograph?
CSE 185 Introduction to Computer Vision Image Filtering: Spatial Domain.
Finding Boundaries Computer Vision CS 143, Brown James Hays 09/28/11 Many slides from Lana Lazebnik, Steve Seitz, David Forsyth, David Lowe, Fei-Fei Li,
Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels.
Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.
Image Filtering in Spatial domain
Miguel Tavares Coimbra
Prof. Adriana Kovashka University of Pittsburgh September 14, 2016
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
Sampling, Template Matching and Pyramids
Image Pyramids and Applications
Image gradients and edges
Computer Vision Jia-Bin Huang, Virginia Tech
Sampling and Reconstruction
Motion illusion, rotating snakes
Review and Importance CS 111.
Templates and Image Pyramids
Presentation transcript:

Templates, Image Pyramids, and Filter Banks 02/03/15 Computer Vision Derek Hoiem, University of Illinois

Review: filtering in spatial domain -1 1 -2 2 * =

Review: filtering in frequency domain FFT FFT = Inverse FFT

Review Low Frequencies Strong Vertical Frequency (Sharp Horizontal Edge) Diagonal Frequencies Strong Horz. Frequency (Sharp Vert. Edge) Log Magnitude Low Frequencies

Today’s class Template matching Image Pyramids Filter banks and texture Denoising, Compression

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

Matching with filters Goal: find in image Method 0: filter the image with eye patch f = image g = filter Problem: response is stronger for higher intensity What went wrong? Input Filtered Image

Matching with filters Goal: find in image Method 1: filter the image with zero-mean eye mean of template g True detections Likes bright pixels where filters are above average, dark pixels where filters are below average. Problems: response is sensitive to gain/contrast, pixels in filter that are near the mean have little effect, does not require pixel values in image to be near or proportional to values in filter. False detections Input Filtered Image (scaled) Thresholded Image

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

Matching with filters Can SSD be implemented with linear filters?

What’s the potential downside of SSD? Matching with filters What’s the potential downside of SSD? Goal: find in image Method 2: SSD Problem: SSD sensitive to average intensity Input 1- sqrt(SSD)

Matching with filters Goal: find in image Method 3: Normalized cross-correlation mean template mean image patch Invariant to mean and scale of intensity Matlab: normxcorr2(template, im)

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

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

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

Q: What if we want to find larger or smaller eyes? A: Image Pyramid

Low-Pass Filtered Image Review of Sampling Gaussian Filter Sample Image Low-Pass Filtered Image Low-Res Image

Gaussian pyramid Source: Forsyth

Template Matching with Image Pyramids Input: Image, Template Match template at current scale Downsample image In practice, scale step of 1.1 to 1.2 Repeat 1-2 until image is very small Take responses above some threshold, perhaps with non-maxima suppression

Laplacian filter unit impulse Gaussian Laplacian of Gaussian Source: Lazebnik

Laplacian pyramid Source: Forsyth

Computing Gaussian/Laplacian Pyramid Can we reconstruct the original from the laplacian pyramid? http://sepwww.stanford.edu/~morgan/texturematch/paper_html/node3.html

Creating the Gaussian/Laplacian Pyramid Image = G1 Smooth, then downsample G2 Downsample (Smooth(G1)) Downsample (Smooth(G2)) G3 … GN = LN G1 - Smooth(Upsample(G2)) L1 L2 L3 G3 - Smooth(Upsample(G4)) G2 - Smooth(Upsample(G3)) Use same filter for smoothing in each step (e.g., Gaussian with 𝜎=2) Downsample/upsample with “nearest” interpolation

Hybrid Image

Hybrid Image in Laplacian Pyramid High frequency  Low frequency

Reconstructing image from Laplacian pyramid L1 + Smooth(Upsample(G2)) G2 = L2 + Smooth(Upsample(G3)) G3 = L3 + Smooth(Upsample(L4)) L4 L1 L2 L3 Use same filter for smoothing as in desconstruction Upsample with “nearest” interpolation Reconstruction will be lossless

Major uses of image pyramids Compression Object detection Scale search Features Detecting stable interest points Registration Course-to-fine

Coarse-to-fine Image Registration Compute Gaussian pyramid Align with coarse pyramid Successively align with finer pyramids Search smaller range Why is this faster? Are we guaranteed to get the same result?

Image representation Pixels: great for spatial resolution, poor access to frequency Fourier transform: great for frequency, not for spatial info Pyramids/filter banks: balance between spatial and frequency information

Application: Representing Texture Source: Forsyth

Texture and Material http://www-cvr.ai.uiuc.edu/ponce_grp/data/texture_database/samples/

Texture and Orientation http://www-cvr.ai.uiuc.edu/ponce_grp/data/texture_database/samples/

Texture and Scale http://www-cvr.ai.uiuc.edu/ponce_grp/data/texture_database/samples/

What is texture? Regular or stochastic patterns caused by bumps, grooves, and/or markings

How can we represent texture? Compute responses of blobs and edges at various orientations and scales

Overcomplete representation: filter banks LM Filter Bank Code for filter banks: www.robots.ox.ac.uk/~vgg/research/texclass/filters.html

Filter banks Process image with each filter and keep responses (or squared/abs responses)

How can we represent texture? Measure responses of blobs and edges at various orientations and scales Idea 1: Record simple statistics (e.g., mean, std.) of absolute filter responses

Can you match the texture to the response? Filters A B 1 2 C 3 Mean abs responses

Representing texture by mean abs response Filters Mean abs responses

Representing texture Idea 2: take vectors of filter responses at each pixel and cluster them, then take histograms (more on this in coming weeks)

Compression How is it that a 4MP image (12000KB) can be compressed to 400KB without a noticeable change?

Lossy Image Compression (JPEG) Block-based Discrete Cosine Transform (DCT) Slides: Efros

Using DCT in JPEG The first coefficient B(0,0) is the DC component, the average intensity The top-left coeffs represent low frequencies, the bottom right – high frequencies

Image compression using DCT Quantize More coarsely for high frequencies (which also tend to have smaller values) Many quantized high frequency values will be zero Encode Can decode with inverse dct Filter responses Quantization table Quantized values

JPEG Compression Summary Convert image to YCrCb Subsample color by factor of 2 People have bad resolution for color Split into blocks (8x8, typically), subtract 128 For each block Compute DCT coefficients Coarsely quantize Many high frequency components will become zero Encode (e.g., with Huffman coding) http://en.wikipedia.org/wiki/YCbCr http://en.wikipedia.org/wiki/JPEG

Lossless compression (PNG) Predict that a pixel’s value based on its upper-left neighborhood Store difference of predicted and actual value Pkzip it (DEFLATE algorithm)

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 What’s wrong with these results?

Alternative idea: Median filtering A median filter operates over a window by selecting the median intensity in the window Better at salt’n’pepper noise Not convolution: try a region with 1’s and a 2, and then 1’s and a 3 Is median filtering linear? Source: K. Grauman

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

Salt-and-pepper noise 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

Other non-linear filters Weighted median (pixels further from center count less) Clipped mean (average, ignoring few brightest and darkest pixels) Bilateral filtering (weight by spatial distance and intensity difference) Bilateral filtering Image: http://vision.ai.uiuc.edu/?p=1455

Bilateral filters Edge preserving: weights similar pixels more Original Gaussian Bilateral spatial similarity (e.g., intensity) Carlo Tomasi, Roberto Manduchi, Bilateral Filtering for Gray and Color Images, ICCV, 1998.

Review of last three days

Review: Image filtering 1 90 90 ones, divide by 9 Credit: S. Seitz

Image filtering 1 90 90 10 ones, divide by 9 Credit: S. Seitz

Image filtering 1 90 90 10 20 ones, divide by 9 Credit: S. Seitz

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

Filtering in frequency domain FFT FFT = Inverse FFT

Review of Last 3 Days Linear filters for basic processing Edge filter (high-pass) Gaussian filter (low-pass) [-1 1] Gaussian FFT of Gradient Filter FFT of Gaussian

Review of Last 3 Days Derivative of Gaussian

Review of Last 3 Days Applications of filters Template matching (SSD or Normxcorr2) SSD can be done with linear filters, is sensitive to overall intensity Gaussian pyramid Coarse-to-fine search, multi-scale detection Laplacian pyramid More compact image representation Can be used for compositing in graphics

Review of Last 3 Days Applications of filters Downsampling Compression Need to sufficiently low-pass before downsampling Compression In JPEG, coarsely quantize high frequencies

Summary Applications of filters Template matching (SSD or Normxcorr2) SSD can be done with linear filters, is sensitive to overall intensity Gaussian pyramid Coarse-to-fine search, multi-scale detection Laplacian pyramid More compact image representation Can be used for compositing in graphics Compression In JPEG, coarsely quantize high frequencies Filter banks for representing texture Denoising

Next class: edge detection