Interpolation Prof. Noah Snavely CS1114

Slides:



Advertisements
Similar presentations
Graph algorithms Prof. Noah Snavely CS1114
Advertisements

Image Interpolation CS4670: Computer Vision Noah Snavely.
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
Polygons and the convex hull Prof. Noah Snavely CS1114
Sorting and selection – Part 2 Prof. Noah Snavely CS1114
Machine Learning Week 2 Lecture 2.
Clustering and greedy algorithms — Part 2 Prof. Noah Snavely CS1114
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
Contents Description of the big picture Theoretical background on this work The Algorithm Examples.
Image transformations, Part 2 Prof. Noah Snavely CS1114
Computer Science 335 Data Compression.
Lecture 3: Edge detection, continued
Finding Red Pixels – Part 2 Prof. Noah Snavely CS1114
Feature-based object recognition Prof. Noah Snavely CS1114
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
Robustness and speed Prof. Noah Snavely CS1114
Finding Red Pixels – Part 1 Prof. Noah Snavely CS1114
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
Polygons and the convex hull Prof. Noah Snavely CS1114
Matlab Tutorial Continued Files, functions and images.
Clustering and greedy algorithms Prof. Noah Snavely CS1114
File Formats The most common image file formats, the most important for cameras, printing, scanning, and internet use, are JPG, TIF, PNG, and GIF.
Robust fitting Prof. Noah Snavely CS1114
CS448f: Image Processing For Photography and Vision Wavelets Continued.
Interpolation, extrapolation, etc. Prof. Ramin Zabih
COMP Bitmapped and Vector Graphics Pages Using Qwizdom.
Chapter 3: Image Restoration Geometric Transforms.
Lab #5-6 Follow-Up: More Python; Images Images ● A signal (e.g. sound, temperature infrared sensor reading) is a single (one- dimensional) quantity that.
Voronoi diagrams and applications Prof. Ramin Zabih
Chapter 11 Fluency with Information Technology 4 th edition by Lawrence Snyder (slides by Deborah Woodall : 1.
Computer Graphics Texture Mapping
Data Representation CS280 – 09/13/05. Binary (from a Hacker’s dictionary) A base-2 numbering system with only two digits, 0 and 1, which is perfectly.
Image Resampling CS4670: Computer Vision Noah Snavely.
7/11/20081 Today’s Agenda Friday 6 th Nov Revision of certain topics Floating point notation Excess Notation Exam format Interim Report.
Image Resampling CS4670: Computer Vision Noah Snavely.
Image Representation. Objectives  Bitmaps: resolution, colour depth and simple bitmap file calculations.  Vector graphics: drawing list – objects and.
Digital Image Processing Lecture 6: Image Geometry
Still-image compression Moving-image compression and File types.
Image segmentation Prof. Noah Snavely CS1114
Interpolation Prof. Noah Snavely CS1114
Medians and blobs Prof. Ramin Zabih
Robustness and speed Prof. Noah Snavely CS1114
Finding Red Pixels – Part 1 Prof. Noah Snavely CS1114
Clustering Prof. Ramin Zabih
Finding Red Pixels – Part 2 Prof. Noah Snavely CS1114
Sorting and selection – Part 2 Prof. Noah Snavely CS1114
Digital Imaging. Introduction Digital Imaging is used every day in life. Has become less expensive and easier to use than film.
Problem Set 2 Reconstructing a Simpler World COS429 Computer Vision Due October (one week from today)13 th.
Optimization and least squares Prof. Noah Snavely CS1114
Convex hulls in 3D Maciej Kot. Finding convex hull Given a set of points, find a convex hull that contains all of them and is minimal.
Recognizing objects Prof. Noah Snavely CS1114
Or, how to make it all fit! DIGITAL VIDEO FILES AND COMPRESSION STANDARDS.
Image Resampling & Interpolation
Vocabulary byte - The technical term for 8 bits of data.
Algorithms in the Real World
Digital 2D Image Basic Masaki Hayashi
Computational Photography Derek Hoiem, University of Illinois
Vocabulary byte - The technical term for 8 bits of data.
Lecture 7: Image alignment
Image transformations
Image transformations
Resolution and Printing Tips
COMS E F15 Lecture 2: Median trick + Chernoff, Distinct Count, Impossibility Results Left to the title, a presenter can insert his/her own image.
Representing Images 2.6 – Data Representation.
Quickselect Prof. Noah Snavely CS1114
Image Resampling & Interpolation
Resampling.
Getting to the bottom, fast
Sorting and selection Prof. Noah Snavely CS1114
Presentation transcript:

Interpolation Prof. Noah Snavely CS1114

Administrivia  Assignment 3 due tomorrow by 5pm –Please sign up for a demo slot  Assignment 4 will be posted tomorrow  Quiz 3 next Thursday 2

Last time  Convex hull – the smallest convex polygon containing a point set  We can use this to describe the shape of the red blob  And find its orientation 3

Computing the convex hull  Gift wrapping algorithm (“Jarvis march”) 4  Quickhull (divide and conquer)

Today: back to images  This photo is too small:  Where was this taken?  What time was it taken?  How can we zoom in? 5

Today: back to images  This photo is too small:  Might need this for forensics: 6

Zooming  First consider a black and white image (one intensity value per pixel)  We want to blow it up to poster size (say, zoom in by a factor of 16)  First try: repeat each row 16 times, then repeat each column 16 times 7

Zooming: First attempt 8

Interpolation  That didn’t work so well  We need a better way to find the in between values  Let’s consider one horizontal slice through the image (one scanline) 9

To Matlab 10

Interpolation  Problem statement:  We are given the values of a function f at a few locations, e.g., f(1), f(2), f(3), …  Want to find the rest of the values –What is f(1.5)?  This is called interpolation  We need some kind of model that predicts how the function behaves 11

Interpolation  Example: f(1) = 1, f(2) = 10, f(3) = 5, f(4) = 16, f(5) = 20 12

Interpolation  How can we find f(1.5)?  One approach: take the average of f(1) and f(2) 13 f (1.5) = 5.5

Linear interpolation (lerp)  Fit a line between each pair of data points 14

Linear interpolation  What is f(1.8)? Answer: 0.2 f(1) f(2) 15 f (1.8) = 0.2 (1) (10) = 8.2

Linear interpolation  To compute f(x), find the two points x left and x right that x lies between 16 x left x right f (x left ) f (x right ) x f (x) = (x right - x) / (x left – x right ) f (x left ) + (x - x left ) / (x left – x right ) f (x right ) f (x) = (x right - x) / (x left – x right ) f (x left ) + (x - x left ) / (x left – x right ) f (x right )

17 Nearest neighbor interpolation  The first technique we tried  We use the value of the data point we are closest to  This is a fast way to get a bad answer

18 Bilinear interpolation  What about in 2D? –Interpolate in x, then in y  Example –We know the red values –Linear interpolation in x between red values gives us the blue values –Linear interpolation in y between the blue values gives us the answer Bilinear_interpolation

Bilinear interpolation 19 Bilinear_interpolation

Nearest neighbor interpolation 20

Bilinear interpolation 21

Beyond linear interpolation  Fits a more complicated model to the pixels in a neighborhood  E.g., a cubic function 22

Bilinear interpolation 23

Bicubic interpolation 24 Smoother, but we’re still not resolving more detail

Even better interpolation  Detect curves in the image, represents them analytically 25

Even better interpolation 26 As seen in ZSNES hq4x filter nearest-neighbor interpolation SNES resolution: 256x224 Typical PC resolution: 1920x1200

Polynomial interpolation  Given n points to fit, we can find a polynomial p(x) of degree n – 1 that passes through every point exactly p(x) = x x x x

Polynomial interpolation  For large n, this doesn’t work so well… 28

Other applications of interpolation  Computer animation (keyframing) 29

Gray2Color 30 (Matlab code available)

31 Limits of interpolation  Can you prove that it is impossible to interpolate correctly?  Suppose I claim to have a correct way to produce an image with 4x as many pixels –Correct, in this context, means that it gives what a better camera would have captured –Can you prove this cannot work?  Related to impossibility of compression

32 Example algorithm that can’t exist  Consider a compression algorithm, like zip –Take a file F, produce a smaller version F’ –Given F’, we can uncompress to recover F –This is lossless compression, because we can “invert” it MP3, JPEG, MPEG, etc. are not lossless  Claim: there is no such algorithm that always produces a smaller file F’ for every input file F

33 Proof of claim (by contradiction)  Pick a file F, produce F’ by compression –F’ is smaller than F, by assumption  Now run compression on F’ –Get an even smaller file, F’’  At the end, you’ve got a file with only a single byte (a number from 0 to 255) –Yet by repeatedly uncompressing this you can eventually get F  However, there are more than 256 different files F that you could start with!

Conclusions 1.Some files will get larger if you compress them (usually files with random data) 2.We can’t (always) correctly recover missing data using interpolation 3.A low-res image can represent multiple high-res images 34

35 Extrapolation  Suppose you only know the values f(1), f(2), f(3), f(4) of a function –What is f(5)?  This problem is called extrapolation –Much harder than interpolation: what is outside the image? –For the particular case of temporal data, extrapolation is called prediction (what will the value of MSFT stock be tomorrow?) –If you have a good model, this can work well

Image extrapolation 36 Computed using a database of millions of photos