Fitting image transformations Prof. Noah Snavely CS1114

Slides:



Advertisements
Similar presentations
TP14 - Local features: detection and description Computer Vision, FCUP, 2014 Miguel Coimbra Slides by Prof. Kristen Grauman.
Advertisements

Image alignment Image from
Patch Descriptors CSE P 576 Larry Zitnick
Mosaics con’t CSE 455, Winter 2010 February 10, 2010.
Multiple View Geometry
Affine Linear Transformations Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)
Fitting. We’ve learned how to detect edges, corners, blobs. Now what? We would like to form a higher-level, more compact representation of the features.
Geometric Optimization Problems in Computer Vision.
Lecture 9: Image alignment CS4670: Computer Vision Noah Snavely
Lecture 10: Cameras CS4670: Computer Vision Noah Snavely Source: S. Lazebnik.
Feature-based object recognition Prof. Noah Snavely CS1114
Fitting a Model to Data Reading: 15.1,
Fitting. Choose a parametric object/some objects to represent a set of tokens Most interesting case is when criterion is not local –can’t tell whether.
Lecture 8: Image Alignment and RANSAC
Automatic Image Alignment (feature-based) : Computational Photography Alexei Efros, CMU, Fall 2006 with a lot of slides stolen from Steve Seitz and.
Lecture 10: Robust fitting CS4670: Computer Vision Noah Snavely.
1Jana Kosecka, CS 223b EM and RANSAC EM and RANSAC.
Lecture 6: Feature matching and alignment CS4670: Computer Vision Noah Snavely.
Computing transformations Prof. Noah Snavely CS1114
Lecture 12: Structure from motion CS6670: Computer Vision Noah Snavely.
Fitting.
כמה מהתעשייה? מבנה הקורס השתנה Computer vision.
Robust fitting Prof. Noah Snavely CS1114
Image Stitching Ali Farhadi CSE 455
CSE 185 Introduction to Computer Vision
Chapter 6 Feature-based alignment Advanced Computer Vision.
CSC 589 Lecture 22 Image Alignment and least square methods Bei Xiao American University April 13.
Advanced Computer Vision Feature-based Alignment Lecturer: Lu Yi & Prof. Fuh CSIE NTU.
IMAGE MOSAICING Summer School on Document Image Processing
Lecture 4: Feature matching CS4670 / 5670: Computer Vision Noah Snavely.
Image stitching Digital Visual Effects Yung-Yu Chuang with slides by Richard Szeliski, Steve Seitz, Matthew Brown and Vaclav Hlavac.
Example: line fitting. n=2 Model fitting Measure distances.
CSCE 643 Computer Vision: Structure from Motion
Computer Vision : CISC 4/689 Going Back a little Cameras.ppt.
Lecture 7: Features Part 2 CS4670/5670: Computer Vision Noah Snavely.
Computer Vision - Fitting and Alignment (Slides borrowed from various presentations)
CSE 185 Introduction to Computer Vision Feature Matching.
Local features: detection and description
776 Computer Vision Jan-Michael Frahm Spring 2012.
CS 2750: Machine Learning Linear Regression Prof. Adriana Kovashka University of Pittsburgh February 10, 2016.
Fitting.
Optimization and least squares Prof. Noah Snavely CS1114
COS 429 PS3: Stitching a Panorama Due November 10 th.
EE 7730 Parametric Motion Estimation. Bahadir K. Gunturk2 Parametric (Global) Motion Affine Flow.
Blob detection.
Invariant Local Features Image content is transformed into local feature coordinates that are invariant to translation, rotation, scale, and other imaging.
Lecture 10: Image alignment CS4670/5760: Computer Vision Noah Snavely
Grouping and Segmentation. Sometimes edge detectors find the boundary pretty well.
776 Computer Vision Jan-Michael Frahm Spring 2012.
Lecture 07 13/12/2011 Shai Avidan הבהרה: החומר המחייב הוא החומר הנלמד בכיתה ולא זה המופיע / לא מופיע במצגת.
Nearest-neighbor matching to feature database
TP12 - Local features: detection and description
A Brief Introduction of RANSAC
Lecture 7: Image alignment
Feature description and matching
A special case of calibration
Object recognition Prof. Graeme Bailey
Nearest-neighbor matching to feature database
Segmentation by fitting a model: robust estimators and RANSAC
Lecture 8: Image alignment
Lecture 8: Image alignment
CSE 185 Introduction to Computer Vision
Feature descriptors and matching
Calibration and homographies
Back to equations of geometric transformations
CS5760: Computer Vision Lecture 9: RANSAC Noah Snavely
CS5760: Computer Vision Lecture 9: RANSAC Noah Snavely
Image Stitching Linda Shapiro ECE/CSE 576.
Lecture 11: Image alignment, Part 2
Image Stitching Linda Shapiro ECE P 596.
Presentation transcript:

Fitting image transformations Prof. Noah Snavely CS1114

Administrivia  A4 due tomorrow, A5 up next 2

Next couple weeks  How do we detect an object in an image?  Combines ideas from image transformations, least squares, and robustness 3

Object matching in three steps 1.Detect features in the template and search images 2.Match features: find “similar-looking” features in the two images 3.Find a transformation T that explains the movement of the matched features 4 sift We started talking about this part last time

Affine transformations  A 2D affine transformation has the form: 5

Fitting affine transformations  We will fit an affine transformation to a set of feature matches –Problem: there are many incorrect matches 6

Linear regression 7

Testing goodness  Idea: count the number of points that are “close” to the line 8 Score = 7

Testing goodness  How can we tell if a point agrees with a line?  Compute the distance the point and the line, and threshold 9

Testing goodness  If the distance is small, we call this point an inlier to the line  If the distance is large, it’s an outlier to the line  For an inlier point and a good line, this distance will be close to (but not exactly) zero  For an outlier point or bad line, this distance will probably be large  Objective function: find the line with the most inliers (or the fewest outliers) 10

Optimizing for inlier count  How do we find the best possible line? 11 Score = 7

Algorithm (RANSAC) 1.Select two points at random 2.Solve for the line between those point 3.Count the number of inliers to the line L 4.If L has the highest number of inliers so far, save it 5.Repeat for N rounds, return the best L 12

Testing goodness  This algorithm is called RANSAC (RANdom SAmple Consensus) – example of a randomized algorithm  Used in an amazing number of computer vision algorithms  Requires two parameters: –The agreement threshold (how close does an inlier have to be?) –The number of rounds (how many do we need?) 13

Randomized algorithms  Very common in computer science –In this case, we avoid testing an infinite set of possible lines, or all O(n 2 ) lines generated by pairs of points  These algorithms find the right answer with some probability  Often work very well in practice 14

Questions? 15

Very similar idea  Given two images with a set of feature matches, how do we compute an affine transform between the two images? 16

Multi-variable fitting  Let’s consider 2D affine transformations –maps a 2D point to another 2D point  We have a set of n matches [ x 1 y 1 ]  [ x 1 ’ y 1 ’ ] [ x 2 y 2 ]  [ x 2 ’ y 2 ’ ] [ x 3 y 3 ]  [ x 3 ’ y 3 ’ ] … [ x n y n ]  [ x n ’ y n ’ ] 17

 Consider just one match [ x 1 y 1 ]  [ x 1 ’ y 1 ’ ] ax 1 + by 1 + c = x 1 ’ dx 1 + ey 1 + f = y 1 ’  2 equations, 6 unknowns  we need at least 3 matches, but can fit n using least squares 18 Fitting an affine transformation

 This is just a bigger linear system, still (relatively) easy to solve  Really just two linear systems with 3 equations each (one for a,b,c, the other for d,e,f)  We’ll figure out how to solve this in a minute 19 Fitting an affine transformation

 In other words: –Find 2D affine xform T that maps points in image 1 as close as possible to their matches in image 2 20

Back to fitting  Just like in the case of fitting a line or computing a median, we have some bad data (incorrect matches) 21 These outliers will cause problems with fitting the xform

How do we fix this?  RANSAC to the rescue! 22

Generating and testing an xform  From set of matches, select 3 at random  Fit a transformation to the selected matches  Count inliers 23 inlier outlier

Transform Fitting Algorithm (RANSAC) 1.Select three matches at random 2.Solve for the affine transformation T 3.Count the number of matches that are inliers to T 4.If T has the highest number of inliers so far, save it 5.Repeat for N rounds, return the best T 24

How do we solve for T given 3 matches?  Three matches give a linear system with six equations: ax 1 + by 1 + c = x 1 ’ dx 1 + ey 1 + f = y 1 ’ ax 2 + by 2 + c = x 2 ’ dx 2 + ey 2 + f = y 2 ’ ax 3 + by 3 + c = x 3 ’ dx 3 + ey 3 + f = y 3 ’ 25 [ x 1 y 1 ]  [ x 1 ’ y 1 ’ ] [ x 2 y 2 ]  [ x 2 ’ y 2 ’ ] [ x 3 y 3 ]  [ x 3 ’ y 3 ’ ]

Two 3x3 linear systems ax 1 + by 1 + c = x 1 ’ ax 2 + by 2 + c = x 2 ’ ax 3 + by 3 + c = x 3 ’ dx 1 + ey 1 + f = y 1 ’ dx 2 + ey 2 + f = y 2 ’ dx 3 + ey 3 + f = y 3 ’ 26

Solving a 3x3 system ax 1 + by 1 + c = x 1 ’ ax 2 + by 2 + c = x 2 ’ ax 3 + by 3 + c = x 3 ’  We can write this in matrix form:  Now what? 27

Finding the object boundary 28

Questions? 29

Object matching in three steps 1.Detect features in the template and search images 2.Match features: find “similar-looking” features in the two images 3.Find a transformation T that explains the movement of the matched features 30 sift How do we do this part?

SIFT Features  Scale-Invariant Feature Transform

Properties of SIFT  Extraordinarily robust matching technique –Can handle significant changes in illumination Sometimes even day vs. night (below) –Fast and efficient—can run in real time –Lots of code available

Do these two images overlap? NASA Mars Rover images

Answer below