Templates and Image Pyramids

Similar documents
Templates and Image Pyramids

Sampling and Reconstruction

Fourier analysis of images

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

Thinking in Frequency

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

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

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

Prof. Feng Liu. Winter /10/2019

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

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

Motion illusion, rotating snakes

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

Thinking in Frequency

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

CSCI 1290: Comp Photo

Vision Review: Image Processing. Course web page:

Last Lecture. photomatix.com

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad

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

Anna University, Chennai B.E./B.TECH DEGREE EXAMINATION, MAY/JUNE 2013 Seventh Semester

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

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

Assistant Lecturer Sama S. Samaan

Sampling and Pyramids

2.1. General Purpose Run Length Encoding Relative Encoding Tokanization or Pattern Substitution

Computing for Engineers in Python

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Images and Filters. EE/CSE 576 Linda Shapiro

Chapter 9 Image Compression Standards

Last Lecture. photomatix.com

Compression and Image Formats

Ch. 3: Image Compression Multimedia Systems

The Strengths and Weaknesses of Different Image Compression Methods. Samuel Teare and Brady Jacobson

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

Image preprocessing in spatial domain

Image Filtering and Gaussian Pyramids

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

Image Forgery. Forgery Detection Using Wavelets

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

Image filtering, image operations. Jana Kosecka

The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D.

SYLLABUS CHAPTER - 2 : INTENSITY TRANSFORMATIONS. Some Basic Intensity Transformation Functions, Histogram Processing.

Hybrid Coding (JPEG) Image Color Transform Preparation

Camera Image Processing Pipeline: Part II

Lossy and Lossless Compression using Various Algorithms

EE482: Digital Signal Processing Applications

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

Camera Image Processing Pipeline: Part II

Computer Vision, Lecture 3

Practical Image and Video Processing Using MATLAB

Digital Image Processing

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

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

Module 6 STILL IMAGE COMPRESSION STANDARDS

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

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

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

PRACTICAL IMAGE AND VIDEO PROCESSING USING MATLAB

image Scanner, digital camera, media, brushes,

Midterm Examination CS 534: Computational Photography

Digital Media. Lecture 4: Bitmapped images: Compression & Convolution Georgia Gwinnett College School of Science and Technology Dr.

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

Computer Graphics. Si Lu. Fall er_graphics.htm 10/02/2015

A COMPARATIVE ANALYSIS OF DCT AND DWT BASED FOR IMAGE COMPRESSION ON FPGA

Filters. Materials from Prof. Klaus Mueller

Computer Vision Lecture 3

Image Enhancement using Histogram Equalization and Spatial Filtering

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

ENEE408G Multimedia Signal Processing

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

OFFSET AND NOISE COMPENSATION

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

Digital Image Processing Question Bank UNIT -I

Information Hiding: Steganography & Steganalysis

Prof. Feng Liu. Fall /02/2018

CPSC 340: Machine Learning and Data Mining. Convolutional Neural Networks Fall 2018

Histograms and Color Balancing

Basic concepts of Digital Watermarking. Prof. Mehul S Raval

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

Digital Image Processing

This content has been downloaded from IOPscience. Please scroll down to see the full text.

DIGITAL IMAGE PROCESSING Quiz exercises preparation for the midterm exam

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

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

Digital Image Processing 3/e

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

VU Signal and Image Processing. Torsten Möller + Hrvoje Bogunović + Raphael Sahann

Teaching Scheme. Credits Assigned (hrs/week) Theory Practical Tutorial Theory Oral & Tutorial Total

Non Linear Image Enhancement

Image Processing Final Test

Image Processing for feature extraction

Prof. Feng Liu. Spring /12/2017

ECE/OPTI533 Digital Image Processing class notes 288 Dr. Robert A. Schowengerdt 2003

2. REVIEW OF LITERATURE

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

Speech Coding in the Frequency Domain

Analysis on Color Filter Array Image Compression Methods

Noise and Restoration of Images

A Comparative Review Paper for Noise Models and Image Restoration Techniques

Transcription:

Templates and Image Pyramids 09/07/17 Computational Photography Derek Hoiem, University of Illinois

Why does a lower resolution image still make sense to us? What do we lose? Image: http://www.flickr.com/photos/igorms/136916757/

Why does a lower resolution image still make sense to us? What do we lose? FFT linear scale + Image: http://www.flickr.com/photos/igorms/136916757/

Why do we get different, distance-dependent interpretations of hybrid images??

Clues from Human Perception Early processing in humans filters for various orientations and scales of frequency Perceptual cues in the mid frequencies dominate perception When we see an image from far away, we are effectively subsampling it Early Visual Processing: Multi-scale edge and blob filters

Hybrid Image in FFT Hybrid Image Low-passed Image High-passed Image

Perception Why do we get different, distance-dependent interpretations of hybrid images??

Reminder Start working on project 1 (due Sept 18) Make sure you can get a project page up Can now complete first part (hybrid images)

Things to Remember Sometimes it makes sense to think of images and filtering in the frequency domain Fourier analysis Can be faster to filter using FFT for large images (N logn vs. N 2 for autocorrelation) Images are mostly smooth Basis for compression Remember to low-pass before sampling

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

Today s class: applications of filtering Template matching Coarse-to-fine alignment 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 h[ m, n] g[ k, l] k, l f [ m k, n l] f = image g = filter What went wrong? Input Filtered Image

Matching with filters Goal: find in image Method 1: filter the image with zero-mean eye h[ m, n] ( f k, l [ 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

Matching with filters Goal: find Method 2: SSD in image 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)

Matching with filters Goal: find in image Method 3: Normalized cross-correlation 0.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 Matlab: normxcorr2(template, im) mean image patch mean template

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

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

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

Gaussian pyramid Source: Forsyth

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

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

Coarse-to-fine Image Registration 1. Compute Gaussian pyramid 2. Align with coarse pyramid Find minimum SSD position 3. Successively align with finer pyramids Search small range (e.g., 5x5) centered around position determined at coarser scale Why is this faster? Are we guaranteed to get the same result?

Question Can you align the images using the FFT?

Compression How is it that a 4MP image can be compressed to a few hundred KB 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 Filter responses Can decode with inverse dct Quantization table 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 128 4. For each block a. Compute DCT coefficients b. Coarsely quantize Many high frequency components will become zero c. Encode (e.g., with Huffman coding) http://en.wikipedia.org/wiki/ycbcr http://en.wikipedia.org/wiki/jpeg

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 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 Filtered Examples http://en.wikipedia.org/wiki/file:medianfilterp.png http://en.wikipedia.org/wiki/file:median_filter_example.jpg

Median vs. Gaussian filtering 3x3 5x5 7x7 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 Image: http://vision.ai.uiuc.edu/?p=1455

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], [0 0 0 0 0.5 1 1 1 0.5 0 0 0] 1D: [0.25 0.5 0.25], [0 0 0 0 0.5 1 1 1 0.5 0 0 0] 2D: [1 0 0 ; 0 2 0 ; 0 0 1]/4

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