Lecture 4: Image Resampling and Reconstruction CS4670: Computer Vision Kavita Bala.

Slides:



Advertisements
Similar presentations
Multiscale Analysis of Images Gilad Lerman Math 5467 (stealing slides from Gonzalez & Woods, and Efros)
Advertisements

Image Interpolation CS4670: Computer Vision Noah Snavely.
The University of Ontario CS 4487/9587 Algorithms for Image Analysis Segmentation (2D) Acknowledgements: Alexei Efros, Steven Seitz.
15-463: Computational Photography Alexei Efros, CMU, Spring 2010 Most slides from Steve Marschner Sampling and Reconstruction.
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Slides from Alexei Efros
CS 691 Computational Photography
Computational Photography: Sampling + Reconstruction Connelly Barnes Slides from Alexei Efros and Steve Marschner.
Active Contours (SNAKES) Back to boundary detection –This time using perceptual grouping. This is non-parametric –We’re not looking for a contour of a.
Lecture 6 Image Segmentation
Lecture 2: Filtering CS4670/5670: Computer Vision Kavita Bala.
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
Edges and Scale Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski – From Sandlot ScienceSandlot.
Recap from Monday Spectra and Color Light capture in cameras and humans.
Lecture 2: Edge detection and resampling
Image transformations, Part 2 Prof. Noah Snavely CS1114
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Image Sampling Moire patterns
Snakes Goes from edges to boundaries. Edge is strong change in intensity. Boundary is boundary of an object. –Smooth (more or less) –Closed. –…
Image Segmentation Today’s Readings Intelligent Scissors, Mortensen et. al, SIGGRAPH 1995Intelligent Scissors From Sandlot ScienceSandlot Science.
Lecture 3: Edge detection, continued
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
Image Segmentation Today’s Readings Forsyth & Ponce, Chapter 14
Announcements Mailing list: –you should have received messages Office hours onlineonline –start next week.
Image Pyramids and Blending : Computational Photography Alexei Efros, CMU, Fall 2005 © Kenneth Kwan.
Segmentation and Clustering Today’s Readings Forsyth & Ponce, Chapter 7 (plus lots of optional references in the slides) From Sandlot ScienceSandlot Science.
Slides from Alexei Efros, Steve Marschner Filters & fourier theory.
Image Sampling Moire patterns -
Image Pyramids and Blending
Image Sampling CSE 455 Ali Farhadi Many slides from Steve Seitz and Larry Zitnick.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
The University of Ontario CS 433/653 Algorithms for Image Analysis Segmentation (2D) Acknowledgements: Alexei Efros, Steven Seitz.
Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 2: Edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Image Resampling CS4670: Computer Vision Noah Snavely.
Intelligent Scissors for Image Composition Anthony Dotterer 01/17/2006.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Edge Detection:
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Image Processing.
Lecture 5: Fourier and Pyramids
Projects Project 1a due this Friday Project 1b will go out on Friday to be done in pairs start looking for a partner now.
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
Cutting Images: Graphs and Boundary Finding Computational Photography Derek Hoiem, University of Illinois 09/20/12 “The Double Secret”, Magritte.
Recall: Gaussian smoothing/sampling G 1/4 G 1/8 Gaussian 1/2 Solution: filter the image, then subsample Filter size should double for each ½ size reduction.
Image Resampling & Interpolation
Cutting Images: Graphs and Boundary Finding
Many slides from Steve Seitz and Larry Zitnick
Announcements CS accounts Project 1 is out today
Image Sampling Moire patterns
CS4670/5670: Image Scissors Noah Snavely Today’s Readings
Image Sampling Moire patterns
Jeremy Bolton, PhD Assistant Teaching Professor
Multiscale Analysis of Images
More Image Manipulation
Announcements Reader is in the BOOK STORE (not Comm Bldg.)
Samuel Cheng Slide credits: Noah Snavely
Image Processing Today’s readings For Monday
Filtering Part 2: Image Sampling
Image Sampling Moire patterns
Announcements Project 1 is out today
Image Resampling & Interpolation
Resampling.
Announcements Project 1 is out today help session at the end of class.
Samuel Cheng Slide credits: Noah Snavely
Presentation transcript:

Lecture 4: Image Resampling and Reconstruction CS4670: Computer Vision Kavita Bala

Announcements PA 1 is out – Due next Thursday Demo info etc. online Prelim March 5 th (Thu)

PA 1

Image Scissors Today’s Readings – Intelligent Scissors, Mortensen et. al, SIGGRAPH 1995 Intelligent Scissors Aging Helen Mirren

Extracting objects How can this be done? – hard to do manually By selecting each pixel on the boundary – hard to do automatically (“image segmentation”) – pretty easy to do semi-automatically

Image Scissors (with demo!)

Intelligent Scissors Approach answers basic question – Q: how to find a path from seed to mouse that follows an object boundary as closely as possible? – A: define a path that stays as close as possible to edges

Intelligent Scissors Basic Idea – Define edge score for each pixel edge pixels have low cost – Find lowest cost path from seed to mouse seed mouse Questions How to define costs? How to find the path?

Let’s look at this more closely Treat the image as a graph Graph node for every pixel p link between every adjacent pair of pixels, p,q cost c for each link Note: each link has a cost this is a little different than the figure before where each pixel had a cost p q c

Defining the costs Want to hug image edges: how to define cost of a link? p q c r s

Defining the costs c can (almost) be computed using a cross-correlation filter assume it is centered at p p q c r s

Defining the costs 1 c can (almost) be computed using a cross-correlation filter assume it is centered at p A couple more modifications Scale the filter response by length of link c. Why? Make c positive –Set c = (max-|filter response|)*length –where max = maximum |filter response| over all pixels in the image p q c r s w 11 x y z

Dijkstra’s shortest path algorithm Algorithm 1.init node costs to , set p = seed point, cost(p) = 0 2.expand p as follows: for each of p’s neighbors q that are not expanded set cost(q) = min( cost(p) + c pq, cost(q) ) link costs

Dijkstra’s shortest path algorithm if q’s cost changed, make q point back to p put q on the ACTIVE list (if not already there) Algorithm 1.init node costs to , set p = seed point, cost(p) = 0 2.expand p as follows: for each of p’s neighbors q that are not expanded set cost(q) = min( cost(p) + c pq, cost(q) )

set r = node with minimum cost on the ACTIVE list 4.repeat Step 2 for p = r Dijkstra’s shortest path algorithm Algorithm 1.init node costs to , set p = seed point, cost(p) = 0 2.expand p as follows: for each of p’s neighbors q that are not expanded set cost(q) = min( cost(p) + c pq, cost(q) ) if q’s cost changed, make q point back to p put q on the ACTIVE list (if not already there)

Dijkstra’s shortest path algorithm 3.set r = node with minimum cost on the ACTIVE list 4.repeat Step 2 for p = r Algorithm 1.init node costs to , set p = seed point, cost(p) = 0 2.expand p as follows: for each of p’s neighbors q that are not expanded set cost(q) = min( cost(p) + c pq, cost(q) ) if q’s cost changed, make q point back to p put q on the ACTIVE list (if not already there)

Dijkstra’s shortest path algorithm Properties – It computes the minimum cost path from the seed to every node in the graph. This set of minimum paths is represented as a tree – Running time, with N pixels: O(N 2 ) time if you use an active list O(N log N) if you use an active priority queue (heap) takes fraction of a second for a typical (640x480) image – Once this tree is computed once, we can extract the optimal path from any point to the seed in O(N) time. it runs in real time as the mouse moves – What happens when the user specifies a new seed?

Example Results Kuan-chuan Peng Le Zhang

Questions?

Image Scaling This image is too big to fit on the screen. How can we generate a half-sized version? Source: S. Seitz

Image sub-sampling 1/4 (2x zoom) 1/16 (4x zoom) Why does this look so crufty? 1/2 Source: S. Seitz

Image sub-sampling Source: F. Durand

What is aliasing? 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 23

Aliasing To avoid aliasing: – sampling rate ≥ 2 * max frequency in the image said another way: ≥ two samples per cycle – This minimum sampling rate is called the Nyquist rate Source: L. Zhang

Nyquist limit – 2D example Good sampling Bad sampling

Aliasing When downsampling by a factor of two – Original image has frequencies that are too high How can we fix this?

Gaussian pre-filtering G 1/4 G 1/8 Gaussian 1/2 Solution: filter the image, then subsample Source: S. Seitz

Subsampling with Gaussian pre-filtering G 1/4G 1/8Gaussian 1/2 Solution: filter the image, then subsample Source: S. Seitz

Compare with... 1/4 (2x zoom) 1/16 (4x zoom) 1/2 Source: S. Seitz

Gaussian pre-filtering Solution: filter the image, then subsample blur F 0 H * * subsample blur subsample … F1F1 F1F1 F 1 H * * F2F2 F2F2 F0F0 F0F0

blur F 0 H * * subsample blur subsample … F1F1 F1F1 F 1 H * * F2F2 F2F2 F0F0 F0F0 { Gaussian pyramid

Gaussian pyramids [Burt and Adelson, 1983] In computer graphics, a mip map [Williams, 1983] A precursor to wavelet transform Gaussian Pyramids have all sorts of applications in computer vision Source: S. Seitz

Gaussian pyramids [Burt and Adelson, 1983] How much space does a Gaussian pyramid take compared to the original image? Source: S. Seitz

Memory Usage What is the size of the pyramid? 34

Gaussian Pyramid

Aside: Laplacian Laplacian: divergence of gradient 0 at edge f h f * h

expand Gaussian Pyramid Laplacian Pyramid The Laplacian Pyramid - = - = - =