2
$\begingroup$

I am fitting different 2D geometric transformations by least-squares.

For instance quadratic,

$$\begin{cases}a'x^2+b'xy+c'y^2+d'x+e'y+f'=X\\a''x^2+b''xy+c''y^2+d''x+e''y+f''=Y\end{cases}$$

which is linear in the unknowns $a',b',\cdots f''$.

I also solve homographic transformations

$$\begin{cases}\dfrac{a'x+b'y+c'}{dx+ey+1}=X\\\dfrac{a''x+b''y+c''}{dx+ey+1}=Y\end{cases}$$

by linearization,

$$\begin{cases}a'x+b'y+c'-dxX-eyX=X\\a''x+b''y+c''-dxY-eyY=Y.\end{cases}$$

This works fine.

But when I switch to the more complex rational model

$$\begin{cases}\dfrac{a'x^2+b'xy+c'y^2+d'x+e'y+f'}{gx+hy+1}=X\\\dfrac{a''x^2+b''xy+c''y^2+d''x+e''y+f''}{gx+hy+1}=Y\end{cases}$$

on the same points, the resolution by linearization always results in a solution such that the singular line $gx+hy+1=0$ crosses the $(x,y)$ point cloud and makes a poor fitting. I had expected that the fit would improve, as the number of adjustable parameters is larger.

Do you have a mathematical explanation of this phenomenon ?


Typical sample data ($x,y,X,Y$):

155,277,0,0
191,271,0,2
265,261,0,6
340,259,0,10
376,259,0,12
415,258,0,14
452,260,0,16
725,261,0,30
804,266,0,34
841,264,0,36
878,273,0,38
173,245,1,1
209,247,1,3
247,242,1,5
321,237,1,9
358,234,1,11
433,233,1,15
509,228,1,19
586,235,1,23
624,231,1,25
706,234,1,29
823,240,1,35
859,244,1,37
192,228,2,2
303,224,2,8
415,210,2,14
452,215,2,16
490,216,2,18
528,213,2,20
567,212,2,22
686,215,2,28
765,224,2,32
804,216,2,34
878,226,2,38
248,207,3,5
285,206,3,7
395,198,3,13
432,191,3,15
508,185,3,19
547,193,3,21
586,189,3,23
706,193,3,29
746,193,3,31
823,201,3,35
192,188,4,2
229,189,4,4
302,179,4,8
339,179,4,10
451,171,4,16
490,175,4,18
528,175,4,20
567,175,4,22
686,170,4,28
726,174,4,30
764,174,4,32
876,180,4,38
247,165,5,5
285,162,5,7
321,161,5,9
359,158,5,11
395,154,5,13
547,151,5,21
584,149,5,23
705,152,5,29
746,155,5,31
783,153,5,33
823,155,5,35
192,151,6,2
228,147,6,4
264,149,6,6
414,138,6,14
488,131,6,18
528,135,6,20
566,134,6,22
605,135,6,24
686,134,6,28
804,138,6,34
840,140,6,36
173,134,7,1
283,122,7,7
321,122,7,9
357,117,7,11
395,119,7,13
547,114,7,21
624,114,7,25
665,118,7,27
744,113,7,31
821,114,7,35
858,124,7,37
191,107,8,2
303,103,8,8
339,98,8,10
376,98,8,12
450,91,8,16
528,92,8,20
645,94,8,26
685,90,8,28
725,92,8,30
803,96,8,34
875,97,8,38
173,92,9,1
245,86,9,5
320,82,9,9
394,76,9,13
431,77,9,15
469,77,9,17
546,73,9,21
664,73,9,27
704,70,9,29
857,77,9,37
155,74,10,0
190,69,10,2
227,67,10,4
302,60,10,8
413,56,10,14
527,50,10,20
565,48,10,22
604,51,10,24
644,50,10,26
724,49,10,30
763,51,10,32
802,51,10,34
839,55,10,36
$\endgroup$
7
  • $\begingroup$ By any chance, can you share your data? Can you describe how it was generated? $\endgroup$
    – Dmitry
    Oct 31, 2022 at 18:55
  • $\begingroup$ @Dmitry: the data was taken from real world images, with known correspondences on approximate grids. Weak perspective and little deformation. $\endgroup$
    – user16034
    Oct 31, 2022 at 19:44
  • $\begingroup$ I have a bit unrelated question: why do you do the linearization at all? While I don't have an answer to your question (why the linear numerator works fine while the quadratic one doesn't), it totally makes sense that there are problems when the denominator is close to 0. The least squares works fine with rational functions out of the box (and indeed, as you expect, the quadratic numerator results in a substantially smaller loss (although just a bit smaller than your first, non-fractional, approach)). $\endgroup$
    – Dmitry
    Oct 31, 2022 at 21:36
  • $\begingroup$ @Dmitry: the nonlinear problem is much less attractive, as it takes Levenberg-Marquardt, a good starting solution, and is iterative. $\endgroup$
    – user16034
    Oct 31, 2022 at 22:09
  • $\begingroup$ @Dmitry: When I solve the homographic case, the solution stays well away from a zero denominator. $\endgroup$
    – user16034
    Oct 31, 2022 at 22:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.