# Evolutionary Optimization for Robust Epipolar-Geometry Estimation and Outlier Detection
## 4 Robust Estimation via the Genetic Algorithm
### Inlier Classification  
Once the genetic algorithm terminates, the inlier set of minimum cardinality, \(\hat{\mathbf{1}}\), is found, and the final fundamental matrix, \(\hat{P}\), is re-estimated using these points by performing iterative least squares adjustment using the Gauss-Helmert model as:  
\[\mathrm{U}(\mathbf{\theta},\mathbf{I})=\mathbf{s}_{k}^{\prime T}\mathbf{s}_{k}=0,\ k\in\hat{\mathbf{1}} \tag{12}\] \[s.t.\ \det(F)=0\]  
where the vector observations, \(\mathbf{I}\), include the coordinates of correspondences, \(\mathbf{u}_{k}\leftrightarrow\mathbf{u}_{k}^{\prime}\), \(k\in\hat{\mathbf{1}}\), which are normalized by \(T\) and \(T^{\prime}\) as Hartley normalizing transformation as such \(\mathbf{s}_{k}=T\mathbf{u}_{k}\), \(\mathbf{s}_{k}^{\prime}=T^{\prime}\mathbf{u}_{k}^{\prime}\). The vector of parameters is \(\mathbf{\theta}=(F_{11},F_{12},F_{13},F_{21},F_{22},F_{23},F_{31},F_{32},F_{33})^{T}\); note that one element of the fundamental matrix, here \(F_{33}\), is assumed fixed based on the direct result of \(F\) obtained from the GA.  
Now, inliers can be distinguished as the correspondences with residuals from \(\hat{F}\) that are less than a given threshold. The important issue would be determining this threshold. Standard RANSAC algorithms determine this quantity using maximum likelihood estimation based on the median of the residuals associated with the best tentative model. In this paper, the uncertainty of the final fundamental matrix is considered to calculate an adaptive threshold as follows. First, the covariance matrix of the estimated parameters can be derived using the covariance law as in Equation (13):  
\[\hat{\Sigma}_{\hat{\mathbf{\theta}}}=\frac{\hat{\upsilon}^{\mathrm{T}}\hat{\upsilon} }{n^{*}-8}\big{(}A^{\mathrm{T}}(BB^{\mathrm{T}})^{-1}A\big{)}^{-1}, \tag{13}\]  
where \(A=\frac{\partial\mathrm{U}}{\partial\mathbf{\theta}}\) and \(B=\frac{\partial\mathrm{U}}{\partial\mathbf{I}}\) are Jacobian matrices calculated at re-estimated coordinates of the correspondences \(\hat{\mathbf{u}}_{k}\leftrightarrow\hat{\mathbf{u}}_{k^{\prime}}^{\prime}\), \(k\in\hat{\mathbf{I}}\), and \(\hat{\upsilon}\) is the vector of estimated residuals. From Equation (12), \(\hat{F}=T^{\prime T}FT:=G(\hat{\mathbf{\theta}})\). We can determine the uncertainty of the estimated fundamental matrix using the rules of error propagation as follows.  
\[\hat{\Sigma}_{\hat{F}}=\big{(}\frac{\partial G}{\partial\hat{\theta}}\big{)} \hat{\Sigma}_{\hat{\mathbf{\theta}}}\big{(}\frac{\partial G}{\partial\hat{\theta} }\big{)}^{\mathrm{T}}. \tag{14}\]  
For each match \(\mathbf{u}_{k}\leftrightarrow\mathbf{u}_{k}^{\prime}\) belonging to the inlier set of minimum cardinality, the Sampson distance \(d_{k}\) and its variance \(\sigma_{d_{k}}^{2}\) can be calculated via Equation (15).  
\[\sigma_{d_{k}}^{2}=\big{(}\frac{\partial d_{k}}{\partial\mathbf{y}} \big{)}\Sigma_{y}\big{(}\frac{\partial d_{k}}{\partial\mathbf{y}}\big{)}^{ \mathrm{T}},\,k\in\hat{\mathbf{I}}\] \[\text{where :}\] \[\mathbf{y}=(\hat{F}_{11},\dots,\hat{F}_{32},\hat{F}_{33},\mathbf{u}_{k}^{ \mathrm{T}},\mathbf{u}_{k}^{\prime\,\mathrm{T}})^{\mathrm{T}}\] \[\Sigma_{y}=\begin{bmatrix}\hat{\Sigma}_{\hat{F}}&0_{9\times 4}\\ 0_{4\times 9}&\sigma_{\max}I_{4}\end{bmatrix}. \tag{15}\]  
The average of these distances, \(\bar{\mu}=\sum_{k\in\hat{\mathbf{I}}}d_{k}/n^{*}\), and their standard deviation, \(\sigma=\sqrt{\sum\sigma_{d_{k}}^{2}}/n^{*}\), can represent the distribution of the residuals for inliers. Considering [PERSON]'s inequality, at least 95% of the population is within 4.47-times the standard deviation from the mean, no matter what kind of probability distribution they are following. Therefore, every match with index \(j\) is an outlier by the confidence of 95% if its residual, \(d_{j}\), is greater than \(\bar{\mu}_{d}+4.47\sigma_{d}\). To ensure a maximum set of inliers and avoid possible false positives or negatives, this whole procedure can be repeated a few times using the new set of detected inliers.