Docsity

Topics covered include image, Schemes and Mind Maps of Engineering

Partial preview of the text

Download Topics covered include image and more Schemes and Mind Maps Engineering in PDF only on Docsity!

CS436/CS5310/EE

Computer Vision Fundamentals

Murtaza Taj [email protected] Lecture 10: Estimating 2D Transformations Wed 05th^ Oct 2022

⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ = ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ 1 0 0 1 1 ' ' 4 5 6 1 2 3 y x a a a a a a y x

6 5 4 3 2 1

y

x

a

a

a

a

a

a

x y

x y

Recovering Best Affine Transformation (alternate way)

3 3 2 2 1 1 6 5 4 3 2 1 3 3 3 3 2 2 2 2 1 1 1 1

y

x

y

x

y

x

a

a

a

a

a

a

x y

x y

x y

x y

x y

x y

Ax = B

Recovering Best Affine Transformation

! (^) Given three pairs of corresponding points, we get 6 equations

x = A

B

Recovering Best Affine Transformation ! (^) Ax = B ! (^) Cannot take inverse directly ⎥

4 4 3 3 2 2 1 1 6 5 4 3 2 1 4 4 4 4 3 3 3 3 2 2 2 2 1 1 1 1 y x y x y x y x a a a a a a x y x y x y x y x y x y x y x y

Pseudo inverse For an over-constrained linear system Ax = B A has more rows than columns Multiply by A T on both sides A T Ax = A T B ATA is a square matrix of as many rows as x We can take its inverse x = (ATA)-1ATB Pseudo-inverse gives the least squares error solution! [Proof?]

Demo

Homography Estimation ! (^) 3 x 3 transform defined in Homogeneous coordinates

Homogeneous Linear Least Squares ! (^) Solution is the NULL vector of matrix A ! (^) We first compute SVD of A ! (^) Solution h ! (^) “right singular vector” (a column from V ) which corresponds to the smallest singular value, σ 9 A = U Σ V T = 9 ∑ i = 1 σ i u i v T i 2Nx2N 2Nx9 9x 2Nx9 9x

Next: 2D Affine Warping

DIY Slide: Warping ! (^) This will leave holes… ! (^) Because every pixel does not map to an integer location! ! (^) Reverse Transformation ! (^) For each integer location in X’ ! (^) Apply inverse mapping ! (^) Problem? ! (^) Will not result in answers at integer locations, in general ! (^) Bilinearly interpolate from 4 neighbors

DIY Slide: Linear Interpolation… ! (^) In 1D ! (^) Use y=mx+c ! (^) m = 1, c = - 2 ! (^) Substitute x=4.3, => y = 2. 4 2 5 3 4.3?

DIY Slide: 2D Bilinear Interpolation - example ? ? ?

DIY Slide: Summary: 2D Affine Warping ! (^) Inputs: ! (^) Image X ! Affine Transformation A = [ a 1 a 2 b 1 a 3 a 4 b 2 ] T ! (^) Procedure: ! (^) Transform corner points to determine output image extent ! (^) Take the inverse of the given transformation A ! (^) Apply inverse transform on all pixels of (initially empty) output image ! (^) Go to resulting position in input image, apply bilinear interpolation using four neighboring pixels to obtain final color value