Summary: Transformations. Lecture 14 Parameter Estimation Readings T&V Sec 5.1-5.3. Parameter Estimation: Fitting Geometric Models



Similar documents
Least-Squares Intersection of Lines

The Vector or Cross Product

[1] Diagonal factorization

Vector Math Computer Graphics Scott D. Anderson

Geometric Transformation CS 211A

December 4, 2013 MATH 171 BASIC LINEAR ALGEBRA B. KITCHENS

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

Introduction to Matrix Algebra

Notes on Orthogonal and Symmetric Matrices MENU, Winter 2013

Rotation Matrices and Homogeneous Transformations

x = + x 2 + x

Review Jeopardy. Blue vs. Orange. Review Jeopardy

3. INNER PRODUCT SPACES

1 Review of Least Squares Solutions to Overdetermined Systems

Figure 1.1 Vector A and Vector F

Lecture 5: Singular Value Decomposition SVD (1)

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Data Mining: Algorithms and Applications Matrix Math Review

Vector Notation: AB represents the vector from point A to point B on a graph. The vector can be computed by B A.

1 Determinants and the Solvability of Linear Systems

Name: Section Registered In:

9 MATRICES AND TRANSFORMATIONS

Manifold Learning Examples PCA, LLE and ISOMAP

Lecture 2 Matrix Operations

DATA ANALYSIS II. Matrix Algorithms

What does the number m in y = mx + b measure? To find out, suppose (x 1, y 1 ) and (x 2, y 2 ) are two points on the graph of y = mx + b.

Computer Vision & Digital Image Processing. Edge linking and boundary detection

Chapter 19. General Matrices. An n m matrix is an array. a 11 a 12 a 1m a 21 a 22 a 2m A = a n1 a n2 a nm. The matrix A has n row vectors

Module 3: Correlation and Covariance

Definition 8.1 Two inequalities are equivalent if they have the same solution set. Add or Subtract the same value on both sides of the inequality.

Linear Algebra and TI 89

Unit 1 Equations, Inequalities, Functions

Vocabulary Words and Definitions for Algebra

13 MATH FACTS a = The elements of a vector have a graphical interpretation, which is particularly easy to see in two or three dimensions.

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

Bildverarbeitung und Mustererkennung Image Processing and Pattern Recognition

Algebra I Vocabulary Cards

Problem Set 5 Due: In class Thursday, Oct. 18 Late papers will be accepted until 1:00 PM Friday.

DIFFERENTIABILITY OF COMPLEX FUNCTIONS. Contents

Chapter 17. Orthogonal Matrices and Symmetries of Space

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

Metrics on SO(3) and Inverse Kinematics

Linear algebra and the geometry of quadratic equations. Similarity transformations and orthogonal matrices

3D Tranformations. CS 4620 Lecture 6. Cornell CS4620 Fall 2013 Lecture Steve Marschner (with previous instructors James/Bala)

Math 53 Worksheet Solutions- Minmax and Lagrange

Arithmetic and Algebra of Matrices

Quadratic forms Cochran s theorem, degrees of freedom, and all that

Eigenvalues, Eigenvectors, Matrix Factoring, and Principal Components

TWO-DIMENSIONAL TRANSFORMATION

Dimensionality Reduction: Principal Components Analysis

Quick Tour of Mathcad and Examples

Linear Algebra Review. Vectors

Section 1.5 Linear Models

Charlesworth School Year Group Maths Targets

MATHEMATICS FOR ENGINEERS BASIC MATRIX THEORY TUTORIAL 2

Eigenvalues and Eigenvectors

PYTHAGOREAN TRIPLES KEITH CONRAD

Solutions for Review Problems

Correlation and Convolution Class Notes for CMSC 426, Fall 2005 David Jacobs

Math Common Core Sampler Test

Vector and Matrix Norms

8. Linear least-squares

Chapter 10. Key Ideas Correlation, Correlation Coefficient (r),

Orthogonal Projections

IV. ALGEBRAIC CONCEPTS

521493S Computer Graphics. Exercise 2 & course schedule change

Section 1.1. Introduction to R n

Adding vectors We can do arithmetic with vectors. We ll start with vector addition and related operations. Suppose you have two vectors

Lecture L3 - Vectors, Matrices and Coordinate Transformations

Projective Geometry. Projective Geometry

1.5 SOLUTION SETS OF LINEAR SYSTEMS

Linear Algebra Notes

Exam 1 Sample Question SOLUTIONS. y = 2x

Math 241, Exam 1 Information.

MATH2210 Notebook 1 Fall Semester 2016/ MATH2210 Notebook Solving Systems of Linear Equations... 3

Similarity and Diagonalization. Similar Matrices

Lecture 5 Least-squares

MATH APPLIED MATRIX THEORY

Computer Graphics. Geometric Modeling. Page 1. Copyright Gotsman, Elber, Barequet, Karni, Sheffer Computer Science - Technion. An Example.

A vector is a directed line segment used to represent a vector quantity.

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 3: Wednesday, Feb 8

Section 1.1 Linear Equations: Slope and Equations of Lines

Georgia Standards of Excellence Curriculum Map. Mathematics. GSE 8 th Grade

MATHEMATICS FOR ENGINEERING BASIC ALGEBRA

by the matrix A results in a vector which is a reflection of the given

Equations Involving Lines and Planes Standard equations for lines in space

1 Introduction to Matrices

Derive 5: The Easiest... Just Got Better!

What is a parabola? It is geometrically defined by a set of points or locus of points that are

Year 9 set 1 Mathematics notes, to accompany the 9H book.

Chapter 9. Systems of Linear Equations

Algebra Cheat Sheets

The Fourth International DERIVE-TI92/89 Conference Liverpool, U.K., July Derive 5: The Easiest... Just Got Better!

Epipolar Geometry. Readings: See Sections 10.1 and 15.6 of Forsyth and Ponce. Right Image. Left Image. e(p ) Epipolar Lines. e(q ) q R.

Several Views of Support Vector Machines

Vector Spaces; the Space R n

Mathematics Placement

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA

Transcription:

Summary: Transformations Lecture 14 Parameter Estimation eadings T&V Sec 5.1-5.3 Euclidean similarity affine projective Parameter Estimation We will talk about estimating parameters of 1) Geometric models (e.g. lines, planes, surfaces) 2) Geometric transformations (any of the parametric transformations we have been talking about) Least-squares is a general strategy to address both! Parameter Estimation: Fitting Geometric Models Example : Line Fitting Point Feature Data pts = [... 17 81; 23 72; 35 73; 37 58; 45 50; 57 56; 61 36; 70 32; 80 32; 84 19] x Point features = {(x i,y i ) i = 1,,n} y 1

Example : Line Fitting Line Parameterization y = m * x + b m = slope b = y-intercept (where b crosses the y axis) Model instance = (m,b) (The astute student will note a problem with representing vertical lines) b dx y dy x m = dy/dx Example : Line Fitting Least Squares (L.S. is just one type of error function) Given line (m,b) distance of point (x i,y i ) to line is vertical distance E is sum of squared distances over all points (m,b) x i d i m x i + b y i Example : Line Fitting alculus to Find Extrema Take first derivatives of E with respect to m, b Set equations to zero Solve for m, b Note equivalence to linear regression *DOING DEIVATION ON THE BOAD* 2

Least Squares Solution Problem with Parameterization There is a problem with our parameterization, namely (m,b) is undefined for vertical lines m = -0.8528 b = 94.3059 More general line parameterization such that Question for class: why do we need the quadratic constraint? Another question: what is relation of this to y=mx+b? LS with Algebraic Distance LS with Algebraic Distance Algebraic Distance Will derive on board. esult: (a,b,c) is eigenvector associated with smallest eigenvalue (it will only be 0 if there is no noise, and therefore all the points lie exactly on a line) Note much different from linear regression line (in this case) but we can rest assured that our program won t blow up when it sees a vertical line! Algebraic Least Squares Issues Orthogonal Least Squares Note: I didn t draw the error vectors on the plot That s because I don t know what to draw Main problem with algebraic distances: Hard to say precisely what it is you are minimizing, since algebraic distances are rarely physically meaningful quantities Minimize orthogonal (geometric) distance. Makes sense physically, but harder to derive epresentation: such that Distance measured perpendicular to line (compare with algebraic distance) 3

Orthogonal Least Squares Orthogonal Least Squares Solution Harder to derive. Key insight: best fit line must pass through the center of mass of the set of points! Move center of mass to the origin. This reduces the problem to finding a unit vector normal to the line: (a,b) s.t. a 2 +b^2=1 This will be minimum eigenvector of scatter matrix of the points. Finally, solve for c center of mass distance means what we intuitively expect (i.e. distance to closest point on line, or minimum distance to line) Parameter Estimation: Estimating a Transformation Let s say we have found point matches between two images, and we think they are related by some parametric transformation (e.g. translation; scaled Euclidean; affine). How do we estimate the parameters of that transformation? Example: Translation Estimation equations matrix form General Strategy Least-Squares estimation from point correspondences How many degrees of freedom? How many independent variables are there? Two Two important (related) questions: How many degrees of freedom? How many point correspondences are needed? How many point correspondences are needed? Each correspondence (x,y)=>(x,y ) provides two equations DoF 2 = 2/2 = 1 Example: Translation Estimation Let s try another example equations x1,y1 x2,y2 x1,y1 x2,y2 Similarity transformation x3,y3 x4,y4 x3,y3 Least Squares Estimation: x4,y4 x a -b c x y = b a d y 1 0 0 1 1 Minimize wrt t x, t y note: a = s cosθ b = s sinθ **ON THE BOAD** 4

Practical Issue Warping & Bilinear Interpolation Once we have estimated a transformation, how can we (un)warp image pixel values to produce a new picture. Given a transformation between two images, (coordinate systems) we want to warp one image into the coordinate system of the other. We will call the coordinate system where we are mapping from the source image We will call the coordinate system we are mapping to the destination image. Warping Example Transformation in this case is a projective transformation (general 3x3 matrix, operating on homogeneous coords) Source image Forward Warping Destination image x H H(x) H from Hartley & Zisserman Source Image Destination image We will have a lot more to say about this is a future lecture. For each pixel x in the source image Determine where it goes as H(x) olor the destination pixel Problems? Forward Warping Problem Backward Warping (No gaps) Source image Destination image Source image Destination image H -1 (x) x magnified H -1? an leave gaps! For each pixel x in the destination image Determine where it comes from as H -1 (x) Get color from that location 5

Interpolation Bilinear interpolation What do we mean by get color from that location? onsider grey values. What is intensity at (x,y)? What do we mean by get color from that location? onsider grey values. What is intensity at (x,y)? I(i, j+1) I(i+1, j+1) Nearest Neighbor: Take color of pixel with closest center. I(i, j+1) I(i+1, j+1) Bilinear Interpolation: Weighted average (x,y) I(x,y) = I(i+1,j) (x,y) I(i, j) I(i+1, j) I(i, j) I(i+1, j) Bilinear interpolation Bilinear Interpolation, Math What do we mean by get color from that location? onsider grey values. What is intensity at (x,y)? First, consider linear interpolation (i, j) (i+1, j) I(i, j+1) I(i+1, j+1) A 1 A 2 A 3 A 4 I(i, j) I(i+1, j) Bilinear Interpolation: Weighted average I(x,y) = A3*I(i,j) + A4*I(i+1,j) + A2*I(i+1,j+1) + A1*I(i,j+1) Inituition: Given two pixel values, what should the value be at some intermediate point between them? (i, j) (i+1, j) If close to (i,j), should be intensity similar to I(i,j) (i, j) (i+1, j) If equidistant from both, should be average of the two intensities (i, j) (i+1, j) If close to (i+1,j), should be intensity similar to I(i+1,j) Linear Interpolation Bilinear Interpolation, Math (i, j) (i+1, j) a (1-a) Y axis (intensity value) I(i+1, j) I(i, j) y 0 a 1 axis (relative location) ecall: Instantiate Solve 6

Bilinear Interpolation, Math Bilinear Interpolation, Math [ ] I = + [ ] Image Warping in Matlab Tips on Using Interp2 interp2 is Matlab s built-in function for image warping Usage: interp2(,y,z,,yi) For our purposes, we can assume and Y are just normal image pixel coords. Simpler Usage: interp2(z,,yi) Tips on Using Interp2 (cont) Tips on Using Interp2 (cont) How does it work? onsider computing the value of ZI at row and col. and YI are two arrays the same size as ZI. For a given row, col (,), the value ((,), YI(,)) tells which (,Y) coord of the orig image to take. That is: Z(YI(,), (,)). ow: ol: ow: ol: 7

Tips on Using Interp2 (cont) Tips on Using Interp2 (cont) (,) YI YI(,) interp2 takes care of bilinear interpolation for you, in case YI(,) and (,) are not integer coords. There are optional arguments to interp2 to change the way the interpolation is calculated. We can go with the default, which is bilinear interp. (,) YI(,) ow: ol: Z(YI(,),(,)) Meshgrid A useful function when using interp2 is meshgrid >> [xx,yy] = meshgrid(1:4,1:3) xx = 1 2 3 4 1 2 3 4 1 2 3 4 An array suitable for use as foo = interp2(im, xi, yi); Imshow(uint8(foo)); yy = 1 1 1 1 2 2 2 2 3 3 3 3 An array suitable for use as YI esult: just a copy of the image. foo = interp2(im, xi/2, yi/2); Imshow(uint8(foo)); foo = interp2(im, 2*xi, 2*yi); Imshow(uint8(foo)); esult: scale up by 2 (but stuck in 256x256 image) esult: scale down by 2 (within 256x256 image, pad with 0) 8

onfusion alert! foo = interp2(im, xi/2, yi/2); Divide coords by 2 to scale up by 2 A more complicated example: scale down by 2, but around center of image (128,128), not (0,0) ecall concatenation of transformation matrices: foo = interp2(im, 2*xi, 2*yi); Multiply coords by 2 to reduce up by 2 Interp2 wants the inverse coordinate transforms to the geometric operation you want (it uses backward warping) Bring (128,128) to origin Scale down by 2 around origin Bring origin back to (128,128) BUT, BE AEFUL. This specifies how we want the original image to map into the new image. H foo = interp2(im, 2*xi-128, 2*yi-128); imshow(uint8(foo)); H -1 Interp2 wants to know how new image coords map back to the original image coords. esult More generally (e.g. for any 3x3 transformation matrix in homogeneous coords) h = [1 0 128;0 1 128; 0 0 1] * [1/2 0 0; 0 1/2 0; 0 0 1] * [1 0-128; 0 1-128; 0 0 1]; h = inv(h); %TAKE INVESE FO USE WITH INTEP2 xx = (h(1,1)*xi+h(1,2)*yi+h(1,3))./(h(3,1)*xi+h(3,2)*yi+h(3,3)); yy = (h(2,1)*xi+h(2,2)*yi+h(2,3))./(h(3,1)*xi+h(3,2)*yi+h(3,3)); foo = uint8(interp2(im,xx,yy)); figure(1); imshow(foo) esult 9