Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/06/11.

Slides:



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

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.
1 Image filtering Hybrid Images, Oliva et al.,
Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao.
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.
(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.
Fourier Analysis Without Tears : Computational Photography Alexei Efros, CMU, Fall 2005 Somewhere in Cinque Terre, May 2005.
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.
Edge Detection Today’s readings Cipolla and Gee –supplemental: Forsyth, chapter 9Forsyth Watt, From Sandlot ScienceSandlot Science.
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
Roger Cheng (JPEG slides courtesy of Brian Bailey) Spring 2007
CS559-Computer Graphics Copyright Stephen Chenney Image File Formats How big is the image? –All files in some way store width and height How is the image.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
Introduction to Image Processing Grass Sky Tree ? ? Review.
Applications of Image Filters Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/04/10.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
Templates, Image Pyramids, and Filter Banks Computer Vision Derek Hoiem, University of Illinois 01/31/12.
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
Recap of Friday linear Filtering convolution differential filters
Klara Nahrstedt Spring 2011
CSC589 Introduction to Computer Vision Lecture 7 Thinking in Frequency Bei Xiao.
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 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 Filtering Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/02/10.
Why is computer vision difficult?
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.
COMP322/S2000/L171 Robot Vision System Major Phases in Robot Vision Systems: A. Data (image) acquisition –Illumination, i.e. lighting consideration –Lenses,
Digital Image Processing Lecture 21: Lossy Compression Prof. Charlene Tsai.
Templates, Image Pyramids, and Filter Banks
Recap of Monday linear Filtering convolution differential filters filter types boundary conditions.
Image as a linear combination of basis images
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.
Linear filtering. Motivation: Image denoising How can we reduce noise in a photograph?
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
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.
Miguel Tavares Coimbra
Sampling, Template Matching and Pyramids
Digital Image Processing Lecture 21: Lossy Compression
Image Pyramids and Applications
Computer Vision Jia-Bin Huang, Virginia Tech
The Frequency Domain : Computational Photography
Sampling and Reconstruction
Motion illusion, rotating snakes
Fourier Analysis Without Tears
Lecture 4 Image Enhancement in Frequency Domain
Review and Importance CS 111.
Convolution.
Templates and Image Pyramids
Presentation transcript:

Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/06/11

Project 1 Due Monday at 11:59pm – Options for displaying results Web interface or redirect ( redirect.html) redirect.html Backup (e.g., project server not working): send me a link – me: expected points, code, link to webpage; no need to images/results Questions? Remember to sign up for bulletin board (if not done already)

Review 1.Match the spatial domain image to the Fourier magnitude image 1 54 A 3 2 C B D E

Today’s class: applications of filtering Template matching Coarse-to-fine alignment – Project 2 Denoising, Compression (as time allows)

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 Input Filtered Image What went wrong? f = image g = filter

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 Can SSD be implemented with linear filters?

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

Matching with filters Goal: find in image Method 3: Normalized cross-correlation Matlab: normxcorr2(template, im) mean image patch mean template

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

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

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

Gaussian pyramid Source: Forsyth

Laplacian filter Gaussian unit impulse Laplacian of Gaussian Source: Lazebnik

Laplacian pyramid Source: Forsyth

Computing Gaussian/Laplacian Pyramid Can we reconstruct the original from the laplacian pyramid?

Hybrid Image in Laplacian Pyramid High frequency  Low frequency Extra points for project 1

Project 2: Image Alignment Try SSD alignment Try normxcorr2 alignment Simple implementation will work for small images But larger images will take forever (well, many hours)

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? Are we guaranteed to get the same result?

Question Can you align the images using the FFT? Implementation is extra points for project 2

How is it that a 4MP image can be compressed to a few hundred KB without a noticeable change? Compression

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 Quantization table Filter responses Quantized values

JPEG Compression Summary 1.Convert image to YCrCb 2.Subsample color by factor of 2 – People have bad resolution for color 3.Split into blocks (8x8, typically), subtract For each block a.Compute DCT coefficients b.Coarsely quantize Many high frequency components will become zero c.Encode (e.g., with Huffman coding)

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

Denoising Additive Gaussian Noise Gaussian Filter

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

Reducing salt-and-pepper noise by Gaussian smoothing 3x35x57x7

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 Source: M. Hebert MATLAB: medfilt2(image, [h w])

Median vs. Gaussian filtering 3x35x57x7 Gaussian Median

Other filter choices 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

Review of Last 3 Days Filtering in spatial domain – Slide filter over image and take dot product at each position – Remember linearity (for linear filters) – Examples 1D: [-1 0 1], [ ] 1D: [ ], [ ] 2D: [1 0 0 ; ; 0 0 1]/4

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

Review of Last 3 Days Derivative of Gaussian

Review of Last 3 Days Filtering in frequency domain – Can be faster than filtering in spatial domain (for large filters) – Can help understand effect of filter – Algorithm: 1.Convert image and filter to fft (fft2 in matlab) 2.Pointwise-multiply ffts 3.Convert result to spatial domain with ifft2

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 Can be used for blending (later) More compact image representation

Review of Last 3 Days Applications of filters – Downsampling Need to sufficiently low-pass before downsampling – Compression In JPEG, coarsely quantize high frequencies – Reducing noise (important for aesthetics and for later processing such as edge detection) Gaussian filter, median filter, bilateral filter

Next class Light and color