{'fraction_non_alphanumeric': 0.04103355492244381, 'fraction_numerical': 0.011435580880025324, 'mean_word_length': 4.52042376583661, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Making Affine Correspondences Work in Camera Geometry Computation

Local features e.g. SIFT and its affine and learned variants provide region-to-region rather than point-to-point correspondences. This has recently been exploited to create new minimal solvers for classical problems such as homography, essential and fundamental matrix estimation. The main advantage of such solvers is that their sample size is smaller, e.g., only two instead of four matches are required to estimate a homography. Works proposing such solvers often claim a significant improvement in run-time thanks to fewer RANSAC iterations. We show that this argument is not valid in practice if the solvers are used naively. To overcome this, we propose guidelines for effective use of region-to-region matches in the course of a full model estimation pipeline. We propose a method for refining the local feature geometries by symmetric intensity-based matching, combine uncertainty propagation inside RANSAC with preemptive model verification, show a general scheme for computing uncertainty of minimal solvers results, and adapt the sample cheirality check for homography estimation. Our experiments show that affine solvers can achieve accuracy comparable to point-based solvers at faster run-times when following our guidelines. We make code available at https://github.com/danini/affine-correspondences-for-camera-geometry.


Introduction
Estimating the geometric relationship between two images, such as homography or the epipolar geometry, is a fundamental step in computer vision approaches such as Structure-from-Motion [52], Multi-View Stereo [53], and SLAM [43].
Traditionally, geometric relations are estimated from point correspondences (PCs) between the two images [27,44]. This ignores that correspondences are often rather established between image regions than between individual points to which the descriptors are finally often assigned. These regions, i.e. patches extracted around keypoints found by detectors such as DoG [33] or MSER [36], are oriented and have a specified size. Thus, they provide an affine transformation mapping feature regions to each other for each match [33,46]. Many works [3-5, 8, 16, 24, 25, 30, 45, 47, 50] used this additional information provided by affine correspondences (ACs), i.e., region-to-region matches, to design minimal solvers for camera geometry estimation. As each correspondence carries more information, such solvers require fewer matches than their traditional point-based counterparts. For example, only three affine correspondences are required to estimate the fundamental matrix [8] compared to seven point correspondences [27]. This increases the probability of drawing an all-inlier sample, thus decreasing the required number of RANSAC [17] iterations. Also, ACs are known to be more robust against view changes than point correspondences [40].
In terms of noise on the measurements, affine solvers are affected differently than their point-based counterparts. If the points are well-spread in the images, the amount of noise is small compared to the distances between the points. In this case, the influence of the noise on the solution computed by a minimal solver is relatively small. In contrast, the comparatively small regions around the keypoints that define the affine features are much more affected by the same level of noise. As such, we observe that affine correspondence-based solvers are significantly less accurate than point correspondence-based ones if used naively. Yet, when explicitly modelling the impact of noise, we observe that affine solvers can achieve a similar level of accuracy as classical approaches while offering faster run-times. Based on our observations, we provide a practical guide for making affine correspondences work well in camera geometry computation. Contribution.
(1) We demonstrate how to use affine solvers to obtain accurate results at faster RANSAC run-times than achieved by pure point-based solvers. (2) We present strategies for all parts of the camera geometry estimation pipeline designed to improve the performance of affine solvers. This includes the refinement of the affinities defined by the features, rejection of samples based on cheirality checks, uncertainty propagation to detect and reject models that are too uncertain, and the importance of local optimization. (3) Through detailed experiments, we evaluate the impact of each strategy on the overall performance of affine solvers, both in terms of accuracy and run-time, showing that affine solvers can achieve a similar or higher accuracy than point-based approaches at faster run-times. These experiments validate our guidelines. (4) We make various technical contributions, such as a novel method for refining affine correspondence based on image intensity; a new minimal solver for fundamental matrix estimation; a strategy for combining the SPRT [11] test with uncertainty propagation for rejecting models early; the adaptation of the sample cheirality test, which is often used for point-based homography estimation, to affine features, and a general scheme for deriving covariance matrices for minimal solvers.

Related Work
Our guide to best use affine correspondences for camera geometry estimation problems analyzes the individual stages of the pipeline leading from matches to transformation estimates. The following reviews prior work for each stage.
Affine features are described by a point correspondence and a 2 × 2 linear transformation. For obtaining them, one can apply one of the traditional affinecovariant feature detectors, thoroughly surveyed in [39], such as MSER, Hessian-Affine, or Harris-Affine detectors. An alternative way to acquiring affine features is via view-synthesizing, as done, e.g., by Affine-SIFT [42], and MODS [41] or by learning-based approaches, e.g., Hes-Aff-Net [40], which obtains affine regions by running CNN-based shape regression on Hessian keypoints. Matching affine regions. Given the noise in the parameters of the regions around affine matches, a natural approach to good estimation is to use high precision least squares matching (LSM) for refining affine correspondences [1,18,35]. Similar to template matching via cross correlation, a small patch from one image is located within a larger region in a second image. While arbitrary geometric and radiometric models are possible, practical approaches mostly consider affine transformations. As a maximum likelihood estimator, LSM provides the covariance matrix of the estimated parameters, the Cramer-Rao bound, reaching standard deviations for parallaxes down to below 1/100 pixel [26]. Intensity-based refinement has been used [16,50] for pose estimation. Yet, no analysis on the accuracy of the derived uncertainty is known and a symmetric formulation of the problem is missing so far. In this paper, we close this gap by providing both. Affine solvers use ACs for geometric model estimation. Bentolila and Francos [8] proposed a method for estimating the epipolar geometry between two views using three ACs by interpreting the problem via conic constraints. Perdoch et al. [45] proposed two techniques for approximating the pose based on two and three matches by converting each AC to three PCs and applying standard estimation techniques. Raposo et al. [50] proposed a solution for essential matrix estimation from two ACs. Baráth et al. [3,5] showed that the relationship between ACs and epipolar geometry is linear and geometrically interpretable. Eichhardt et al. [16] proposed a method that uses two ACs for relative pose estimation based on general central-projective views. Similarly, [24,25] proposed minimal solutions for relative pose from a single affine correspondence when the camera is mounted to a moving vehicle. Homographies can also be estimated from two ACs as first shown by Köser [4,30]. Pritts et al. [47] used affine features for simultaneous estimation of affine image rectification and lens distortion. Uncertainty analysis of image data provides several approaches useful for our task. Variances or covariance matrices are often used to model the uncertainty of the input parameters, i.e., image intensities, coordinates of keypoints, and affine parameters. Assuming an ideal camera with a linear transfer function, the variance of the image noise increases linearly with the intensity [15,56]. In practice, the complexity of the internal camera processing requires an estimate of the variance function σ 2 n (I) from the given images [19]. The accuracy of keypoint coordinates usually lies in the order of the rounding error, i.e., 1/ √ 12 ≈ 0.3 pixels. We exploit here the uncertainty of the image intensities and keypoints for deriving realistic covariance matrices of the affine correspondences.
Propagation of input uncertainty to model parameters through the estimation depends on the model being estimated. The uncertainty of a homography Algorithm if q > q * then 21: q * , θ * ← q , θ estimated from four or more points has been based on the SVD [13,49] and Lie groups [7]. The uncertainty of an estimated fundamental matrix has been also based on the SVD [55], but also on minimal representations [14]. Finally, the uncertainty for essential matrices has been derived using a minimal representation [21]. As far as we know, the propagation for affine solvers has not been presented before, and there was no general scheme for deriving covariance matrices for the solutions of minimal solvers. In this paper, we provide an efficient and general scheme and the uncertainty propagation for all minimal solvers used.

A Practical Guide to Using Affine Features
As argued in Sec. 1, and shown experimentally in Sec. 4.1, using ACs instead of point correspondences (PCs) leads to minimal solvers with smaller sample sizes but also to less accurate results. In the following, we analyze the individual stages of a classical matching pipeline and discuss how state-of-the-art results can be obtained with ACs. The pipeline is summarized in Alg. 1.

Definition of Affine Correspondences
Affine correspondences are defined in this paper as Relations between two image patches g(y) (blue) and h(h) (green) and the mean patch f (x) (which is the black within the red region). The two patches g and h are related by geometric B and a radiometric S affinities. The correspondence is established by patch f , lying in the middle between g and h. We choose the maximum square (black), i.e. all the pixels in g and h which map into the black square of the reference image f . Right: The inlier ratio (vertical) of 100k homographies from real scenes as a function of the trace of their covariance matrices (horizontal). This shows that uncertain models (on right) generate small numbers of inliers. We use this to reject uncertain models.
where the keypoint coordinates in the left and the right image are y 0 , and z 0 , and the local affinity is A = A 2 A −1 1 , e.g. derived from the affine frames A 1 and A 2 representing the affine shape of the underlying image region. The matching and refinement of the affine region correspondences, presented in the next section, refers to the homogeneous matrix h A, specifically the translation vector c, initially 0, and the affinity matrix A in (1).

Matching and Refining Affine Correspondences
For refining the ACs, we propose an intensity-based matching procedure which (i) is symmetric and provides (ii) a statistic for the coherence between the data and the model and (iii) a covariance matrix for the estimates of the parameters. Let the two image windows in the two images be g(y) and h(z). We assume, both windows are noisy observations of an unknown underlying signal f (x), with individual geometric distortion, brightness, and contrast. We want to find the geometric distortion z = A(y) and the radiometric distortion h = R(g) = pg +q. Classical matching methods assume the geometric and radiometric distortion of one of the two windows is zero, e.g. g(y) = f (x), with y = x. We break this asymmetry by placing the unknown signal f (x) in the middle between the observed signals g and h: g(y) Assuming affinities for the geometric and radiometric distortions, the model is shown in Fig. 1(left). The geometric and the radiometric models are In the following, we collect the eight unknown parameters of the two affinities in a single vector θ = Now, we assume the intensities g and h to be noisy with variances σ n (g) and σ m (h) depending on g and h. Hence, in an ML-approach, we minimize the weighted sum Ω(θ, f ) = j n 2 j (θ, f )/σ 2 nj + k m 2 k (θ, f )/σ 2 m k w.r.t. the unknown parameters θ and f , where the residuals are n j (θ, Since the number of intensities in the unknown signal f is quite large, we solve this problem by fixing one group of parameters of f and θ, and solving for the other. The estimated unknown function is the weighted mean of functions g and h transformed into the coordinate system x of f . The covariance matrix Σ α α of the sought affinity is finally derived by variance propagation from A = B 2 . The standard deviations of the estimated affinity A and shift c are below 1% and 0.1 pixels, except for very small scales. Moreover, for the window size M × M , the standard deviations decrease with on average with M 2 and M , respectively (see Supplementary Material).

Solvers using Affine Correspondences
In this paper we consider three important camera geometry problems: estimating planar homography, and two cases of estimating relative pose of two cameras: uncalibrated and calibrated cameras. We also include the semi-calibrated case, i.e. unknown focal length, in the supplementary material. Homography from 1AC + 1PC: The problem of estimating a planar homography H ∈ R 3×3 is well-studied with simple linear solutions from point and/or affine correspondences. The homography H has eight degrees of freedom. Since each PC gives two linear constraints on H and each AC gives six linear constraints on H, the minimal number of correspondences necessary to estimate the unknown homography is either 4PC or 1AC+1PC. Both the well-known 4PC [27] and the 1AC+1PC [4,30] solvers are solving a system of eight linear equations in nine unknowns and are therefore equivalent in terms of efficiency. Fundamental matrix from 2AC + 1PC: The problem of estimating the relative pose of two uncalibrated cameras, i.e., estimating the fundamental matrix F ∈ R 3×3 , has a well-known 7PC solver [27]. The fundamental matrix F has seven degrees of freedom, since it is a 3 × 3 singular matrix, i.e., det(F) = 0. The well-known epipolar constraint gives one linear constraint on F for each PC. We propose a solver for estimating the unknown F using the linear constraints proposed in [3]. Here, we briefly describe this new 2AC+1PC solver.
Each AC gives three linear constraints on the epipolar geometry [3]. Therefore, the minimal number of correspondences necessary to estimate the unknown F is 2AC+1PC. The solver first uses seven linear constraints, i.e., six from two ACs and one from a PC, rewritten in a matrix form as Mf = 0, where f = vec(F), to find a 2-dimensional null-space of the matrix M. The unknown fundamental matrix is parameterized as F = xF 1 + F 2 , where F 1 and F 2 are matrices created from the 2-dimensional null-space of M and x is a new unknown. This parameterization is substituted into the constraint det(F) = 0, resulting in a polynomial of degree three in one unknown. The final 2AC+1PC solver is performing the same operations as the 7PC solver, i.e., the computation of the null-space of a 7 × 9 matrix and finding the roots of a univariate polynomial of degree three.
Essential matrix from 2ACs: The problem of estimating the relative pose of two calibrated cameras, i.e., estimating the unknown essential matrix E ∈ R 3×3 , has five degrees of freedom (three for rotation and two for translation) and there exists the well-known 5PC solver [44]. This problem has recently been solved from two ACs [5,16]. Each AC gives three linear constraints on E [5]. Thus, two ACs provide more constraints than degrees of freedom. One approach to solve for E from two ACs is to use just five out of six constraints, which results in the same operations as the well-known 5PC solver [44] does. Another one is to solve an over-constrained system as suggested in [5]. In the experiments, we used the solver of [5] since it has lower computational complexity and similar accuracy.

Sample Rejection via Cheirality Checks
It is well-known for homography fitting that some minimal samples can be rejected without estimating the implied homography as they would lead to impossible configurations. Such a configuration occurs when the plane flips between the two views, i.e., the second camera sees it from the back. This cheirality constraint is implemented in the most popular robust approaches, e.g., USAC [48] and OpenCV's RANSAC. We thus adapt this constraint via a simple strategy by converting each AC to three PCs. Given affine correspondence {y 0 , z 0 , A}, where y 0 = [y 01 , y 02 ] T and z 0 = [z 01 , z 02 ] T are the keypoint coordinates in the left, respectively the right images, the generated point correspondences are When estimating the homography using the 1AC+1PC solver, the affine matrix is converted to these point correspondences and the cheirality check is applied to the four PCs. Note that any direct conversion of ACs to (non-colinear) PCs is theoretically incorrect since the AC is a local approximation of the underlying homography [4]. However, it is a sufficiently good approximation for the cheirality check.

Uncertainty-based Model Rejection
Before evaluating the consensus of a model, it is reasonable to check its quality, especially to eliminate configurations close to a singularity, see [22]. We can use the covariance matrix Σ θθ of each solution to decide on its further suitability. To do so, we propose a new general way of deriving the Σ θθ for minimal problems.
All problems we address here are based on a set of constraints g(y, θ) = 0 on some observations y, and parameters θ, e.g. the F estimation constraint . We want to use classical variance propagation for implicit functions [21], Sec. 2.7.5. If Σ yy is given, the determination of Σ θθ is based on linearizing g at a point (y, θ) and using the Jacobians A = ∂g/∂y and B = ∂g/∂θ leading to covariance matrix Σ θθ = B −1 AΣ yy A T B −T , provided B can be inverted. Using constraints g we derive Jacobians A, B algebraically. Further, given the k th solution of a minimal problem (a system of equations defining a minimal problem has, in general, more than one solution), i.e. a pair (y, θ k ), we can compute Σ θ k θ k without needing to know how the problem was solved and how this specific solution has been selected.
However, the number of constraints in g in most of the minimal problems is smaller than the number of parameters θ, e.g. 7 constraints vs. 9 elements of F. Then the matrix B cannot be inverted. We propose to append the minimum number of constraints h(θ) = 0 (between the parameters only, e.g. det(F) and ||F|| = 1) such that the number of all constraints (g; h) is identical to the number of parameters. This leads to a regular matrix B, except for critical configurations.
Such algebraic derivations should be checked to ensure the equivalence of the algebraic and numerical solution, best by Monte Carlo simulations. However, the empirically obtained covariance matrix Σ θθ is regular and cannot be directly compared to the algebraically derived Σ θθ if it is singular (e.g. for θ = vec(F)). We propose to project both matrices on the tangent space of the manifold of θ, leading to regular covariance matrices as follows: let J(Σ) be an orthonormal base of the column space of some covariance matrix Σ, then Σ r = J T ΣJ is regular; e.g. using J = null(null(Σ) T ) where null(Σ) is the nullspace of Σ. Hence, with J = J(Σ θθ ) the two covariance matrices Σ θθ,r = J T Σ θθ J and Σ θθ,r = J T Σ θθ J are regular. They can be compared and an identity test can be performed checking the hypothesis IE( Σ θθ,r ) = Σ θθ,r , see [21], p. 71. The used constraints and detailed discussion for all listed minimal problems are in the supplementary material.
The covariance matrix Σ θθ can be used in following way. Since we do not have a reference configuration, we eliminate models where the condition number c = cond(Σ θθ ) is too large, since configurations close to singularity show large condition numbers in practice. For reasons of speed, it is useful to compute an approximation for the condition number, e.g. c s = tr(Σ θθ )tr(Σ −1 θθ ), if the inverse covariance matrix can be obtained efficiently, which is the case in our context since Σ −1 θθ = B(AΣ yy A T ) −1 B T . 6 A weaker measure is tr(Σ θθ ), which is more efficient to calculate than the previous ones. It essentially measures the average variance of the parameters θ. Thus, it can identify configurations where parameters are very uncertain. We use this measure in the following for deriving a prior for preemptive model verification by the Sequential Probability Ratio Test [11].
We experimentally found, for each problem, the parameters of exponential (for points solvers) and log-normal (for affine solvers) distributions for the trace. These parameters are used to measure the likelihood of the model being too uncertain to lead to a large number of inliers. In our experiments, for the sake of simplicity, we model the trace values by normal distributions for all solvers. Thus, we used the a-priori determined parameters to initialize the mean and standard deviation from all tested image pairs. Finally, we get a probability for each model being acceptable or not. Note that the selection of the provably correct probabilistic kernel for a particular problem and scene is a direction for future research. However, it is not a crucial issue due to being used only for rejecting too uncertain models early to avoid unnecessary calculations.
As a final step, we feed the determined probability to the Sequential Probability Ratio Test (SPRT) [11,37] as a prior knowledge about the model to be verified. This is done by initializing the model probability, which is sequentially updated in SPRT, to the a priori estimated one.

Local Optimization
Minimal solvers do not take noise in their input measurements into account during the estimation process. However, noise affects the estimated models. As such, not every all-inlier sample leads to the best possible transformation [12]. As shown in [20,51], starting from the algebraic solution and performing only a single iteration of ML estimation is often sufficient to obtain a significantly better estimate. They show that this strategy approaches the optimal result with an error below 10%-40% of the parameters' standard deviations while only increasing the computation time by a factor of ∼2. A strongly recommended approach is thus to use local optimization [6,12,32] inside RANSAC: every time a new best model is found, ML-based refinement on its inliers is used to account for noise in the input parameters. While this adds a computational overhead, it can be shown that this overhead is small and is compensated by the observation that local optimization (LO) typically helps RANSAC to terminate early. Moreover LO is usually applied rarely [12]. As we show in Sec. 4.5, local optimization is crucial to obtain accurate geometry estimates when using ACs.

Experiments
In this section, different algorithmic choices are tested on homography, fundamental and essential matrix fitting problems to provide a pipeline which leads to results superior to point-based methods. Experimental setup. Tests for epipolar geometry estimation were performed on the benchmark of [9]. The used datasets are the TUM dataset [54] consisting of videos, of resolution 640 × 480, of indoor scenes. The KITTI dataset [23] consists of consecutive frames of a camera mounted to a vehicle. The images are of resolution 1226 × 370. Both KITTI and TUM have image pairs with short baselines. The Tanks and Temples dataset [29] provides images of real-world objects for image-based reconstruction and, thus, contains mostly wide-baseline pairs. The images are of sizes between 1080 × 1920 and 1080 × 2048. The benchmark provides 1 000 image pairs for each dataset with ground truth epipolar geometry. Homography estimation was tested on the scenes of the HPatches dataset [2]. RANSAC's inlier-outlier threshold is set to 1.0 px (F), 1.0 px (E) and 5 px (H).
When evaluating F and E matrices, we calculate the normalized symmetric geometry errors (NSGD). The symmetric geometry error (SGD) was proposed in [60]. It generates virtual correspondences using the ground-truth F and computes the epipolar distance to the estimated F. It then reverts their roles to compute symmetric distance. The SGD error (in pixels) causes comparability issues for images of different resolutions. Therefore, it is normalized into the range of [0, 1] by regularizing by factor f = The error of the estimated homographies is measured by, first, projecting the first image to the second one and back to get the commonly visible area. Each pixel in the visible area is projected by the ground truth and estimated homographies and the error is calculated as the L 2 distance of the projected points. Finally, the error is averaged over all pixels of the visible area.

Matchers and descriptors
To estimate ACs in real images, we applied the VLFeat library [58] since it is available for multiple programming languages and, thus, we considered it a practical choice. VLFeat provides several options either for the feature descriptor or the affine shape adaptation technique. To select the best-performing combination, first, we detected ACs using all of the possible combinations. Note that we excluded the multi-scale versions of Harris-Laplace and Hessian-Laplace [38] affine shape adaptations since they were computationally expensive. Correspondences are filtered by the standard second nearest neighbor ratio test [34]. Next, we estimated fundamental matrices using affine and point-based solvers and vanilla RANSAC [17]. Fig. 2 reports the cumulative distribution function (CDF) of the NSGD errors calculated from the estimated fundamental matrices.
Curves showing affine solvers have circles as markers. We applied PC-based methods (crosses) considering only the locations of the correspondences and ignoring the affinities. The line style denotes the feature descriptor: straight line -SIFT [34], dotted -LIOP [59]. Affine shape adaption techniques (DoG, Hessian [39], Harris-and Hessian-Leplace [38]) are shown by color. Applying VLFeat with any affine shape adaptation increases the extraction time by ≈10%.
The first and most dominant trend visible from the plots is that methods exploiting ACs are significantly less accurate then point-based approaches when the naive approach is used: vanilla RANSAC. The SIFT descriptor [34] and DoG affine shape adaptation lead to the most accurate results. Consequently, we use this combination in the experiments. In the next sections we will show ways of making the affine solvers similarly or more accurate than point-based methods.

Match Refinement
We demonstrate how the proposed refinement affects the accuracy of the affine matches by analysing the fulfillment of the constraints in the case of calibrated cameras. For each AC, the three constraints consist of the epipolar constraint c p = c T p e = 0 for the image coordinates, and the two constraints c a = C T a e = 0 for the affinity A. Assuming the pose, i.e. the essential matrix, is known we determine a test statistics for the residuals c p and c a as d p = ||c p || σ 2 cp and d a = ||c a || Σc a ca . For the ACs of five image pairs, we used the Lowe keypoint coordinates and the scale and direction differences for deriving approximate affinities and refined them using the proposed LSM refinement technique (see Section 3.2). value is better. The method improves both the affine parameters and point coordinates significantly. In Fig. 3, right the inconsistency with the epipolar constraints are shown; smaller values are better. The refined ACs are better, in terms of fulfilling the epipolar constraints, than the input ACs.

Sample Rejection via Cheirality Checks
The widely used technique for rejecting minimal samples early (i.e. without estimating the model parameters) when fitting homographies is the ordering check of the point correspondences as described earlier. Its effect when adapting it to affine correspondences is shown in Fig. 4.
In the left plot of Fig. 4, the cumulative distribution functions of the processing times (in seconds) are shown. It can be seen that this test has a huge effect on point-based homography estimation as it speeds up the procedure significantly. The adapted criterion speeds up affine-based estimation as well, however, not that dramatically. Note, that affine-based estimation is already an order of magnitude faster than point-based methods and for AC-based homography estimation the cumulative distribution curve of the processing time is already very steep, Fig. 4 (left). This means that affine-based estimators do not perform many iterations and skipping model verification for even the half of the cases would not affect the time curve significantly. The avg. processing time of affine-based estimation is dropped from 8.6 to 7.7 ms. The right plot shows the log 10 iteration numbers of the methods. The test does not affect the iteration number significantly. It sometimes leads to more iterations due to not checking samples of impossible configurations, however, this is expected and does not negatively affect the time.  As it is described earlier, we combined the SPRT test [11,37] (parameters are set similarly as in the USAC [48] implementation) with model uncertainty calculation to avoid the expensive validation of models which are likely to be worse than the current best one. Fig. 5 reports the CDFs of the processing time for (a) homography, (b) fundamental and (c) essential matrix fitting. Note that we excluded uncertainty-based verification for essential matrices since the solvers became too complex and, thus, the uncertainty calculation was slow for being applied to every estimated model.

Uncertainty-Based Preemptive Verification
It can clearly be seen that the proposed combination of the SPRT and the uncertainty check leads to the fastest robust estimation both for H and F fitting. For E estimation from ACs, using the SPRT test is also important, leading to faster termination. Most importantly, using affine correspondences, compared to point-based solvers, leads to a significant speed-up for all problems.

The Importance of Local Optimization
While the speed-up caused by using ACs has clearly been demonstrated, the other most important aspect is to get accurate results. As it is shown in Fig. 2, including AC-based solvers in vanilla RANSAC leads to significantly less accurate results than using PCs. A way of making the estimation by ACs accurate is to use a locally optimized RANSAC, where the initial model is estimated by an AC-based minimal solver and the local optimization performs the model polishing solely on the inlier PCs. We tested state-of-the-art local optimization techniques, i.e., LO-RANSAC [12], LO'-RANSAC [32], GC-RANSAC [6]. The results are reported in Fig. 6. It can be seen that affine-based estimation with GC-RANSAC is always among the top-performing methods. In (a), it is marginally more accurate than considering only point correspondences. In (b), using point correspondences is slighly more accurate. Compared to the results of vanilla RANSAC, the results of affine-based robust estimation improved notably.

Discussion
In summary of the investigated approaches, the best practices to accurately and efficiently use affine solvers are the following. Affinity-based model estimation has an accuracy similar or better to point-based solvers if (i) the detector and affine shape refining method is carefully selected; and (ii), most importantly, if a locally optimized RANSAC is applied to polish every new so-far-the-best model using only the point locations from the inlier correspondences. Consequently, affine features are used for estimating models from minimal samples, while their point counterparts are used to obtain accurate results. Efficiency is achieved by (iii) adapting strategies well-established for point correspondences, e.g., cheirality check for homography estimation. (iv) Also, uncertainty-based model rejection and other preemptive verification techniques have a significant impact when speeding up the robust estimation procedure.

Conclusions
In this paper, we have considered the problem of using affine correspondences (ACs) for camera geometry estimation, i.e., homography and epipolar geometry computation. Compared to classical approaches based on point correspondences (PCs), minimal solvers based on ACs offer the advantage of smaller sample sizes and, thus, the possibility to significantly accelerate RANSAC-based randomized robust estimation. However, noise has a larger negative impact on affine solvers as their input measurements typically originate from a smaller image region compared to point solvers. As we have shown, this significantly decreases the accuracy of the affine solvers. In this work, we have thus collected a set of "best practices", including novel contributions such as refining the local feature geometry and uncertainty-based model rejection techniques, for using ACs in practice.
Through extensive experiments, we have shown that following our guidelines enables affine solvers to be used effectively, resulting in similar accuracy but faster run-times compared to point-based solvers. We believe that our guide will be valuable for both practitioners aiming to improve the performance of their pipelines as well as researchers working on ACs as it covers a topic previously unexplored in the literature.

Supplementary Material
This supplementary material provides the following information: Sec. 7.1 provides technical details for the matching approach described in Sec. 3.2 in the paper. Sec. 7.2 describes a solver that estimates the essential matrix and a common focal length from affine correspondences (ACs) (c.f . Sec. 3.3 in the paper). Sec. 7.3 provides details on the constraints used to derive uncertainty estimates for the solvers used in the paper (c.f . Sec. 3.5 in the paper). Sec. 7.4 discusses fitting a distribution other than the normal distribution to the trace of the covariance matrix (c.f . Sec. 3.5 in the paper). Sec. 4 finally provides additional results on the impact of local optimization (c.f . Sec. 4.5 in the paper).

Symmetric Least Squares Matching
Here we describe the symmetric version of least squares matching in more detail and give some experimental results.
Model. Let the two image windows g(y) and h(z) in the two images be given (c.f . Fig. 7). The coordinates refer to the centre of the square windows. We assume that both windows are noisy observations of an unknown true underlying signal f (x), with individual geometric distortion, brightness, and contrast. We want to determine the geometric distortion z = A(y) and the radiometric distortion h = R(g) = pg + q. Classical matching methods assume the geometric and radiometric distortion of one of the two windows is zero, e.g. assuming g(y) = f (x), with y = x. We break this asymmetry by placing the unknown signal f (x) in the middle between the observed signals between g and h: Assuming affinities for the geometric and the radiometric distortion, we have the following generative model (see Fig. 1): The geometric and the radiometric models for the two images are In the following we collect the eight unknown parameters of the affinities B(B, b) and S(s, t) in the vector  Fig. 7: Relations between two given square image patches g(y) (blue) and h(h) (green) and the mean patch f (x) (which is the black within the red region). The two image patches g and h are related by geometric and a radiometric affinities B and S, respectively. The correspondence is established by the patch f . Geometrically and radiometrically it lies in the middle between g and h. Only a region in the overlap of the two patches g and h mapped to f can be used. We choose the maximum square (black). The observations are all pixels in g and h which map into the black square of the reference image f . We assume the reference image f is a restored version of the weighted mean of the two projected images g and h. The patches g and h may have different sizes. The size of the unknown signal (black, gray) depends on the sizes of g and h, the approximate affine transformation A and a border to allow bicubic interpolation, and is adapted in each iteration. The large image in the x-frame is used for generating artificial images. The dashed lines indicate the borders required for allowing bicubic interpolation This model is rigorous only in the case that the scene surface is planar in a differentiable region and the intensity differences result from brightness and contrast changes only.
We now assume the intensities g j and h k are noisy with variances σ 2 nj and σ 2 h k . These statistical properties of the noise need to be specified, e.g., assuming the variance to be signal dependent, thus e.g. using σ 2 nj = σ 2 n (g(y j )) and σ 2 m k = σ 2 m (h(z k )). When using real images, we estimate this signal-dependent variance functions of the two images, see [19].
Integrating the geometry and intensity transformation we arrive at the following model, which is generative, i.e., allows to simulate observed images: Estimation. The task is to estimate the parameters θ = (θ G , θ I ) for the geometric and the radiometric transformation and the unknown true signal f from the observed values g(y j ) and h(z k ).
The explicit modeling in (7) and (8) allows us to write the problem as a nonlinear Gauss-Markov model with the residuals and their dispersion, for all pixels y j of g and all pixels z k of h falling into the common region in f . Maximum likelihood (ML) estimates ( θ, f ) result from minimizing the weighted sum of the residuals, w.r.t. the unknown distortion parameters θ and the unknown signal f , using proper weights Due to the size of f , the number of unknowns is quite large. Therefore we solve this problem by alternatively fixing one group of the parameters and solving for the other: Especially, the estimated unknown function is the weighted mean of the functions g and h transformed into the coordinate system x of f , which can be calculated pixel wise: from (5) and The weights are Bicubic interpolation is used to transfer g(y i ) and (z i ) to f (x i ).
As a result of the ML-estimation we obtain: (1) the parameters θ, (2) their covariances Σ θ θ , and (3) the variance factor where R is the redundancy of the system, i.e., the efficient number of observations K g + K h minus the number of unknown parameters 8 + K f , where we take the approximation K f = K g K h : If the model holds, the variance factor is Fisher distributed with F (R, ∞) and should thus be close to 1. Therefore, it is reasonable to multiply the covariance matrix Σ θ θ with the variance factor to arrive at a realistic characterization of the uncertainty of the estimated parameters. The covariance matrix Σ ψ ψ of the parameters in the 8-vector ψ of the geometric and radiometric affinities finally is derived by variance propagation from A(ψ) = B(θ) 2 , resulting from (3) and (4). We have A = B 2 , a = (B + I 2 )b and ψ 7 = θ 2 7 , ψ 8 = (θ 7 + 1)θ 8 , with the Jacobian: Empirical tests with simulated data confirm the desired properties: (1) Exchanging the two images g and h leads to the inverse transformation A −1 , (2) the covariance matrix derived from samples with different noise do not show significant deviations from the theoretical covariance matrix, and (3) the mean variance factor is not much larger than 1, usually by 20% to 40%. The deviations We now show the potential of the refinement of the affinitiy using LSM, namely: the expected precision of the affinity for ideal cases. This is based on the part of the normal equation matrix N related to the 6 parameters of the geometric affinity: N = σ −2 n ij ∇f θ (i, j)∇f T θ (i, j), where the sum is over all pixels in an N × N window. If we assume the distortion is zero and f is known, then the gradient is ∇f = [xf x , yf x , xf y , yf y , f x , f y ]. Observe, the 2 × 2 matrix referring to the translation parameters is proportional to the structure tensor of the patch. We now assume that the gradients in the window have the same variance σ 2 f and are mutually uncorrelated. Then the normal equation matrix will be diagonal leading to the covariance matrix Fig. 8 shows the predicted standard deviations for real image patches having different sizes, depending on the Lowe-scale s using M = 7s. In spite of the variation of the texture within the individual patches, the theoretical relation to the window size is visible. Deviations for large scales result from the fact that sometimes the interior of such patches is not highly textured.

Solvers using ACs -Semi-calibrated case
In this section, the solver for AC-based relative pose and focal length estimation is discussed.
Essential matrix and focal length from 2ACs: The problem of estimating the relative pose and a common focal length of two semi-calibrated cameras, i.e., estimating the unknown essential matrix E ∈ R 3×3 and focal length f ∈ R, has six degrees of freedom (three for rotation, two for translation and one for focal length) and there exists several well-known hidden variable or Gröbner basis 6PCs solvers [?, 28]. This problem has recently been solved from 2ACs [3]. Each AC gives three linear constraints [5]. One approach to solve for E and f from 2ACs is to apply the solver of [3]. The 2ACs solver [3] as well as the hidden variable and Gröbner basis 6PCs solvers [?, 28] are based on ten well-known constraints on the essential matrix E, i.e., the singularity constraint det(E) = 0 and the trace constraint 2EE E − tr(EE )E = 0. These solvers are therefore solving a system of ten polynomial equations in three unknowns.
Recently, however, a more efficient solver for the 6PC problem was proposed in [31]. This solver is based on the fact that for a fundamental matrix of the is the calibration matrix with focal length f , two constraints can be derived. These constraints can by obtained by eliminating the focal length from the singularity and the trace constraint. The first constraint corresponds to the singularity constraint and the second one is a fifth degree polynomial in the elements of F (see Eq 18 in [31]). The final solver, after calculating the three dimensional null-space using six equations from the epipolar constraint, then solves these two equations in two unknowns (unknowns from the parameterization of F as a linear combination of basis nullspace vectors). Note that in the solver the scale of F is fixed by fixing one element in the linear combination of the null-space vectors. However, for the uncertainty propagation the scale will be fixed by applying a different constraint on F, i.e., the constraint ||vec(F)||−1 = 0. The parameterization from [31], with two constraints instead of ten from the singularity and the trace constraints [?, 28], not only leads to a simpler solver but will also be useful for fast uncertainty propagation as we will discuss in Sec. 7.3.
The formulation with two constraints on F can be straightforwardly adapted for the 2ACs solver. We propose to use the solver from [31] by first calculating the null-space using the linear system which 2 ACs imply. The rest of the solver remains unchanged and can be similarly applied as when using point correspondences.

Uncertainty Calculation
All geometric problems we address in the paper are based on a set of constraints g(y, θ) = 0 between some observations y, and some parameters θ. The classical variance propagation for implicit functions leads to see [21,Sect. 2.7.5]. In our context, the covariance matrix Σ yy refers to the input measurements (e.g., keypoints coordinates or affinity correspondences), the covariance matrix Σ θθ refers to the model parameters.
For minimal problems, the number of constraints g is usually smaller than the number of parameters of the model and hence the matrix B cannot be inverted. Therefore, we propose to redefine the implicit function by adding constraints h(θ) = 0 between the model parameters only, i.e., we use the extended implicit function with their Jacobians This way we have exactly the same number of constraints as the parameters, and -except for critical geometric configurations -the matrix B is regular. The following paragraphs list the minimal set of constraints g, h used by individual solvers in our paper.
Homography estimation. The homography matrix has eight degrees of freedom and is defined by the nine parameters θ, i.e., the elements of the matrix H ∈ R 3×3 . In the case of PCs, we used eight constraints g from 4 PCs following [27] (the DLT algorithm for homography estimation) and one constraint h(H) = ||vec(H)|| − 1 = 0, which avoids the trivial all-zeros solution. Observe, the this norm constraint influences both, the scale of H and the scale of its covariance matrix.
Assuming two ACs, one can select the subset of constraints used for the uncertainty propagation. We defined g as four constraints from two point correspondences [4] (Eqn. 1 in [4]), and four constraints from one affinity matrix [4] (Eqn. 4 in [4]). The constraint h(H) = ||vec(H)|| − 1 = 0 is the same as for PCs.
The constraints for 3 ACs are composed of (1) three point constraints following [27] of the form (2) three pairs of affine constraints [3], (Eqn. 8 in [3]) of the form and ( Essential matrix estimation. We list two ways how to propagate the uncertainty to the parameters of the essential matrix. The essential matrix E ∈ R 3×3 has nine variables and five degrees of freedom. Assuming point correspondences, a straightforward solution is to employ five points constraints g i = y i Ez i = 0, where i ∈ {1, . . . , 5} and four constraints h = [h 1 , h 2 , h 3 , h 4 ] T on vec(E). The constraints h 1 (E) = det(E) = 0 and h 2 (E) = ||vec(E)|| 2 − 2 = 0 correspond to those for the fundamental matrix. The essential matrix has also nine trace constraints C := 2EE E − tr(EE )E = 0. Generally, we can select any two of this nine constraints such that the constraints in h are independent, except for certain cases, such as E = [1; 0; 0] × , where the Jacobian ∂vec(C)/∂vec(E) has 4 zero rows, not allowing us to use the corresponding constraints, and one is proportional to the Jacobian of the determinant constraint. The propagation can also be obtained by using a minimal set of parameters, e.g., a unit translation vector b = [b 1 , b 2 , b 3 ] and the Euler vector parametrization of the rotation R(r) ∈ SO(3). For this parametrization, we assume the essential matrix has the form E = [b] x R(r), where Here, the matrix I 3 ∈ R 3x3 is the identity matrix. This representation leads to five points constraints and only one constraint h(b) = ||b|| − 1 = 0. We used this second representation for our experiments. The minimal problem using two AC has three constraints for each point, i.e., g i = y i Ez i = 0, and constraints provided by Eqn. 9 and 10 in [3]. We used the reduced set of parameters b, r with the constraint h(b) = ||b|| − 1 = 0 and five of six constraints on the two ACs, i.e., we suppress one equation of the form of Eq. 10 in [3] to have the same number of constraints as parameters.
Essential matrix + focal length estimation. The essential matrix with focal length has six degrees of freedom and nine parameters as it can be described as F = K − EK −1 , where K = Diag([f, f, 1]) is the calibration matrix with focal length f . We assume six point or two affine correspondences as input, which lead to the same constraints as for the essential matrix, i.e., six constraints g(θ). Further, we used the constraints h = [h 1 , h 2 , h 3 ] T where h 1 , h 2 are the same constraints as for the fundamental matrix and h 3 corresponds to Eqn. 18 from [31].

Preemptive Verification
We used the a-priori determined parameters of the inlier ratio distributions (c.f . Fig. 9), to measure the probability of having a good model based on its uncertainty. For determining the parameters of the distributions, we saved the uncertainty (measured by the trace of the covariance matrix) of all models generated (a) Homography estimation (b) Fundamental matrix estimation Fig. 9: The inlier ratio (vertical) of homographies and fundamental matrices from all tested real scenes as a function of the trace of their covariance matrices (horizontal). This shows that, for points, uncertain models (on right) generate small numbers of inliers. For affine correspondences, the traces have a log-normal distribution.
in the RANSAC loop, on all scenes from all datasets, and, also, their number of inliers divided by the number of inliers of the best model found on that particular image pair, i.e., we saved their inlier ratios. We found that calculating the parameters of the distributions using only those models which lead to an inlier ratio of, at least, 0.95 works well for for all problems considered in the paper.
In our experiments, we fit the exponential distribution parameterλ = (n − 2)/ n i=1 (t i ), where n is the number of good models θ i and t i is the trace of covariance matrices, i.e., t i = tr(Σ θiθi ). For solvers using affine correspondences, the distributions are described by a log-normal distribution, i.e., by mean µ = 1/n n i=1 log 10 (t i ) and variance σ 2 = 1/(n − 1) n i=1 (log 10 (t i ) − µ) 2 ).

Local Optimization
The cumulative distribution functions of the wall-clock times and log 10 iteration numbers using different local optimizations for affine correspondence (AC) and point-based (PC) solvers are shown in Fig. 10. For homography and fundamental matrix estimation, the proposed combined preemptive model verification strategy was used. For essential matrices, SPRT [11] was applied. It can be seen that Graph-Cut RANSAC [6] (GC-RANSAC) is the fastest and leads to the fewest RANSAC iterations on all investigated problems. Also, methods using ACs are significantly faster than point-based ones.