transformations and fitting
play

Transformations and Fitting EECS 442 David Fouhey Fall 2019, - PowerPoint PPT Presentation

Transformations and Fitting EECS 442 David Fouhey Fall 2019, University of Michigan http://web.eecs.umich.edu/~fouhey/teaching/EECS442_F19/ Administrivia HW1 partially done Overall the class did looks like it did well Copying:


  1. Transformations and Fitting EECS 442 – David Fouhey Fall 2019, University of Michigan http://web.eecs.umich.edu/~fouhey/teaching/EECS442_F19/

  2. Administrivia • HW1 partially done • Overall the class did looks like it did well • Copying: • Please don’t do it; it’s usually obvious • I don’t have easy/great options • Please read the syllabus for what’s allowed • HW2 now due Fri Oct 18 11:59.99PM • You can use the study break however you want • I wouldn’t encourage you to leave HW2 until the week that overlaps with HW3

  3. So Far 1. How do we find distinctive / easy to locate features? (Harris/Laplacian of Gaussian) 2. How do we describe the regions around them? (histogram of gradients) 3. How do we match features? (L2 distance) 4. How do we handle outliers? (RANSAC)

  4. Today As promised: warping one image to another

  5. Why Mosaic? • Compact Camera FOV = 50 x 35° Slide credit: Brown & Lowe

  6. Why Mosaic? • Compact Camera FOV = 50 x 35° • Human FOV = 200 x 135° Slide credit: Brown & Lowe

  7. Why Mosaic? • Compact Camera FOV = 50 x 35° • Human FOV = 200 x 135° • Panoramic Mosaic = 360 x 180° Slide credit: Brown & Lowe

  8. Why Bother With This Math? Slide credit: A. Efros

  9. Homework 1 Style Translation only via alignment Slide credit: A. Efros

  10. Result Slide credit: A. Efros

  11. Image Transformations Image filtering: change range of image 𝑕 𝑦 = 𝑈(𝑔 𝑦 ) f g T x x Image warping: change domain of image 𝑕 𝑦 = 𝑔 𝑈(𝑦 ) f g T x x Slide credit: A. Efros

  12. Image Transformations Image filtering: change range of image 𝑕 𝑦 = 𝑈(𝑔 𝑦 ) f g T Image warping: change domain of image 𝑕 𝑦 = 𝑔 𝑈(𝑦 ) f g T Slide credit: A. Efros that re

  13. Parametric (Global) warping Examples of parametric warps translation rotation aspect affine perspective cylindrical Slide credit: A. Efros

  14. Parametric (Global) Warping T is a coordinate changing machine 𝒒 ′ = 𝑈(𝒒) Note: T is the same for all points, has relatively few parameters, and does not depend on image content T p’ = (x’,y’) p = (x,y) Slide credit: A. Efros

  15. Parametric (Global) Warping Today we’ll deal with linear warps 𝒒 ′ ≡ 𝑼𝒒 T: matrix; p, p’: 2D points. Start with normal points and =, then do homogeneous cords and ≡ T p’ = (x’,y’) p = (x,y) Slide credit: A. Efros

  16. Scaling Scaling multiplies each component (x,y) by a scalar. Uniform scaling is the same for all components. Note the corner goes from (1,1) to (2,2)  2 Slide credit: A. Efros

  17. Scaling Non-uniform scaling multiplies each component by a different scalar. X  2, Y  0.5 Slide credit: A. Efros

  18. Scaling What does T look like? 𝑦 ′ = 𝑏𝑦 𝑧 ′ = 𝑐𝑧 Let’s convert to a matrix: 𝑦 𝑦′ 𝑏 0 𝑧′ = 𝑧 0 𝑐 scaling matrix S What’s the inverse of S? Slide credit: A. Efros

  19. 2D Rotation Rotation Matrix 𝑦 cos(𝜄) − sin 𝜄 𝑦′ 𝑧′ = 𝑧 sin 𝜄 cos 𝜄 But wait! Aren’t sin/cos non -linear? x’ is a linear combination/function of x, y x’ is not a linear function of θ 𝑈 𝑺 𝜾 What’s the inverse of R θ ? 𝑱 = 𝑺 𝜾 Slide credit: A. Efros

  20. Things You Can Do With 2x2 Identity / No Transformation 𝑦 𝑦′ 1 0 𝑧′ = 𝑧 0 1 Shear 𝑦 1 𝑡ℎ 𝑦 𝑦′ 𝑧′ = 𝑧 𝑡ℎ 𝑧 1 Slide credit: A. Efros

  21. Things You Can Do With 2x2 2D Mirror About Y-Axis Before 𝑦 𝑦′ −1 0 𝑧′ = 𝑧 0 1 After 2D Mirror About X,Y Before 𝑦 𝑦′ −1 0 𝑧′ = 𝑧 0 −1 After Slide credit: A. Efros

  22. What’s Preserved? 3D lines project to 2D lines so lines are preserved Projections of parallel 3D lines are not necessarily parallel, so not parallelism Distant objects are smaller so size is not preserved

  23. What’s Preserved With a 2x2 𝑦 𝑧 = 𝑈 𝑦 𝑦′ 𝑏 𝑐 𝑧′ = 𝑧 𝑑 𝑒 After multiplication by T (irrespective of T) • Origin is origin: 0 = T0 • Lines are lines • Parallel lines are parallel

  24. Things You Can’t Do With 2x2 What about translation? x’ = x + t x , y’ = y+t y How do we fix it? +(2,2)

  25. Homogeneous Coordinates Again What about translation? x’ = x + t x , y’ = y+t y 𝑦 + 𝑢 𝑦 𝑦 ′ 𝑦 1 0 𝑢 𝑦 𝑧 ′ 𝑧 + 𝑢 𝑧 𝑧 ≡ ≡ 0 1 𝑢 𝑧 1 1 1 0 0 1 +(2,2) Slide credit: A. Efros

  26. Representing 2D Transformations How do we represent a 2D transformation? Let’s pick scaling 𝑡 𝑦 0 𝑏 𝑦 ′ 𝑦 0 𝑡 𝑧 𝑐 𝑧 ′ 𝑧 ≡ 1 𝑒 𝑓 𝑔 1 a b d e f What’s 0 0 0 0 1

  27. Affine Transformations Affine: linear transformation plus translation 𝑦 ′ 𝑦 𝑏 𝑐 𝑑 𝑧 ′ 𝑧 ≡ 𝑒 𝑓 𝑔 t 1 0 0 1 𝑥′ Will the last coordinate always be 1? In general (without homogeneous coordinates) 𝒚′ = 𝑩𝒚 + 𝒄

  28. Matrix Composition We can combine transformations via matrix multiplication. 𝑦 ′ 1 0 𝑢 𝑦 𝑡 𝑦 0 0 𝑦 cos 𝜄 − sin 𝜄 0 𝑧 ′ 𝑧 0 1 𝑢 𝑧 0 𝑡 𝑧 0 ≡ sin 𝜄 cos 𝜄 0 𝑥 0 0 1 𝑥′ 0 0 1 0 0 1 𝑈 𝑢 𝑦 , 𝑢 𝑧 𝑇 𝑡 𝑦 , 𝑡 𝑧 𝑆 𝜄 Does order matter? Slide credit: A. Efros

  29. What’s Preserved With Affine 𝑦 ′ 𝑦 𝑦 𝑏 𝑐 𝑑 𝑧 ′ 𝑧 𝑧 ≡ ≡ 𝑼 𝑒 𝑓 𝑔 1 1 1 0 0 1 After multiplication by T (irrespective of T) • Origin is origin: 0 = T0 • Lines are lines • Parallel lines are parallel

  30. Perspective Transformations Set bottom row to not [0,0,1] Called a perspective/projective transformation or a homography 𝑦 ′ 𝑏 𝑐 𝑑 𝑦 𝑧 ′ 𝑒 𝑓 𝑔 𝑧 ≡ 𝑥 𝑕 ℎ 𝑗 𝑥′ How many degrees of freedom?

  31. How Many Degrees of Freedom? Recall: can always scale by non-zero value 𝑦 ′ 𝑏 𝑐 𝑑 𝑦 𝑧 ′ Perspective 𝑒 𝑓 𝑔 𝑧 ≡ 𝑥 𝑕 ℎ 𝑗 𝑥′ 𝑦 ′ 𝑦 ′ 𝑏 𝑐 𝑑 𝑏/𝑗 𝑐/𝑗 𝑑/𝑗 𝑦 𝑦 1 1 𝑧 ′ 𝑧 ′ 𝑒 𝑓 𝑔 𝑧 𝑒/𝑗 𝑓/𝑗 𝑔/𝑗 𝑧 ≡ ≡ ≡ 𝑗 𝑗 𝑥 𝑥 𝑥 ′ 𝑕 ℎ 𝑗 𝑕/𝑗 ℎ/𝑗 1 𝑥′ Homography can always be re-scaled by λ≠ 0

  32. What’s Preserved With Perspective 𝑦 ′ 𝑏 𝑐 𝑑 𝑦 𝑦 𝑧 ′ 𝑒 𝑓 𝑔 𝑧 𝑧 ≡ ≡ 𝑼 𝑕 ℎ 𝑗 1 1 1 After multiplication by T (irrespective of T) • Origin is origin: 0 = T0 • Lines are lines • Parallel lines are parallel • Ratios between distances

  33. Transformation Families In general: transformations are a nested set of groups Diagram credit: R. Szeliski

  34. What Can Homographies Do? Homography example 1: any two views of a planar surface Figure Credit: S. Lazebnik

  35. What Can Homographies Do? Homography example 2: any images from two cameras sharing a camera center Figure Credit: S. Lazebnik

  36. A pencil of rays contains all views real synthetic camera camera Can generate any synthetic camera view as long as it has the same center of projection ! Slide Credit: A. Efros

  37. What Can Homographies Do? Homography sort of example “3”: far away scene that can be approximated by a plane Figure credit: Brown & Lowe

  38. Fun With Homographies Original image St. Petersburg photo by A. Tikhonov Virtual camera rotations Slide Credit: A. Efros

  39. Analyzing Patterns The floor (enlarged) Automatically rectified floor Slide from A. Criminisi

  40. Analyzing Patterns Automatic rectification From Martin Kemp The Science of Art (manual reconstruction) Slide from A. Criminisi

  41. Analyzing Patterns What is the (complicated) shape of the floor pattern? Automatically rectified floor St. Lucy Altarpiece, D. Veneziano Slide from A. Criminisi

  42. Analyzing Patterns Automatic rectification From Martin Kemp, The Science of Art (manual reconstruction) Slide from A. Criminisi

  43. Fitting Transformations Setup: have pairs of correspondences 𝑦 𝑗 , 𝑧 𝑗 𝑦′ 𝑗 , 𝑧′ 𝑗 M,t 𝑧 𝑗 ′ = 𝑵 𝑦 𝑗 𝑦 𝑗 ′ 𝑧 𝑗 + 𝒖 Slide Credit: S. Lazebnik

  44. Fitting Transformation Affine Transformation: M,t Data: (x i ,y i ,x’ i ,y’ i ) for i =1,…,k M,t Model: [ x’ i ,y’ i ] = M [x i ,y i ]+ t Objective function: ||[ x’ i ,y’ i ] – M [x i ,y i ]+ t || 2

  45. Fitting Transformations Given correspondences: p ’ = [x’ i ,y’ i ], p = [x i ,y i ] 𝑧 𝑗 ′ = 𝑛 1 𝑛 2 𝑧 𝑗 + 𝑢 𝑦 𝑦 𝑗 𝑦 𝑗 ′ 𝑛 3 𝑛 4 𝑢 𝑧 Set up two equations per point 𝑛 1 ⋯ 𝑛 2 ⋮ 𝑛 3 ′ 𝑦 𝑗 𝑦 𝑗 𝑧 𝑗 0 0 1 0 = 𝑛 4 ′ 𝑧 𝑗 0 0 𝑦 𝑗 𝑧 𝑗 0 1 𝑢 𝑦 ⋮ ⋯ 𝑢 𝑧

  46. Fitting Transformations 𝑛 1 ⋯ 𝑛 2 ⋮ 𝑛 3 ′ 𝑦 𝑗 𝑦 𝑗 𝑧 𝑗 0 0 1 0 = 𝑛 4 ′ 𝑧 𝑗 0 0 𝑦 𝑗 𝑧 𝑗 0 1 𝑢 𝑦 ⋮ ⋯ 𝑢 𝑧 2 equations per point, 6 unknowns How many points do we need?

  47. Fitting Transformation Homography: H Data: (x i ,y i ,x’ i ,y’ i ) for i =1,…,k H Model: [x’ i ,y’ i ,1] ≡ H [x i ,y i ,1] Objective function: It’s complicated

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend