<<

Fast and Stable Solving and Its Application to Computer Vision

Byröd, Martin; Josephson, Klas; Åström, Karl

Published in: International Journal of Computer Vision

DOI: 10.1007/s11263-009-0235-z

2009

Link to publication

Citation for published version (APA): Byröd, M., Josephson, K., & Åström, K. (2009). Fast and Stable Polynomial Equation Solving and Its Application to Computer Vision. International Journal of Computer Vision, 84(3), 237-256. https://doi.org/10.1007/s11263- 009-0235-z

Total of authors: 3

General rights Unless other specific re-use rights are stated the following general rights apply: Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain • You may freely distribute the URL identifying the publication in the public portal

Read more about Creative commons licenses: https://creativecommons.org/licenses/ Take down policy If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately and investigate your claim.

LUND UNIVERSITY

PO Box 117 221 00 Lund +46 46-222 00 00

Download date: 04. Oct. 2021 Centre for Mathematical Sciences LUP Lund University Publications Institutional Repository of Lund University Found at: http://www.lu.se

This is an author produced version of a paper published in International Journal of Computer Vision

This paper has been peer-reviewed but does not include the final publisher proof-corrections or journal pagination.

Citation for the published paper: Author: Martin Byrod,¨ Klas Josephson and Kalle Astr˚ om¨ Title: Fast and Stable Polynomial Equation Solving and Its Application to Computer Vision, Journal: International Journal of Computer Vision, 2009

DOI: 10.1007/s11263-009-0235-z Access to the published version may require subscription. Published with permission from: Springer Netherlands

Noname manuscript No. (will be inserted by the editor)

Fast and Stable Polynomial Equation Solving and its Application to Computer Vision

Martin Byrod¨ Klas Josephsson Kalle Astr˚ om¨ · ·

the date of receipt and acceptance should be inserted later

Abstract This paper presents several new results on tech- problems, e.g. [11, 29, 42]. Solutions to minimal structure niques for solving systems of polynomial in com- and motion problems can often be used in RANSAC algo- puter vision. Grobner¨ basis techniques for equation solving rithms to find inliers in noisy data [17, 43, 44]. For such have been applied successfully to several geometric com- applications one needs to efficiently solve a large number puter vision problems. However, in many cases these meth- of minimal structure and motion problems in order to find ods are plagued by numerical problems. In this paper we de- the best of inliers. There is thus a need for fast and nu- rive a generalization of the Grobner¨ basis method for poly- merically stable for solving particular systems nomial equation solving, which improves overall numeri- of polynomial equations. Recent applications of polynomial cal stability. We show how the action can be com- techniques in computer vision include solving for funda- puted in the general setting of an arbitrary linear basis for mental and essential matrices and radial distortion [9], pano- C[x]/I. In particular, two improvements on the stability of ramic stitching [4] and pose with unknown focal length [5]. the computations are made by studying how the linear basis Another area of recent interest is global optimization for C[x]/I should be selected. The first of these strategies used e.g. for optimal triangulation, resectioning and funda- utilizes QR with column pivoting and the sec- mental matrix estimation. Global optimization is a promis- ond is based on singular value decomposition (SVD). More- ing, but difficult pursuit and different lines of attack have over, it is shown how to improve stability further by an adap- been tried, e.g. branch and bound [1], L -norm methods ∞ tive scheme for truncation of the Grobner¨ basis. These new [21,26] and methods using linear matrix inequalities (LMIs) techniques are studied on some of the latest reported uses of [27]. An alternative way to find the global optimum is to Grobner¨ basis methods in computer vision and we demon- calculate stationary points directly, usually by solving some strate dramatically improved numerical stability making it polynomial equation system [22, 41]. So far, this has been possible to solve a larger class of problems than previously an approach of limited applicability since calculation of sta- possible. tionary points is numerically difficult for larger problems. By using the methods presented in this paper it is possible to handle a somewhat larger class of problems, thus offering 1 Introduction an alternative to the above mentioned optimization methods. An example of this is optimal three view triangulation which Numerous geometric problems in computer vision involve has previously not been solved in a practical way [41]. We the solution of systems of polynomial equations. This is par- show that this problem can now be solved efficiently with an ticularly true for so called minimal structure and motion implemented in standard IEEE double precision. Martin Byrod¨ Klas Josephson Kalle Astr˚ om¨ Traditionally, researchers have hand-coded elimination · · Centre for Mathematical Sciences, Lund University, Solvegatan¨ 18 schemes in order to solve systems of polynomial equations. 22100 Lund, Sweden, E-mail: [email protected] Recently, however, new techniques based on algebraic ge- Klas Josephson ometry and numerical have been used to find E-mail: [email protected] all solutions, cf . [37]. The outline of such algorithms is that Kalle Astr˚ om¨ one first studies a specific geometric problem and finds out E-mail: [email protected] what structure the Grobner¨ basis of the ideal I has for that 2 problem, how many solutions there are and what the degrees implementations of these algorithms in e.g. LAPACK [2], of monomials occurring in the Grobner¨ basis elements are. which makes this technique accessible and relatively straight- For each instance of the problem with numerical data, the forward to implement. process of forming the Grobner¨ basis follows the same steps The second technique for basis selection goes one step and the solution to the problem can be written down as a se- further and employs singular value decomposition (SVD) to quence of pre determined elimination steps using numerical select a general linear basis of for C[x]/I. This linear algebra. technique is computationally more demanding than the QR Currently, the limiting factor in using these methods for method, but yields somewhat better stability. larger and more difficult cases is numerical problems. For Finally, we show how a redundant linear basis for C[x]/I example in [41] it was necessary to use emulated 128 bit can be combined with the above basis selection techniques. numerics to make the system work, which made the imple- In the QR method, since the pivot elements are sorted in mentation very slow. This paper improves on the state of the descending order, we get an adaptive criterion for where to art of these techniques making it possible to handle larger truncate the Grobner¨ basis like structure by setting a max- and more difficult problems in a practical way. imal threshold for the quotient between the largest and the In the paper we pinpoint the main source of these nu- smallest pivot element. When the quotient exceeds this thresh- merical problems (the conditioning of a crucial elimination old we abort the elimination and move the remaining columns step) and propose a range of techniques for dealing with this into the basis. This way, we expand the basis only when nec- issue. The main novelty is a new approach to the action ma- essary. trix method for equation solving, relaxing the need of ad- The paper is organized as follows. After a brief discus- hering to a properly defined monomial order and a complete sion of related techniques for polynomial equation solving Grobner¨ basis. This unlocks substantial freedom, which in in Section 1.1, we give an overview of the classical theory this paper is used in a number of different ways to improve of algebraic underlying the ideas presented in this stability. paper in Section 2. Thereafter, in Section 3, we present the Firstly, we show how the sensitive elimination step can theoretical underpinnings of the new numerical techniques be avoided, by using an overly large/redundant basis for C[x]/I introduced here. The main contributions in terms of numer- to construct the action matrix. This method yields the right ical techniques are given in Sections 4, 5 and 6. In Section 7 solutions along with a set of false solutions that can then we evaluate the speed and numerical stability of the pro- easily be filtered out by evaluation in the original equations. posed techniques on a range of previously solved and un- Note that this basis is not a true basis in the sense that it is solved geometric computer vision problems and finally we linearly dependent. give some concluding remarks. Secondly, we show how a change of basis in the quo- tient space C[x]/I can be used to improve the numerical 1.1 Related Work precision of the Grobner¨ basis computations. This approach can be seen as an attempt at finding an optimal reordering The area of polynomial equation solving is currently very or even linear combination of the monomials and we inves- active. See e.g. [10] and references therein for a comprehen- tigate what conditions such a reordering/linear combination sive exposition of the state of the art in this field. needs to satisfy. We develop the tools needed to compute the One of the oldest and still used methods for non-linear action matrix in a general linear basis for C[x]/I and pro- equation solving is the Newton-Raphson method which is pose two strategies for selecting a basis which enhances the fast and easy to implement, but relies heavily on initializa- stability of the solution procedure. tion and finds only a single zero for each initialization. In The first of these is a fast strategy based on QR factoriza- the univariate case, a numerically sound procedure to find tion with column pivoting. The Grobner¨ basis like compu- the complete set of roots is to compute the eigenvalues of tations employed to solve a system of polynomial equations the companion matrix. However, if only real solutions are can essentially be seen as matrix factorization of an under- needed, the fastest way is probably to use Sturm sequences [24]. determined linear system. Based on this insight, we combine In several variables a first method is to use resultants [13], the robust method of QR factorization from numerical linear which using a determinant construct enables the successive algebra with the Grobner¨ basis theory needed to solve poly- elimination of variables. However, the resultant grows ex- nomial equations. More precisely, we employ QR factoriza- ponentially in the number of variables and is in most cases tion with column pivoting in the above mentioned elimina- not practical for more than two variables. In some cases, a tion step and obtain a simultaneous selection of linear basis related technique known as the hidden method can and triangular factorization. be used to eliminate variables, see e.g. [33]. An alternative Factorization with column pivoting is a very well stud- way of eliminating variables is to compute a lexicographi- ied technique and there exist highly optimized and reliable cal Grobner¨ basis for the ideal generated by the equations 3 which can be shown to contain a univariate polynomial rep- I = g C[x]: g = Σihi(x)fi(x) , where hi C[x] are { ∈ } ∈ resenting the solutions [13]. This approach is however often any polynomials and C[x] denotes the set of all polynomials numerically unstable. in x over the complex . A radically different approach is provided by homotopy The motivation for studying the ideal I is that it is a gen- continuation methods [45]. These methods typically work in eralization of the set of equations (1). A point x is a zero of conjunction with mixed volume calculations by constructing (1) iff it is a zero of I. Being even more general, we could a simple polynomial system with the same number of zeros ask for the complete set of polynomials vanishing on V . If I as the actual system that is to be solved. The simple system is equal to this set, then I is called a radical ideal. with known zeros is then continuously deformed into the We say that two polynomials f, g are equivalent modulo actual system. The main drawback of these methods is the I iff f g I and denote this by f g. With this definition − ∈ ∼ computational complexity with computation time ranging in we get the quotient space C[x]/I of all equivalence classes seconds or more. modulo I. Further, we let [ ] denote the natural projection · At present, the best methods for geometric computer vi- C[x] C[x]/I, i.e. by [fi] we mean the set gi : fi gi → { − ∈ sion problems are based on eigendecomposition of a certain I of polynomials equivalent to f modulo I. } i matrices (action matrices) representing multiplication in the A related structure is C[V ], the set of equivalence classes quotient space C[x]/I. The action matrix can be seen as a of polynomial functions on V . We say that a F direct generalization of the companion matrix in the univari- is polynomial on V if there is a polynomial f such that ate case. The factors that make this approach attractive is F (x) = f(x) for x V and equivalence here means equal- ∈ that it (i) is fast and numerically feasible, (ii) handles more ity on V . If two polynomials are equivalent modulo I, then than two variables and reasonably large numbers of solu- they are obviously also equal on V . If I is radical, then con- tions (up to about a hundred) and (iii) is well suited to tun- versely two polynomials which are equal on V must also ing for specific applications. To the authors best knowledge, be equivalent modulo I. This means that for radical ide- this method was first used in the context of computer vision als, C[x]/I and C[V ] are isomorphic. Now, if V is a point by Stewenius et al. [37] even though Grobner¨ basis methods set, then any function on V can be identified with a V - | | were mentioned in [23]. dimensional vector and since the unisolvence theorem for The work presented in this paper is based on preliminary polynomials guarantees that any function on a discrete set results presented in [6–8] and essentially develops the action of points can be interpolated exactly by a polynomial, we matrix method further to resolve numerical issues arising in get that C[V ] is isomorphic to Cr, where r = V . | | the construction of the action matrix. Using the methods pre- sented here, it is now possible to solve a larger class of prob- lems than previously possible. 2.1 The Action Matrix

Turning to equation solving, our starting point is the com- 2 Review of for Equation Solving panion matrix which arises for polynomials in one variable. For a third degree polynomial In this section we review some of the classical theory of mul- 3 2 tivariate polynomials. We consider the following problem p(x) = x + a2x + a1x + a0, (2)

Problem 1 Given a set of m polynomials fi(x) in s vari- the companion matrix is ables x = (x1, . . . , xs), determine the complete set of solu- tions to a 1 0 − 2 a 0 1 . (3) f (x) = 0 − 1  1 a 0 0 . − 0 . (1)   The eigenvalues of the companion matrix are the zeros of fm(x) = 0. p(x) and for high degree polynomials, this provides a nu- We denote by V the zero set of (1). In general V need not merically stable way of calculating the roots. be finite, but in this paper we will only consider zero dimen- With some care, this technique can be extended to the sional V , i.e. V is a point set. multivariate case as well, which was first done by Lazard The general field of study of multivariate polynomials is in 1981 [32]. For V finite, the space C[x]/I is finite di- algebraic geometry. See [13] and [12] for a nice introduc- mensional. Moreover, if I is radical, then the dimension of tion to the field and for proofs of all claims made in this sec- C[x]/I is equal to V , i.e. the number of solutions [13]. For | | tion. In the language of algebraic geometry, V is an affine some p C[x] consider now the operation Tp : f(x) ∈ → and the polynomials fi generate an ideal p(x)f(x). The operator Tp is linear and since C[x]/I is 4

G finite dimensional, we can select a linear basis of poly- pb for each basis element b , which is easily done if G is B i i nomials for C[x]/I and represent Tp as a matrix mp. This available. matrix is known as the action matrix and is precisely the generalization of the companion matrix we are looking for. Example 1 The following two equations describe the inter- section of a and a circle The eigenvalues of mp are p(x) evaluated at the points of V . Moreover, the eigenvectors of mT equals the vector of ba- x2 + y2 1 = 0 p − (6) sis elements evaluated on V . Briefly, this can be understood x y = 0. − as follows: Consider an arbitrary polynomial p(x) = cT b, A Grobner¨ basis for this system is where c is a vector of coefficients and b is a vector of poly- 1 nomials forming a basis of C[x]/I. We then have y2 = 0 − 2 (7) x y = 0, [p cT b] = [(m c)T b] = [cT mT b]. (4) − · p p from which we trivially see that the solutions are 1 (1, 1) √2 This holds for any coefficient vector c and hence it follows 1 T T and √ ( 1, 1). In this case = y, 1 are representatives that [pb] = [mp b], which can be written pb = mp b + g 2 − − B { } for a basis for [x]/I and we have Tx[1] = [x] = [y] and for some vector g with components gi I. Evaluating the C ∈ T [y] = [xy] = [y2] = [ 1 ] expression at a zero ¯x V we get g(x) = 0 and thus obtain x 2 , which yields the action matrix ∈ T 0 1 p(¯x)b(¯x) = mp b(¯x), (5) m = , (8) x 1 0  2  which we recognize as an eigenvalue problem on the matrix 1 1 T with eigenvalues , . mp with eigenvectors b(¯x). In other words, the eigenvec- √2 − √2 ut T tors of mp yield b(x) evaluated at the zeros of I and the eigenvalues give p(x) at the zeros. The conclusion we can 2.3 A Note on Algebraic and Linear Bases draw from this is that zeros of I corresponds to eigenvectors and eigenvalues of mp, but not necessarily the opposite, i.e. At this point there is a potentially confusing situation since there can be eigenvectors/eigenvalues that do not correspond there are two different types of bases at play. There is the to actual solutions. If I is radical, this is not the case and we linear basis of the quotient space C[x]/I and there is the B have an exact correspondence. algebraic basis (Grobner¨ basis) G of the ideal I. To make the subsequent arguments as transparent as possible for the reader we will emphasize this fact by referring to the former 2.2 Grobner¨ Bases as a linear basis and the latter as an algebraic basis.

We have seen theoretically that the action matrix mp pro- vides the solutions to a corresponding system of polynomial 2.4 Floating Point Grobner¨ Basis Computations equations. The main issue is now how to compute mp. This is done by selecting a basis for C[x]/I and then com- B The well established Buchberger’s algorithm is guaranteed puting [p b ] for each b . To do actual computations · i i ∈ B to compute a Grobner¨ basis in finite time and works well in in C[x]/I we need to represent each equivalence class [f] exact arithmetic [13]. However, due to round-off errors, it by a well defined representative polynomial. The idea is to easily becomes unstable in floating point arithmetic and ex- use multivariate polynomial division and represent [f] by cept for very small examples it becomes practically useless. the remainder under division of f by I. Fortunately, for any The reason for this is that in the Grobner¨ basis computa- polynomial ideal I, this can always be done and the tool for tion, leading terms are successively eliminated from the gen- doing so is a Grobner¨ basis G for I [13]. The Grobner¨ basis erators of I by pairwise subtraction of polynomials, much for I is a canonical set of generators for I with the property like Gaussian elimination. This leads to cancellation effects G that multivariate division by G, denoted f , always yields where it becomes impossible to tell whether a certain coef- a well defined remainder. By well defined we mean that for ficient should be zero or not. G G any f , f [f], we have f = f . The Grobner¨ basis is A technique introduced by Faugere et al. in [16] is to 1 2 ∈ 1 2 computed relative a monomial order and will be different for write the system of equations on matrix form different monomial orders. As a consequence, the set of rep- CX = 0, (9) resentatives for C[x]/I will be different, whereas the space T itself remains the same. where X = xα1 ... xαn is a vector of monomials with αk αk1 αks The linear basis should consist of elements bi such that the notation x = x1 xs and C is a matrix of coef- rB G  ··· the elements [bi] together span C[x]/I and bi = bi. ficients. Elimination of leading terms now translates to ma- { }i=1 Then all we have to do to get mp is to compute the action trix operations and we then have access to a whole battery 5 of techniques from numerical linear algebra allowing us to in how the action matrix is computed. It should however be perform many eliminations at the same time with control on noted that a fundamental limitation still remains. As is the pivoting etc. case with all other floating point methods, we do not present This technique takes us further, but for larger more de- an algorithm which is guaranteed to work for all situations. manding problems it is necessary to study a particular class To some extent, the method relies on heuristics and will only of equations (e.g. relative orientation for omnidirectional cam- work if certain conditions can be fulfilled. As we show later, eras [18], fundamental matrix estimation with radial distor- it does however expand the domain of application compared tion [30], optimal three view triangulation [41], etc.) and use to previous methods. We start with a few examples that we knowledge of what the structure of the Grobner¨ basis should will use to clarify these ideas. be to design a special purpose Grobner¨ basis solver [37]. The typical work flow has been to study the particular prob- Example 2 In the five point relative orientation problem for lem at hand with the aid of a such calibrated cameras, cf . [14,29,34,38], the calculation of the as Maple or Macaulay2 and extract information such as the essential matrix using 5 point correspondences leads leading terms of the Grobner¨ basis, the monomials to use as to 10 equations of degree 3 in 3 unknowns. These equations a basis for C[x]/I, the number of solutions, etc. and work involve 20 monomials. By writing the equations as in (9) out a specific set of larger (gauss-jordan) elimination steps and using a total degree ordering on the monomials we get a leading to the construction of a Grobner¨ basis for I. coefficient matrix C of size 10 20 and a monomial vector × Although, these techniques have permitted the solution X = [xα1 ... xαn ]T with 20 monomials. It turns out that to a large number of previously unsolved problems, many the first 10 10 block C1 of C = [C1 C2] is in general × difficulties remain. Most notably, the above mentioned elim- of full rank and thus the first 10 monomials X1 can be ex- ination steps (if at all doable) are often hopelessly ill condi- pressed in terms of the last 10 monomials X2 as tioned [31, 41]. This is in part due to the fact that one has 1 focused on computing a complete and correct Grobner¨ ba- X1 = C1− C2X2. (10) − sis respecting a properly defined monomial order, which we show is not necessary. This makes it possible to regard the monomials in X2 as rep- In this paper we move away from the goal of computing resentatives of a linear basis for C[x]/I. It is now straight- a Grobner¨ basis for I and focus on finding a representative forward to calculate the action matrix for Tx (the multipli- of f in terms of a linear combination of a basis , since this cation operator for multiplication by x) since monomials in B is the core of constructing mp. We denote this operation f the linear basis are either mapped to monomials in the basis for a given f C[x]. Specifically, it is not necessary to be or to monomials in X1, which can be expressed in terms of ∈ able to compute f for a general f C[x]. To construct mp, the basis using (10). ∈ ut we only need to worry about finding f for f p , ∈ B\B which is an easier task. It should however be noted that the In this example the linear basis X2 was thought of as computations we do much resemble those necessary to get a a basis for the space of remainders after division with a Grobner¨ basis. Grobner¨ basis for one choice of monomial order and this is A further advantage of not having to compute a com- how these computations have typically been viewed. How- plete Grobner¨ basis is that we are not bound by any partic- ever, the calculations above are not really dependent on any ular monomial order which as we will see, when used right, properly defined monomial order and it seems that they should buys considerable numerical stability. In addition to this we be meaningful irrespective of whether a true monomial or- introduce an object which generalizes the action matrix and der is used or not. Moreover, we do not use all the Grobner¨ basis properties. can be computed even when a true linear basis for C[x]/I cannot be used. Based on these observations we again emphasize two Drawing on these observations, we investigate in detail important facts: (i) We are not interested in finding the Grobner¨ the exact matrix operations needed to compute f and thus basis or a basis for the remainder space relative to some obtain a procedure which is both faster and more stable, en- Grobner¨ basis per se; it is enough to get a well defined map- abling the solution of a larger class of problems than previ- ping f and (ii) it suffices to calculate f on the elements x xαi , i.e. we do not need to be able to compute f for all ously possible. · f C[x]. These statements and their implications will be ∈ made more precise further on. 3 A New Approach to the Action Matrix Method Example 3 Consider the equations In this section we present a new way of looking at the action matrix method for polynomial equation solving. The advan- f = xy + x y 1 = 0 1 − − (11) tage of the new formulation is that it yields more freedom f = xy x + y 1 = 0, 2 − − 6 with solutions ( 1, 1), (1, 1). Now let = x, y, 1 be a and some p C[x] we express pbi as a linear combination − − B { } ∈ set of representatives for the equivalence classes in C[x]/I of basis elements as for this system. The set does not constitute a proper basis B p(x)bi(x) = Σjmijbj(x) (12) for C[x]/I since the elements of represent linearly de- B pendent equivalence classes. They do however span C[x]/I. for some (not necessarily unique) coefficients mij and x ∈ Now study the operator Ty acting on . We have Ty[1] = V , then we call a solving basis for (1) w.r.t p. B 2 B ut [y], Ty[x] = [xy] = [x y + 1] and Ty[y] = [y ] = [xy] = − We now get the following for the matrix mp made up of [x y + 1] which gives a multiplication matrix − the coefficients mij. 1 1 0 Theorem 1 Given a solving basis for (1) w.r.t p, the eval- 1 1 1 . B − −  uation of p on V is an eigenvalue of the matrix mp. More- 1 1 0 T over, the vector b = (b1, . . . , br) evaluated on V is an   An eigendecomposition of this matrix yields the solutions eigenvector of mp. ( 1, 1), (1, 1), ( 1, 0). Of these the first two are true so- − − − Proof By the definition of mp, we get lutions to the problem, whereas the last one does not satisfy the equations and is thus a false zero. pb1 Σjm1jbj ut . . p(x)b(x) =  .  =  .  = mpb(x) (13) In this example we used a set of monomials whose B pbr Σjmrjbj corresponding equivalence classes spanned [x]/I, but were     C     not linearly independent. However, it was still possible to for x V . ∈ ut express the image T ( ) of the set under T in terms y B B y As will become clear further on, when is a true basis of . The elements of the resulting action matrix are not B B for C[x]/I, then the matrix mp defined here is simply the uniquely determined. Nevertheless we were able to use it to transposed action matrix for multiplication by p. find the solutions to the problem. In this section we give gen- Given a solving basis, the natural question to ask is now eral conditions for when a set can be used to construct a B under which circumstances all solutions to the related sys- multiplication matrix which produces the desired set of ze- tem of equations can be obtained from an eigenvalue de- ros, possibly along with a set of false zeros, which need to composition of m . We next explore some conditions under be filtered out. p which this is possible. A starting point is the following defi- More generally this also means that the chosen represen- nition tatives of the linear basis of C[x]/I need not be low order monomials given by a Grobner¨ basis. In fact, they need not Definition 2 A solving basis is called a complete solving B be monomials at all, but could be general polynomials. basis if the inverse image of the mapping x b(x) from → Drawing on the concepts illustrated in the above two ex- variables to monomial vector is finite for all points. ut amples we define a solving basis, similar to in Example 3. B A complete solving basis allows us to recover all solu- The overall purpose of the definition is to rid our selves of tions from mp as shown in the following theorem. the need of talking about a Grobner¨ basis and properly de- Theorem 2 Let be a complete solving basis for (1) with r fined monomial orders, thus providing more room to derive B numerically stable algorithms for computation of the action elements and mp as above and assume that for all eigenval- ues λ we have λ = λ for i = j. Then the complete set of matrix and similar objects. i i 6 j 6 In the following we will also provide techniques for de- solutions to (1) can be obtained from the set of eigenvectors termining if a candidate basis constitutes a solving basis vi of mp. B { } and we will give numerically stable techniques for basis se- Proof Due to Theorem 1, we know that the vector of mono- lection in too large (linearly dependent) solving bases, here mials b(x) evaluated on a point in the set of zeros V is an referred to as redundant bases. eigenvector of mp. The number of eigenvectors and eigen- values of mp is finite. This means that if we compute all eigenvectors w of m , then the set of vectors b(x¯): 3.1 Solving Bases { i} p { x¯ V must be a subset of w . We now consider b(x) ∈ } { i} as a mapping b : Rs Rr and look at the inverse image We start off with a set of polynomial equations as in (1) and 1 7→ b− (vi). By the requirements, this is finite for all i and ap- a (point) set of zeros V (f1, . . . , fm) and make the following plying b 1 to all w thus yields a finite set of points which definition. − i must contain V . Evaluation in (1) allows us to filter out the Definition 1 Consider a finite subset C[x] of the set of points of this set which are not in V (and hence not solutions B ⊂ polynomials over the complex numbers. If for each b to (1)). i ∈ B ut 7

If on the other hand the inverse image is not finite for Theorem 3 If the ideal I generated by (1) is radical, then a some v so that we get a family x corresponding complete solving basis w.r.t to p for (1) with the property i B to this eigenvector, then the correct solution can typically that all eigenvalues of mp are distinct spans C[x]/I. not be obtained without further use of the equations (1) as Proof Since I is radical, C[x]/I is isomorphic to C[V ], the illustrated in the following example. ring of all polynomial functions on V . Moreover, since V Example 4 Consider the polynomial system is finite, all functions on V are polynomial and hence C[V ] can be identified with Cr, where r = V . Consider now | | y2 2 = 0 the matrix B = b(x ),..., b(x ) . Each row of B corre- − (14) 1 r x2 1 = 0 sponds to a (polynomial) function on V . Hence, if we can −   show that B has row rank r, then we are done. Due to The- with V = (1, √2), ( 1, √2), (1, √2), ( 1, √2), . Clearly, { − − − } orem 1, all b(xi) are eigenvectors of mp corresponding to = x, 1 with monomial vector b(x, y) = [x 1]T , is a B { } eigenvalues p(xi). By the assumption of distinct eigenvalues solving basis w.r.t x for this example since 1 x = x and we have p(xi) = p(xj) whenever b(xi) = b(xj). Since 2 · 6 6 B x x = x = 1 on V . Hence, b(x, y) evaluated on V is an is a complete solving basis we have b(x ) = b(x ) when- · i 6 j eigenvector of ever x = x . This means that the r points in V correspond i 6 j 0 1 to distinct eigenvalues and hence, since eigenvectors corre- m = , (15) x 1 0 sponding to different eigenvalues are linearly independent,   B has column rank r. For any matrix row rank equals col- which is easily confirmed. However, these eigenvectors do umn rank and we are done. ut not provide any information about the y-coordinate of the The above theorem provides a correspondence between solv- solutions. We could try adding y to but this would not B ing bases and linear bases for C[x]/I and in principle states work since the values of xy on V cannot be expressed as that under some extra restrictions, a solving basis is simply a a linear combination of x and y evaluated on V . A better certain choice of linear basis for C[x]/I and then the matrix choice of solving basis would be = xy, x, y, 1 . B { } ut mp turns into the transposed action matrix. At a first glance, Theorem 2 might not seem very use- However, relaxing these restrictions we get something which is not necessarily a basis for [x]/I in the usual sense, ful since solving for x from b(x) = vi potentially involves C solving a new system of polynomial equations. However, it but still serves our needs in terms of equation solving. More provides a tool for ruling out choices of which are not specifically, using the concept of a solving basis provides B practical to work with. Moreover, there is usually much free- two distinctive advantages. dom in the choice of . In general, can be a set of poly- (i) For a radical polynomial system with r zeros, C[x]/I B B nomials. However, it is often practical to work with a basis is r-dimensional, so a basis for C[x]/I contains r elements. of monomials. We get a particularly convenient situation if This need not be the case for a solving basis, which could the coordinate variables x are included in as seen in the well contain more than r elements, but due to Theorem 2 i B following straight forward result: still provides the right solutions. This fact is exploited in Section 4. Corollary 1 If 1, x1, . . . , xs , then all solutions to (ii) Typically, the arithmetics in C[x]/I has been com- { } ⊂ B (1), can be directly read off from the eigenvectors of mxk . puted using a Grobner¨ basis for I, which directly provides a monomial basis for C[x]/I in form of the set of mono- Proof Since the monomials 1, x , . . . , x occur in , they { 1 s} B mials which are not divisible by the Grobner¨ basis. In this enter in the vector b(x) and hence the mapping in Definition work we move focus from Grobner¨ basis computation to the 2 is injective with a trivial inverse. ut actual goal of expressing the products pbi in terms of a set of linear basis elements and thus no longer need to adhere This fact suggests that we should always try to include to the overly strict ordering rules imposed by a particular the coordinate variables in to make for easy extraction B monomial order. This freedom is exploited in Sections 5.1 of the final solutions. In practice, this is nearly always easy and 5.2. to do. And even if for some reason a few variables have to Finally, (i) and (ii) are combined in Section 5.3. be left out, we can often still express each variable xk as a linear combination of the basis elements b (x) for x V by i ∈ making use of the original equations. We thus again obtain 3.2 Solving Basis Computations using Numerical Linear a well defined inverse to the mapping in Definition 2. Algebra Finally, we show how the concept of solving basis con- nects to the standard theory of action matrices in the quotient We now describe the most straight forward technique for de- space C[x]/I. ciding whether a candidate basis w.r.t. one of the variables B 8 xk, can be used as a solving basis and simultaneously calcu- Result 1 Algorithm 1 yields the complete set of zeros of a late the action of T on the elements of . polynomial system, given that the pre- and postconditions xk B We start by generating more equations by multiplying are satisfied. the original set of equations by a hand crafted (problem de- Proof The postcondition that C 2 is of full rank ensures pendent) set of monomials. This yields additional equations, R that is a solving basis and together with the preconditions, which are equivalent in terms of solutions, but hopefully lin- B Theorem 2 and Corollary 1 then guarantees the statement. early independent from the original ones. In Example 4, we could multiply by e.g. x, y, 1 , yielding xy2 2x, x3 ut { } − − x, y3 2y, x2y y, y2 2, x2 1. The general question So far, we have given general conditions for when a can- − − − − of which and how many additional equations to generate is didate basis can be a solving basis, but we have not said B a tough one and there exist no watertight answers. This has anything about how a candidate basis can be chosen. A set to do with the fact that computing a Grobner¨ basis is an NP which is guaranteed to be a solving basis can be found by B hard problem in general. The rule of thumb is to start out fixating a monomial order and then computing a Grobner¨ ba- with a small set of equations and then sequentially adding sis symbolically using a computer algebra system. One can more equations until the computations go through. However, then collect all monomials which are not divisible by any some additional insight into the difficulty of the problem can leading monomial in the Grobner¨ basis which yields a solv- be obtained by studying it symbolically using a computer al- ing basis. However, any set which includes these monomials gebra system, e.g. Macaulay2 [3]. will also be a solving basis and in applications it turns out Given a candidate for a linear basis of monomials that a somewhat larger set is often beneficial for numer- B B one then partitions the set of all monomials occurring ical stability. A strategy which works well in practice is to M in the equations in to three parts = . The set start with the lowest order monomials and then sequentially M E R B = xk is the set of monomials that need to be ex- add more monomials until enough have been added to make R B\B S S pressed in terms of to satisfy the definition of a solving it a solving basis and to ensure numerical stability. B basis and = ( ) is the set of remaining (ex- E M\ R B cessive) monomials. Each column in the coefficient matrix Example 5 Consider the equations from Example 1. Multi- S represents a monomial, so we reorder the columns and write plying the second equation by x and y yields the enlarged system C = C CR CB , (16) E x2 reflecting the above partition. The -monomials are not of 1 0 1 0 0 1 xy E − interest in the action matrix computation so we eliminate 1 1 0 0 0 0 y2   −  = 0, (20) them by putting C on row echelon form using LU factor- 0 1 1 0 0 0  x  E −   ization 0 0 0 1 1 0   y   −    X    1  U C C E   1 1 1   E R B X = 0. (17) 2 2 0 C 2 C 2  R with = x , xy, y , x, y, 1 and since we chose =  R B  X M { } B B y, 1 , we get = xy, x and = x2, y2 . After Step   { } R { } E { 2 0} We now discard the top rows and provided that enough 11 and 12 of Algorithm 1 we have C 2 = [ 0 1 ] and C 2 = 0 1 R B linearly independent equations were added in the first step 1− 0 and inserting into (19) we obtain 1 − so that C 2 is of full rank, we multiply by C−2 from the R R xy  0 1 y left producing = 2 , (21) x 1 0 1 1 X       IC−2C 2 R = 0, (18) R B X which then allows us to construct mx for this example.  B  ut   or equivalently A typical problem that might occur is that some eigen-

1 values of mxk are equal, which means that two or more ze- X = C−2C 2X , (19) R − R B B ros have equal xk-coordinate. Then the corresponding eigen- which means that the -monomials can be expressed as a vectors can not be uniquely determined. This problem can be R linear combination of the basis monomials. Thus is a solv- resolved by computing m for several k and then forming B xk ing basis and the matrix mx can easily be constructed as a random linear combination ma x + +a x = a1mx + k 1 1 ··· s s 1 in (12). In other words, given an enlarged set of equations + a m , which then with very small probability has ··· s xs and a choice of linear basis , the full rank of C 2 is suffi- two equal eigenvalues. B R cient to solve (1) via eigendecomposition of mxk . The above As previously mentioned, computing mp for a larger method is summarized in Algorithm 1 and given the results problem is numerically very challenging and the predom- of Section 3.1 we now have the following: inant issue is expressing p in terms of , via something B B 9

Algorithm 1 Compute a solving basis w.r.t. xk and use it to 4 Using Redundant Solving Bases - The Truncation solve a polynomial system. Method Require: F = f1, . . . , fm , set of basis mono- { } mials containing the coordinate variables x1, . . . xs, m lists of B monomials L m . { i}i=1 As mentioned in Section 3, the sub matrix C 2 which ap- Ensure: C 2 is of full rank, eigenvalues of mx are distinct. R R k pears in Equation 17 is a large cause of numerical problems 1: Fext F ← 2: for all fi F do in the equation solving process. A typical situation with an ∈α 3: for all x j Li do ill conditioned or rank deficient C 2 is that there are a few ∈ α R 4: Fext Fext x j f ← { · i} problematic monomials where the corresponding columns 5: end for S in C are responsible for the deteriorated conditioning of 6: end for C 2. A straightforward way to improve the situation is to 7: Construct coefficient matrix C from Fext. R 8: The set of all monomials occurring in Fext. simply include the problematic monomials in , thus avoid- M ← 9: x B R ← k ·B\B ing the need to express these in terms of the other mono- 10: ( ) E ← M \ R B mials. In practice this means that some columns of C are 11: Reorder and partition C: C˜ = [C CR CB ]. R S E C 12: LU-factorize to obtain C 2 and C 2 as in (17). moved into . This technique is supported by Theorem 2, R B B 13: Use (19) to express x xαi in terms of and store the coefficients which guarantees that we will find the original set of solu- k · B m in xk . tions among the eigenvalues/eigenvectors of the larger mp 14: Compute eigenvectors of m and read off the tentative set of xk found using this redundant basis. The price we have to pay solutions. 15: Evaluate in F to filter out possible false zeros. is performing an eigenvalue decomposition on a larger ma- trix. similar to (19). The reason for this is that without proper Not all monomials from can be included in the ba- M care, C 2 tends to become very ill conditioned (condition sis while still enabling the calculation of the necessary R B numbers of 1010 or higher are not uncommon). This was multiplication matrices. In general it is a difficult question also the reason that extremely slow emulated 128 bit numer- exactly which monomials can be used or even if there ex- ics had to be used in [41] to get a working algorithm. ists a set among , which can be used as a solving ba- B M In Sections 4 and 5 we will investigate techniques to cir- sis. One can however see that has to be a subset of the B cumvent this problem and produce well conditioned C 2, following set, which we denote the permissible monomials, R thus drastically improving numerical stability. But first we = b : pb . The permissible monomials is P { ∈ M ∈ M} P will look at how to construct the action matrix given a solv- the set of monomials which stay in under multiplication M ing basis for a polynomial system. by p.

An example of how the redundant solving basis tech- 3.3 Constructing the Action Matrix nique can be used is provided by the problem of L2-optimal triangulation from three views [41]. The optimum is found Given a solving basis w.r.t. x and the corresponding vec- B k among the up to 47 stationary points, which are zeros of tor X for the polynomial system we wish to solve, it is easy B a polynomial system in three variables. In this example an to construct the corresponding action matrix. In short, this enlarged set of 255 equations in 209 monomials were used section fleshes out Step 13 of Algorithm 1. After perform- to get a Grobner¨ basis. Since the solution dimension r is ing Algorithm 1, the solving basis property of together B 47 in this case, the 47 lowest order monomials were used with (19) guarantees x = and the following: kB\B R as a basis for C[x]/I in [41], yielding a numerically diffi- X = AX , (22) cult situation. In fact, as will be shown in more detail in the R B experiments section, this problem can be solved by simply where A is a matrix encoding this relation. To construct including more elements in . In this example, the complete m , we start with m = 0 and sequentially go through B xk xk permissible set contains 154 monomials. By including all of all b . For each of them we perform one of two opera- i ∈ B these in leaving 55 monomials to be expressed in terms of tions B , we get a much smaller and in this case better conditioned 1. If x b = b , then we simply set position j of B k i j ∈ B elimination step. As mentioned above, this leads to a larger column i of mxk to 1. eigenvalue decomposition, but all true solutions can still be 2. Else we have xkbi = rj and we need to use (22) to found among the larger set of eigenvalues/eigenvectors. This ∈ R T express rj in terms of . This implies inserting Aj (row is illustrated in Figure 1, where the set of eigenvalues com- B · j of A transposed) as column i in mxk . puted from mxk for one instance are plotted in the complex Hence, given A, constructing the action matrix is a compu- together with the actual solutions of the polynomial tationally cheap operation. system. 10

0.4 At this point we could simply continue the Gaussian elim- Actual Solutions ination, with each new pivot element representing a mono- 0.3 The set of eigenvalues mial expressed in terms of the remaining basis monomials. 0.2 However, this typically leads to poor numerical performance 0.1 since, as previously mentioned, the elimination might be very ill conditioned. This is where the basis selection comes

Im 0 to play. −0.1 As noted above we can choose which of the p mono- −0.2 mials in to put in the basis and which to reduce. This is P −0.3 equivalent to choosing a permutation Π of the columns of

−0.4 C 2, −1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 P Re C 2Π = cπ(1) . . . cπ(p) (24) Fig. 1 Eigenvalues of the action matrix using the redundant basis P method and actual solutions to the polynomials system plotted in the and then proceed using standard elimination. The goal must plane. The former are a strict superset of the latter. thus be to make this choice so as to minimize the condition number κ( cπ(1) . . . cπ(p r) ) of the first p r columns of − − the permuted matrix. In its generality, this is a difficult com- 5 Basis Selection   binatorial . However, the task can be In the previous section we saw how it is possible to pick a approximately solved in an attractive way by QR factoriza- “too large” (> r elements) linear basis and still use it to tion with column pivoting [19]. With this algorithm, C 2 is P P solve the equations. In this section we show how one can factorized as select a true (linearly independent) basis as a subset of in P C 2Π = QU, (25) a numerically stable way and thus gain both speed and sta- P bility. In the following, denotes any subset of with the P M where Q is orthogonal and U is upper triangular. By solv- property that the obtained C 2 is of full rank, thus making R ing for C 2 in (25) and substituting into (23) followed by P a solving basis. I 0 P multiplication from the left with T and from the right Since the set V of zeros of (1) is finite with r points, 0 Q I 0 seen as a set of functions on V contains at most r lin- with [ 0 Π ], we get h i P early independent elements. It should therefore be possible U C 1Π X to choose a subset 0 such that the elements in 0 can R P R = 0. (26) P ⊂ P P 0 U ΠT X be expressed as linear combinations of elements in 0.    P  P\P By dropping 0 from the solving basis, the set = 0 We observe that U is in general not write U = P B P\P would thus constitute a new tighter solving basis w.r.t. the U 2 C 2 , where U 2 is square upper triangular. We P0 B P0 same multiplier p and ideal I as . T T P also write C 1Π = C 01 C 1 and Π X 1 = X 01 X  P P B P P B We now present two numerically stable techniques for yielding constructing a true basis from a redundant solving basis     B . X P U C 01 C 1 R R P B X 0 = 0. (27) 0 U 2 C 2  P   P0 B  X B 5.1 The QR Method   Finally

We start by selecting as large as possible, still yielding 1 P − a full rank C 2 and form [C C C ]. Any selection of X U C 01 C 1 R E R P R = R P B X (28) B basis monomials will then correspond to a matrix X 0 − 0 U 02 C 2 B ⊂ P  P   P   B  C consisting of a subset of the columns of C . B P is analogous to (19) and amounts to solving r upper triangu- By performing Gaussian elimination we again obtain (17), lar equation systems which can be efficiently done by back but with replaced by , letting us get rid of the -monomials B P E substitution. Given this relation we can now apply the recipe by discarding the top rows. Furthermore, the -monomials R of Section 3.3 to construct the action matrix. will all have to be expressed in terms of the -monomials P The reason why QR factorization fits so nicely within so we continue the elimination putting C 2 on triangular R this framework is that it simultaneously solves the two tasks form, obtaining of reduction to upper triangular form and numerically sound

U C 1 X column permutation and with comparable effort to normal R P R = 0. (23) 0 C 2 X Gaussian elimination.  P   P  11

Furthermore, QR factorization with column pivoting is a the corresponding elements without affecting any other ele- widely used and well studied algorithm and there exist free, ments in the matrix. In particular this means that we have highly optimized implementations [2], making this an ac- cessible approach. X 0 = 0 P 1 (32) Standard QR factorization successively eliminates ele- X = U− C X  R − R B B ments below the main diagonal by multiplying from the left with a sequence of orthogonal matrices (usually Householder on V , which allows us to express any elements in span( ) M transformations). For matrices with more columns than rows in terms of X , which makes a solving basis. B B (under-determined systems) this algorithm can produce a Computing the action matrix is complicated slightly by rank-deficient U which would then cause the computations the fact that we are now working with a polynomial ba- in this section to break down. QR with column pivoting sis rather than a monomial one. To deal with this situation solves this problem by, at iteration k, moving the column we introduce some new notation. To each element ek of T with greatest 2-norm on the last m k + 1 elements to po- ˜ = 0 we assign a vector vk = [ 0 ... 1 ... 0 ] − P P B ∈ sition k and then eliminating the last m k elements of ˜ , with a one at position k. Similarly, we introduce vec- − R|P| S this column by multiplication with an orthogonal matrix Qk. tors uk R|M|, wk R|B| representing elements of ∈ ∈ M See [19] for more about QR factorization and column pivot- and respectively. Further we define the linear mapping B ing. R : span( ) span( ˜), which using (32) associates an M → B element of span( ) with an element in span( ˜). We now M B represent R by a matrix 5.2 The SVD Method |B| × |M| T T R = C U− 0 I , (33) By considering not only monomial bases, but more general − B R polynomial bases it is possible to further improve numeri-   acting on the space spanned by the vectors uk. cal stability. We now show how singular value decomposi- We also introduce the mapping Mp : span( ) span( ) tion (SVD) can be used to construct a basis for C[x]/I as P → M given by Mp(f) = p f with the representation r linearly independent linear combinations of elements in a · solving basis . αi αj P (Mp)ij = I(x = p x ), (34) As in Section 5.1 we start out by selecting an as large · as possible (redundant) solving basis and perform prelimi- where I( ) is the indicator function. nary matrix operations forming (23), where the aim is now · M represents multiplication by p on . In the basis ˜ to construct a linearly independent basis from . We now p P P P induced by the change of basis aV we thus get do this by performing an SVD on C 2, writing P T I 0 C 2 = UΣV , (29) M˜ = M V. (35) P p 0 VT p   where U and V are orthogonal and Σ is diagonal with typ- Σ0 0 ically r last elements zero Σ = 0 0 for a system with r Finally, we get a representation of the multiplication map- solutions. ping from to as   I 0 B B Now multiplying from the left with 0 UT and from the right with [ I 0 ] in (23), we get m˜ = RM˜ L, (36) 0 V   p p

0 where L = [ I ] simply interprets the wk R|B| vectors as U C 1V X ∈ R P R = 0. (30) ˜ 0 Σ VT X R|P|-vectors. The matrix m˜ p derived here is the transpose    P  of the corresponding matrix in Section 3.1. T The matrix V induces a change of basis in the space An eigendecomposition of m˜ p yields a set of eigenvec- T ˜ T X X spanned by and we write X = V X = [ 0 ] , tors v˜ in the new basis. It remains to inverse transform these P P P P B where 0 and are now sets of polynomials. Using this eigenvectors to obtain eigenvectors of mT . To do this, we P B p notation we get need to construct the change of basis matrix Vq in the quo- tient space. Using R and L, we get V 1 = ΠVT L, where U 0 C X q− 0 R B R Π projects from R|P | to R|B| using (32). From this we get 0 Σ0 0 X = 0, (31)    P0  T 0 0 0 X v = Vq− v˜ in our original basis. B     As will be seen in the experiments, the SVD method is where Σ0 is diagonal with n r non-zero diagonal entries. somewhat more stable than the QR method, but significantly − The zeros above Σ0 enter since Σ0 can be used to eliminate slower due to the costly SVD factorization. 12

5.3 Basis Selection and Adaptive Truncation 6 Using Eigenvalues Instead of Eigenvectors

In the literature, the preferred method of extracting solutions We have so far seen three techniques for dealing with the using eigenvalue decomposition is to look at the eigenvec- case when the sub matrix C 2 is ill conditioned. By the P tors. It is also possible to use the eigenvalues, but for a prob- method in Section 4 we avoid operating on C 2 altogether. P lem with s variables this seemingly requires us to solve s Using, the QR and SVD methods we perform elimination, eigenvalue problems since each eigenvalue only gives the but in a numerically much more stable manner. One might value of one variable. However, there can be an advantage now ask whether it is possible to combine these methods. with using the eigenvalues instead of eigenvectors. If there Indeed it turns out that we can combine either the QR or are multiple eigenvalues (or almost multiple eigenvalues) the SVD method with a redundant solving basis to get an the computation of the corresponding eigenvectors will be adaptive truncation criterion yielding even better stability numerically unstable. However, the eigenvalues can usually in some cases. The way to do this is to choose a criterion be determined with reasonable accuracy. In practice, this sit- for early stopping in the factorization algorithms. The tech- uation is not uncommon with the action matrix. niques in this section are related to truncation schemes for Fortunately, we can make use of our knowledge of the rank-deficient linear least squares problems, cf . [28]. eigenvectors to devise a scheme for quickly finding the eigen- A neat feature of QR factorization with column pivoting values of any action matrix on C[x]/I. From Section 2 we is that it provides a way of numerically estimating the condi- know that the right eigenvectors of an action matrix is the vector of basis elements of [x]/I evaluated at the zeros tioning of C 2 simultaneously with elimination. By design, C P the QR factorization algorithm produces an upper triangular of I. This holds for any action matrix and hence all action matrices have the same set of eigenvectors. Consider now a matrix U with diagonal elements uii of decreasing absolute value. The factorization proceeds column wise, producing problem involving the two variables xi and xj. If we have constructed mx , the construction of mx requires almost one uii at a time. If rank(U) = r, then urr > 0 and i j | | | | no extra time. Now perform an eigenvalue decomposition ur+1,r+1 = = unn = 0. However, in floating point 1 ··· mx = VDx V− . Since V is the set of eigenvectors for arithmetic, the transition from finite uii to zero is typi- i i | | m m cally gradual passing through extremely small values and xj as well, we get the eigenvalues of xj by straightfor- the rank is consequently hard to determine. For robustness ward matrix multiplication and then element wise division it might therefore be a good idea to abort the factorization from process early. We do this by setting a threshold τ for the ra- mxj V = VDxj . (37) tio u11 and abort the factorization once the value exceeds | uii | this threshold. A value of τ 108 has been found to yield This means that with very little extra computational effort ≈ good results1. Note that this produces an equivalent result over a single eigenvalue decomposition we can obtain the to carrying out the full QR factorization and then simply eigenvalues of all action matrices we need. The observations discarding the last rows of U. This is practical since off-the- in this section also suggest a slightly easier way of filtering shelf packages as LAPACK [2] only provide full QR fac- out false solutions obtained using the method in Section 4. torization, even though some computational effort could be If the coordinate variables xi are present in the basis, they spared by modifying the algorithm so as not to carry out the correspond to both eigenvalues and elements in the eigen- last steps. vectors. Any discrepancy here implies a false solution which can immediately be discarded. Compared to setting a fixed (redundant) basis size, this approach is beneficial since both rank and conditioning of 7 Experiments C 2 might depend on the data. By the above method we P decide adaptively where to truncate and i.e. how large the In this section we evaluate the numerical stability of the linear basis for C[x]/I should be. proposed techniques on a range of typical geometric com- In the context of the SVD we get a similar criterion by puter vision problems. The experiments are mainly carried looking at the singular values instead and set a threshold out on synthetic data since we are interested in the intrinsic σ1 for , which for i = rank(C 2) is exactly the condition numerical precision of the solver. By intrinsic precision we σi P number of C 2. mean precision under perfect data. The error under noise is P of course interesting for any application, but this is an effect of the problem formulation and not of the particular equa- tion solving technique. 1 Performance is not very sensitive to the choice of τ and values in In Section 7.1 all the main methods (the standard method, the range 106 to 1010 yield similar results. essentially what is outlined in Section 3.2, the truncation 13 method, and the SVD and QR methods) are tested on opti- with x, y and z up to degree 9. This gives 225 equations in mal three view triangulation first studied by Stewenius´ et al. 209 different monomials. in [41]. They had to use emulated 128 bit arithmetics to get The synthetic data used in the validation was generated usable results, whereas with the techniques in this paper, we with three randomly placed cameras at a distance around solve the equations in standard IEEE double precision. Fur- 1000 from the origin and a focal length of around 1000. The thermore, the improved methods are tested on: the problems unknown world point was randomly placed in a cube with of localization with hybrid features [25], relative pose with side length 1000 centered at the origin. The methods have unknown but common focal length [39] and relative pose been compared on 100,000 test cases and the code has been for generalized cameras [40]. Significant improvements in made available for download2. stability are shown in all cases. In the localization example we failed completely to solve the equations using previous 7.1.1 Numerical Experiments methods and hence this case omits a comparison with previ- ous methods. The first experiment investigates what improvement can be achieved by simply avoiding the problematic matrix elimi- nation using the techniques of Section 4. For this purpose we choose the complete set of permissible monomials as 7.1 Optimal Three View Triangulation P a redundant basis and perform the steps of Algorithm 1. In The triangulation problem is formulated as finding the world this case we thus get a redundant basis of 154 elements and a 154 154 multiplication matrix to perform eigenvalue de- point that minimizes the sum of squares of the reprojec- × tion errors. This means that we are minimizing the likeli- composition on. In both cases the eigenvectors are used to hood function, thus obtaining a statistically optimal estimate find the solutions. The results of this experiment are shown given Gaussian noise. A solution to this problem was pre- in Figure 2. As can be seen, this relatively straightforward sented by Stewenius´ et al. in [41]. They solved the prob- technique already yields a large enough improvement in nu- lem by computing the stationary points of the likelihood merical stability to give the solver practical value. function which amounts to solving a system of polynomial equations. The calculations in [41] were conducted using 0.25 Standard basis emulated 128 bit arithmetics yielding very long computa- Redundant basis tion times and in the conclusions the authors write that one 0.2 goal of further work is to improve the numerical stability to be able to use standard IEEE double-precision (52 bit man- 0.15 tissa) and thereby increase the speed significantly. With the techniques presented in this paper it is shown that it is now possible to take the step to double-precision arithmetics. Frequency 0.1 To construct the solver for this example some changes in the algorithm of [41] were done to make better use of 0.05 the changes of basis according to Section 5. The initial three equations are still the same as well as the first step of par- 0 −15 −10 −5 0 5 Log of error in 3D placement tial saturation (w.r.t. x). However, instead of proceeding to 10 perform another step of partial saturation on the new ideal, Fig. 2 Histogram of errors over 100,000 points. The improvement in we saturate (w.r.t. y and z respectively) from the initial three stability using the redundant basis renders the algorithm feasible in equations and join the three different partially saturated ide- standard IEEE double precision. als. Finally, we discard the initial three equations and obtain totally nine equations. Looking closely at Figure 2 one can see that even though This method does not give the same ideal as the one the general stability is much improved, a small set of rela- in [41] were sat(I, xyz) was used. The method in this paper tively large errors remain. It is unclear what causes these produces an ideal of degree 61 instead of 47 as obtained by errors. However, by doing some extra work using the QR Stewenius´ et al. The difference is 11 solutions located at the method of Section 5.1 to select a true basis as a subset of origin and 3 solutions where one of the variables is zeros, , we improve stability further in general and in particular this can be checked with Macaulay 2 [20]. The 11 solutions P completely resolve the issue with large errors, cf . Figure 3. at the origin can be ignored in the calculations and the other In Figure 4, the performance of the QR method is com- three can easily be filtered out in a later stage. pared to the slightly more stable SVD method which selects To build the solver we use the nine equation from the saturated ideal (3 of degree 5 and 6 of degree 6) and multiply 2 http://www.maths.lth.se/vision/downloads 14

0.35 16 means that we have a relative error 10− κ =  κ, Standard basis ≈ mach Redundant basis 0.3 where mach is the machine precision. This observation jus- QR basis tifies our strategy of minimizing the condition number. 0.25

0.2 5 10 standard basis 0.15 SVD basis Frequency

0 0.1 10

0.05 −5 10

0 Error −15 −10 −5 0 5 Log of error in 3D placement 10 −10 Fig. 3 Histogram of errors for the standard, redundant basis and QR 10 methods. The QR method improves stability in general and in particu- lar completely removes the small set of large errors present in both the −15 standard and redundant basis methods. 10 0 5 10 15 20 10 10 10 10 10 Condition number a polynomial basis for C[x]/I from the monomials in . In P Fig. 5 Error versus condition number for the part of the matrix which this case, errors are typically a factor 5 smaller for the is inverted in the solution procedure. ∼ SVD method compared to the QR method.

As mentioned in Section 6, it might be beneficial to use 0.35 SVD basis the eigenvalues instead of eigenvectors to extract solutions. QR basis 0.3 When solving this problem using eigenvalues there are two extra eigenvalue problems of size 50 50 that have to × 0.25 be solved. The impact of the switch from eigenvectors to eigenvalues can be seen in Figure 6. For this example we 0.2 gain some stability at the cost of having to perform three 0.15 eigenvalue decompositions (one for each coordinate) instead Frequency of only one. Moreover, we need to sort the eigenvalues using 0.1 the eigenvectors to put together the correct triplets. 0.05

0.4 0 −15 −10 −5 0 5 SVD basis Log of error in 3D placement 10 0.35 SVD + eig

Fig. 4 Comparison between the SVD and QR methods. The SVD 0.3 method improves somewhat over the QR method at the cost of the computationally more demanding SVD factorization. 0.25

0.2

The reason that a good choice of basis improves the nu- Frequency 0.15 merical stability is that the condition number in the elimina- 0.1 tion step can be lowered considerably. Using the basis selec- tion methods, the condition number is decreased by about a 0.05 5 factor 10 . Figure 5 shows a scatter plot of error versus con- 0 −15 −10 −5 0 5 Log of error in 3D placement dition number for the three view triangulation problem. The 10 SVD method displays a significant decrease and concentra- Fig. 6 Error histograms showing the difference in precision between tion in both error and condition number. It is interesting to the eigenvalue and eigenvector methods. note that to a reasonable approximation we have a linear trend between error and condition number. This can be seen since we have a linear trend with slope one in the logarith- However, we can use the trick of Section 6 to get nearly mic scale. Moreover, we have a y-axis intersection at about the same accuracy using only a single eigenvalue decompo- 13 10− , since the coordinate magnitudes are around 1000 this sition. Figure 7 shows the results of this method. The main 15 advantage of using the eigenvalues is that we push down the the eigenvalues is the best in general. Table 3 shows the me- number of large errors. dian and the 95:th percentile errors for the same methods as in the previous table. Notable in here is that the 95:th per- centile is improved with as much as factor 107 and the me-

0.35 5 SVD basis dian with a factor 10 . The SVD method with eigenvalues SVD + fast eig 0.3 is shown to be the best but the QR method gives almost as good results. 0.25

3 2 1 0.2 Method > 10− > 10− > 10− > 1 STD 35633 24348 15806 9703 0.15 STD:eig 29847 19999 12690 7610 Frequency SVD 1173 562 247 119 0.1 SVD:eig 428 222 128 94 SVD:fast 834 393 178 94 0.05 SVD:var+fast 730 421 245 141 TRUNC 6712 4697 3339 2384 0 −15 −10 −5 0 5 TRUNC:fast 5464 3892 2723 2015 Log of error in 3D placement 10 QR 1287 599 269 127 Fig. 7 This graph shows the increase in performance when the fast QR:eig 517 250 149 117 eigenvalue method is used instead of the eigenvector method. QR:fast 1043 480 229 106 QR:var+fast 584 272 141 71 Table 2 Number of errors out of 100,000 experiments larger than cer- Finally we study the combination of basis selection and tain levels. The QR method with adaptive basis size yields the fewest early stopping yielding a redundant Grobner¨ basis for the number of large errors but the SVD method with eigenvalues is the best in general. three view triangulation problem. The basis size was deter- mined adaptively as described in Section 5.3 with a thresh- old τ = 108. Table 1 shows the distribution of basis sizes ob- tained when this method was used. Since the basis is chosen Method 95th 50th minimal in 94% of the cases for the SVD method and 95% 1 5 STD 1.42 10 9.85 10− for the QR method the time consumption is almost identical · 0 · 5 STD:eig 5.30 10 3.32 10− · 5 · 9 to the original basis selection methods, but as can be seen in SVD 1.19 10− 6.09 10− · 6 · 9 Table 2 the number of large errors are reduced for the QR SVD:eig 1.20 10− 1.29 10− · 6 · 9 method. This is probably due to the fact that truncation is SVD:fast 4.37 10− 2.53 10− · 6 · 9 SVD:var+fast 2.34 10− 2.50 10− carried out only when the matrices are close to being singu- · 3 · 8 TRUNC 6.55 10− 1.40 10− lar. This effect is not present for the SVD method. · 3 · 9 TRUNC:fast 1.87 10− 3.27 10− · 5 · 8 QR 1.78 10− 1.06 10− · 6 · 9 QR:eig 1.70 10− 2.08 10− 50 51 52 53 54 55 · 6 · 9 ≥ QR:fast 6.97 10− 3.64 10− SVD 94.0 3.5 0.8 0.4 0.3 1.0 · 6 · 9 QR:var+fast 3.41 10− 3.61 10− QR 95.0 3.0 0.7 0.3 0.2 0.8 · · Table 3 The 95th percentile and the median error for various methods. Table 1 Basis sizes for the QR and SVD methods with variable ba- The improvement in precision is up to a factor 107. The SVD method sis size. The table shows the percentage of times certain basis sizes gives the best results, but the QR method is not far off. occurred during 100,000 experiments.

To conclude the numerical experiments on three view tri- 7.1.2 Speed Comparison angulation two tables with detailed error statistics are given. The acronyms STD, QR, SVD and TRUNC respectively de- The main motivation for using the QR method rather than note the standard method, QR method, SVD method and the SVD method is that the QR method is computationally redundant basis method. The suffixes eig, fast and var re- less expensive. To verify this the standard, SVD and QR spectively denote the eigenvalue method, the fast eigenvalue methods were run and the time was measured. Since the method (Section 6) and the use of a variable size basis (Sec- implementations were done in Matlab it was necessary to tion 5.3). Table 2 shows how many times the error gets larger take care to eliminate the effect of Matlab being an inter- the some given levels for several solvers. As can be seen, the preted language. To do this only the time after construction QR method with adaptive basis size is the best method for of the coefficient matrix was taken into account. This is be- reducing the largest errors but the SVD method with use of cause the construction of the coefficient matrix essentially 16 amounts to copying coefficients to the right places, which imal setup for this problem is three point-correspondences can be done extremely fast in e.g. a C language implemen- with known world points and one correspondence to a world tation. line. The last feature is equivalent to having a point cor- In the routines that were measured no subroutines were respondence with another known calibrated camera. These called that were not built-in functions in Matlab. The mea- types of mixed features are called hybrid features and were surements were done with the Matlab profiler. introduced in [25], where the authors propose a parameteri- The time measurements were done on an Intel Core 2 zation of the problem but no solution was given apart from 2.13 GHz machine with 2 GB memory. Each algorithm was showing that the problem has 36 solutions. executed with 1000 different coefficient matrices constructed The parameterization in [25] gives four equations in four from the same type of scene setups as previously. The same unknowns. The unknowns are three quaternion set of coefficient matrices was used for each method. The re- and the focal length. The equation derived from the line cor- sult is given in Table 4. Our results show that the QR method respondence is of degree 6 and those obtained from the 3D with adaptive truncation is approximately four times faster points are of degree 3. The coefficient matrix C is then con- than the SVD method but 40% slower than the standard structed by expanding all equations up to degree 10. This method. The reason that the redundant basis method is more means that the equation derived from the line is multiplied than twice as slow as the QR method is the larger eigenvalue with all monomials up to degree 4, but no single variable in decomposition, which dominates the computation time. the monomials is of higher degree than 2. In the same man- ner the point correspondence equations are multiplied with Method Time per call / ms Relative time monomials up to degree 7 but no single variable of degree SVD 41.69 1 more than 5. The described expansion gives 980 equations TRUNC 38.11 0.91 in 873 monomials. QR:var+fast 10.94 0.26 The next step is to reorder the monomials as in (16). In STD 8.03 0.19 this problem C corresponds to all monomials up to de- 4P Table 4 Time consumption in the solver part for four different meth- gree 4 except f where f is the focal length, which gives 69 ods. The time is an average over 1000 function calls. columns in C . The part C corresponds to the 5:th degree P R monomials that appear when the monomials in are multi- P plied with the first of the unknown quaternion parameters. For this problem, we were not able to obtain a standard 7.1.3 Triangulation of Real Data numerical solver. The reason for this was that even going to significantly higher degrees than mentioned above, we did Finally, the algorithm is evaluated under real world condi- not obtain a numerical invertible C matrix. In fact, with an tions. The Oxford dinosaur [15] is a familiar image sequence exact linear basis (same number of basis elements as solu- of a toy dinosaur shot on a turn table. The image sequence tions), even the QR and SVD methods failed and truncation consists of 36 images and 4983 point tracks. For each point had to be used. visible in three or more views we select the first, middle and In this example we found that increasing the linear ba- last view and triangulate using these. This yields a total of sis of C[x]/I by a few elements more than produced by the 2683 point triplets to triangulate. The image sequence con- adaptive criterion was beneficial for the stability. In this ex- tains some erroneous tracks that we deal with by removing periment, an increase by three basis elements was used. any points reprojected with an error greater than two pixels The synthetic experiments for this problem were gener- in any frame. The whole sequence was processed in approx- ated by randomly drawing four points from a cube with side imately 45 seconds in a Matlab implementation on an Intel length 1000 centered at the origin and two cameras with a Core 2 2.13 GHz CPU with 2 GB of memory by the QR distance of approximately 1000 to the origin. One of these method with variable basis size. The resulting point cloud is cameras was treated as unknown and one was used to get shown in Figure 8. the camera to camera point correspondence. This gives one We have also run the same sequence using the standard unknown camera with three point correspondences and one method, but the errors were to large to yield usable results line correspondence. The experiment was run 10,000 times. (typically larger errors than the dimensions of the dinosaur In Figure 9 the distribution of basis sizes is shown for the itself). QR method. For the SVD method the basis size was identi- cal to the QR method in over 97% of the cases and never 7.2 Localization with Hybrid Features differed by more than one element. Figure 10 gives the distribution of relative errors in the In this experiment, we study the problem of finding the pose estimated focal length. It can be seen that both the SVD of a calibrated camera with unknown focal length. One min- method and the faster QR method give useful results. We 17

Fig. 8 The Oxford dinosaur reconstructed from 2683 point triplets using the QR method with variable basis size. The reconstruction was completed in approximately 45 seconds by a Matlab implementation on an Intel Core 2 2.13 GHz CPU with 2 GB of memory.

0.5 0.8 SVD basis QR basis 0.7 0.4 0.6

0.5 0.3

0.4

Frequency 0.2 Frequency 0.3

0.2 0.1 0.1

0 0 39 40 41 42 43 44 45 −15 −10 −5 0 Log of relative error in focal length Basis size 10 Fig. 9 The basis size for localization with hybrid features. The number Fig. 10 The error for localization with hybrid features. The standard of solutions are 36 and since we always add three dimensions to the method is omitted since we did not manage to construct a standard truncated ideal the minimal possible basis size is 39. solver due to numerical problems.

2 emphasize that we were not able to construct a solver with Then putting f − = p one obtains nine equations from the the standard method and hence no error distribution for that constraint on the essential matrix [35] method is available. 2EEtE tr(EEt)E = 0. (39) − A 10th equation is then obtained by making use of the fact 7.3 Relative Pose with Unknown Focal Length that the fundamental matrix is singular, i.e. det(F ) = 0. These equations involve the unknowns p, l1 and l2 and are Relative pose for calibrated cameras is a well known prob- of total degree 5. The problem has 15 solutions in general. lem and the standard minimal case for this is five points in We set up the coefficient matrix C by multiplying these two views [38]. There are in general ten solutions to this ten equations by p so that the degree of p reaches a maxi- problem. For the same problem but with unknown focal length, mum of four. This gives 34 equations in a total of 50 mono- the corresponding minimal case is six points in two views, mials. which was solved by Stewenius´ et al. using Grobner¨ basis The validation data was generated with two cameras of techniques [39]. equal focal length of around 1000 placed at a distance of Following the same recipe as Stewenius´ et al. it is pos- around 1000 from the origin. The six points were randomly sible to express the fundamental matrix as a linear combina- placed in a cube with side length 1000 centered at the ori- tion, gin. The standard, SVD, and QR methods have been com- pared on 100,000 test cases and the errors in focal length F = F0 + F1l1 + F2l2. (38) are shown in Figure 11. In this case the QR method yields 18 slightly better results than the SVD method. This is proba- The methods have been compared on a data set of 10,000 bly due to loss in numerical precision when the solution is randomly generated test cases. The result from this experi- transformed back to the original basis. ment is shown in Figure 12. As can be seen, a good choice of basis yields drastically improved numerical precision over the standard method. 0.5 Standard basis SVD basis QR basis 0.4 0.4 Standard basis 0.35 SVD basis QR basis 0.3 0.3

0.25

Frequency 0.2 0.2

0.1 Frequency 0.15

0.1 0 −15 −10 −5 0 0.05 Log of error in focal length 10 0 Fig. 11 The error in focal length for relative pose with two semi cali- −15 −10 −5 0 Log of angular error brated cameras with unknown but common focal length. 10 Fig. 12 The angular error in degrees for relative pose with generalized cameras.

7.4 Relative Pose for Generalized Camera

Generalized cameras provide a generalization of the stan- 8 Discussion dard pin-hole camera in the sense that there is no common focal point through which all image rays pass, cf . [36]. In- We have introduced some new theoretical ideas as well as stead the camera captures arbitrary image rays or lines. Solv- a set of techniques designed to overcome numerical prob- ing for the relative motion of a generalized camera can be lems encountered in state-of-the-art methods for polynomial done using six point correspondences in two views. This equation solving. We have shown empirically that these tech- is a minimal case which was solved in [40] with Grobner¨ niques in many cases yield dramatic improvements in nu- basis techniques. The problem equations can be set up us- merical stability and further permits the solution of a larger ing quaternions to parameterize the rotation, Plucker¨ repre- class of problems than previously possible. sentation of the lines and a generalized epipolar constraint The technique for solving polynomial equations that we which captures the relation between the lines. After some use in this paper can be summarized as follows. The orig- manipulations one obtains a set of sixth degree equations in inal equations are first expanded by multiplying the poly- the three quaternion parameters v1, v2 and v3. For details, nomials with a set of monomials. The resulting equations see [40]. The problem has 64 solutions in general. is expressed as a product of a coefficient matrix C and a To build our solver including the change of basis we monomial vector X. Here we have some freedom in choos- multiply an original set of 15 equations with all combina- ing which monomials to multiply with. We then try to find a tions of 1, v1, v2, v3 up to degree two. After this we end up solving basis for the problem. For a given candidate basis B with 101 equations of total degree 8 in 165 different mono- we have shown how to determine if constitutes a solv- B B mials. ing basis. If so then numerical linear algebra is used to con- We generate synthetic test cases by drawing six points struct the action matrix and get a fast and numerically stable from a normal distribution centered at the origin. Since the solution to the problem at hand. However, we do not know purpose of this investigation is not to study generalized cam- (i) what monomials we should multiply the original equa- eras under realistic conditions we have not used any partic- tions with and (ii) what solving basis should be used to B ular camera rig. Instead we use a completely general setting get the simplest and most numerically stable solutions. Are where the cameras observe six randomly chosen lines each there algorithmic methods for answering these questions? through the six points. There is also a random relative rota- For a given expansion CX can one determine if this allows tion and translation relating the two cameras. It is the task of for a solving basis? A concise theoretical understanding and the solver to calculate the rotation and translation. practical algorithms for these problems would certainly be 19 of great aid in the work on polynomial problems and is a 22. R. Hartley and P. Sturm. Triangulation. Computer Vision and highly interesting subject for future research. Image Understanding, 68:146–157, 1997. 23. R. Holt, R. Huang, and A. Netravali. Algebraic methods for im- age processing and computer vision. IEEE Transactions on Image Processing, 5:976–986, 1996. References 24. D. G. Hook and P. R. McAree. Using sturm sequences to bracket real roots of polynomial equations. Graphics gems, pages 416– 1. S. Agarwal, M. K. Chandraker, F. Kahl, D. J. Kriegman, and S. Be- 422, 1990. longie. Practical global optimization for multiview geometry. In 25. K. Josephson, M. Byrod,¨ F. Kahl, and K. Astr˚ om.¨ Image-based lo- Proc. 9th European Conf. on Computer Vision, Graz, Austria, calization using hybrid feature correspondences. In The second in- pages 592–605, 2006. ternational ISPRS workshop BenCOS 2007, Towards Benchmark- 2. E. Anderson and et al. LAPACK Users’ Guide. Society for In- ing Automated Calibration, Orientation, and Surface Reconstruc- dustrial and Applied Mathematics, Philadelphia, PA, third edition, tion from Images, 2007. 26. F. Kahl. Multiple view geometry and the l -norm. In ICCV, 1999. ∞ 3. D. Bayer and M. Stillman. Macaulay. pages 1002–1009, 2005. www.math.columbia.edu/bayer/Macaulay/,˜ 1994. An open 27. F. Kahl and D. Henrion. Globally optimal estimates for geometric source computer algebra software. reconstruction problems. In Proc. 10th Int. Conf. on Computer 4. M. Brown, R. Hartley, and D. Nister. Minimal solutions for pano- Vision, Bejing, China, pages 978–985, 2005. ramic stitching. In Proceedings of the International Conference on 28. I. Karasalo. A criterion for truncation of the QR-decomposition Computer Vision and Pattern Recognition (CVPR07), Minneapo- algorithm for the singular linear least squares problem. BIT Nu- lis, June 2007. merical Mathematics, 14(2):156–166, June 1974. 5. M. Bujnak, Z. Kukelova, and T. Pajdla. A general solution to the 29. E. Kruppa. Zur Ermittlung eines Objektes aus Zwei Perspek- p4p problem for camera with unknown focal length. In Proc. Conf. tiven mit innerer Orientierung. Sitz-Ber. Akad. Wiss., Wien, math. Computer Vision and Pattern Recognition, Anchorage, USA, 2008. naturw. Kl. Abt, IIa(122):1939–1948, 1913. 6. M. Byrod,¨ K. Josephson, and K. Astr˚ om.¨ Fast optimal three view 30. Z. Kukelova and T. Pajdla. A minimal solution to the autocalibra- triangulation. In Asian Conference on Computer Vision, 2007. tion of radial distortion. In CVPR, 2007. 7. M. Byrod,¨ K. Josephson, and K. Astr˚ om.¨ Improving numerical 31. Z. Kukelova and T. Pajdla. Two minimal problems for cameras accuracy of grobner¨ basis polynomial equation solvers. In Proc. with radial distortion. In Proceedings of The Seventh Workshop 11th Int. Conf. on Computer Vision, Rio de Janeiro, Brazil, 2007. on Omnidirectional Vision, Camera Networks and Non-classical 8. M. Byrod,¨ K. Josephson, and K. Astr˚ om.¨ A column-pivoting based Cameras (OMNIVIS), 2007. strategy for monomial ordering in numerical grobner¨ basis calcu- 32. D. Lazard. Resolution des systemes d’equations algebriques. lations. In The 10th European Conference on Computer Vision, Theor. Comput. Sci., 15:77–110, 1981. 2008. 33. H. Li. A simple solution to the two-view focal-length algorithm. 9. M. Byrod,¨ Z. Kukelova, K. Josephson, T. Pajdla, and K. Astr˚ om.¨ In Proc. 9th European Conf. on Computer Vision, Graz, Austria, Fast and robust numerical solutions to minimal problems for cam- 2006. eras with radial distortion. In Proc. Conf. Computer Vision and 34. D. Nister.´ An efficient solution to the five-point relative pose prob- Pattern Recognition, Anchorage, USA, 2008. lem. In Proc. Conf. Computer Vision and Pattern Recognition, 10. E. Cattani, D. A. Cox, G. Cheze,` A. Dickenstein, M. Elkadi, volume 2, pages 195–202. IEEE Computer Society Press, 2003. 35. J. Philip. A non-iterative algorithm for determining all essen- I. Z. Emiris, A. Galligo, A. Kehrein, M. Kreuzer, and B. Mour- tial matrices corresponding to five point pairs. Photogrammetric rain. Solving Polynomial Equations: Foundations, Algorithms, Record, 15(88):589–599, Oct. 1996. and Applications (Algorithms and Computation in Mathematics). 36. R. Pless. Using many cameras as one. In Proc. Conf. Computer Springer-Verlag New York, Inc., Secaucus, NJ, USA, 2005. Vision and Pattern Recognition, Madison, USA, 2003. 11. M. Chasles. Question 296. Nouv. Ann. Math., 14(50), 1855. 37. H. Stewenius.´ Grobner¨ Basis Methods for Minimal Problems in 12. D. Cox, J. Little, and D. O’Shea. Using Algebraic Geometry. Computer Vision. PhD thesis, Lund University, Apr. 2005. Springer Verlag, 1998. 38. H. Stewenius,´ C. Engels, and D. Nister.´ Recent developments on 13. D. Cox, J. Little, and D. O’Shea. Ideals, Varieties, and Algorithms. direct relative orientation. ISPRS Journal of Photogrammetry and Springer, 2007. 14. M. Demazure. Sur deux problemes de reconstruction. Technical Remote Sensing, 60:284–294, June 2006. 39. H. Stewenius,´ F. Kahl, D. Nister,´ and F. Schaffalitzky. A minimal Report 882, INRIA, 1988. 15. Visual geometry group, university of oxford. solution for relative pose with unknown focal length. In Proc. http://www.robots.ox.ac.uk/ vgg. Conf. Computer Vision and Pattern Recognition, San Diego, USA, 16. J.-C. Faugere.` A new efficient∼ algorithm for computing grobner¨ 2005. 40. H. Stewenius,´ D. Nister,´ M. Oskarsson, and K. Astr˚ om.¨ Solutions bases (f4). Journal of Pure and Applied Algebra, 139(1-3):61–88, 1999. to minimal generalized relative pose problems. In Workshop on 17. M. A. Fischler and R. C. Bolles. Random sample consensus: a Omnidirectional Vision, Beijing China, Oct. 2005. paradigm for model fitting with applications to image analysis and 41. H. Stewenius,´ F. Schaffalitzky, and D. Nister.´ How hard is three- automated cartography. Communications of the ACM, 24(6):381– view triangulation really? In Proc. Int. Conf. on Computer Vision, 95, 1981. pages 686–693, Beijing, China, 2005. 18. C. Geyer and H. Stewenius.´ A nine-point algorithm for estimating 42. E. H. Thompson. A rational algebraic formulation of the problem para-catadioptric fundamental matrices. In Proc. Conf. Computer of relative orientation. Photogrammetric Record, 14(3):152–159, Vision and Pattern Recognition, Minneapolis, USA, June 2007. 1959. 19. G. H. Golub and C. F. van Loan. Matrix Computations. The Johns 43. P. Torr and A. Zisserman. Robust parameterization and com- Hopkins University Press, 3rd edition, 1996. putation of the trifocal tensor. Image and Vision Computing, 20. D. Grayson and M. Stillman. Macaulay 2. Available at 15(8):591–605, 1997. http://www.math.uiuc.edu/Macaulay2/, 1993-2002. An open 44. P. Torr and A. Zisserman. Robust computation and parametriza- Proc. 6th Int. Conf. on Computer source computer algebra software. tion of multiple view relations. In 21. R. Hartley and F. Schaffalitzky. L minimization in geometric Vision, Mumbai, India, pages 727–732, 1998. ∞ 45. J. Verschelde. Phcpack: A general-purpose solver for polynomial reconstruction problems. In Proc. Conf. Computer Vision and systems by homotopy continuation. ACM Transactions on Math- Pattern Recognition, Washington DC, pages 504–509, Washing- ematical Software, 25(2):251–276, 1999. ton DC, USA, 2004.