# Stereo Digital Image Correlation in MATLAB
## 2 Framework Theory
### Polynomial Triangulation Method  
The polynomial triangulation method, proposed by [PERSON] and [PERSON] [66], determines \(\hat{\mathbf{x}}_{s_{j}}\) by minimizing the geometric error cost function, \(D\), given as  
\[D=\delta(\hat{\mathbf{x}}_{s_{1}},\hat{\mathbf{x}}_{s_{1}})^{2}+\delta(\hat{\mathbf{x}}_{s _{2}},\hat{\mathbf{x}}_{s_{2}})^{2}\text{ subject to }\hat{\mathbf{x}}_{s_{2}}^{T}B\hat{\mathbf{x}}_{s_{1}}=0. \tag{33}\]  
Here function \(\delta\) determines the Euclidean distance between two points. Determining \(\hat{\mathbf{x}}_{s_{j}}\) by minimizing the distance between the coordinates \(\hat{\mathbf{x}}_{s_{j}}\) and \(\hat{\mathbf{x}}_{s_{j}}\) within the ideal sensor CSs ensures that the polynomial triangulation method is projective-invariant. Projective-invariance implies that the projective frame within which \(\hat{\mathbf{x}}_{w}\) is defined does not affect the values of \(\hat{\mathbf{x}}_{s_{j}}\)[65]. The polynomial method assumes that the calibration parameters are known with greater accuracy than the measured coordinates [66]. Furthermore, it is assumed that neither \(\hat{\mathbf{x}}_{s_{j}}\) nor \(\hat{\mathbf{x}}_{s_{j}}\) coincides with an epipole since this would lead to an unfavorable solution for the 3D coordinate. It is known that a pair of ideal coordinates which satisfy the epipolar constraint lie on a pair of corresponding epipolar lines. Additionally, the epipolar plane can only rotate about the baseline since the camera CSs, and thus epipoles, are fixed. Thus, there is a family of epipolar lines upon which the idea coordinates can lie. Furthermore, the projective-invariance of the polynomial triangulation method allows applying a separate rigid transformation to each ideal sensor CS in order to parameterize the family of epipolar lines in terms of a single variable \(t\). As such, homogeneous coordinates are utilized and Equation (32) becomes  
\[D=\delta(\hat{\mathbf{x}}_{s_{1}},\underline{\mathbf{\lambda}}_{1}(t))^{2}+\delta( \hat{\mathbf{x}}_{s_{2}},\underline{\mathbf{\lambda}}_{2}(t))^{2}, \tag{34}\]  
where \(\underline{\mathbf{\lambda}}_{j}(t)\) is a vector representing an epipolar line in the ideal sensor CS as a function of \(t\) while \(\delta\Big{(}\hat{\mathbf{x}}_{s_{j}},\underline{\mathbf{\lambda}}_{j}(t)\Big{)}\) represents the distance from \(\hat{\mathbf{x}}_{s_{j}}\) to its orthogonal projection on \(\underline{\mathbf{\lambda}}_{j}(t)\). The rigid transformations first apply a translation matrix, \(\mathbf{T}_{j}^{pm}\), to each ideal sensor CS translating \(\hat{\mathbf{x}}_{s_{j}}\) to the origin of its CS. \[\mathbf{T}_{1}^{pm}=\left[ \begin{array}{ccc}1&0&-\hat{x}_{s_{1}}\\ 0&1&-\hat{y}_{s_{1}}\\ 0&0&1\end{array} \right]\text{ and }\mathbf{T}_{2}^{pm}=\left[ \begin{array}{ccc}1&0&- \hat{x}_{s_{2}}\\ 0&1&-\hat{y}_{s_{2}}\\ 0&0&1\end{array} \right]. \tag{35}\]  
The original fundamental matrix, \(\mathbf{B}\), determined using Equation (27) needs to be updated as  
\[\mathbf{B}_{1}=\mathbf{T}_{2}^{pm-T}\mathbf{B}\mathbf{T}_{1}^{pm-1}. \tag{36}\]  
The epipoles \(\mathbf{\varepsilon}_{s_{1}}\) and \(\mathbf{\varepsilon}_{s_{2}}\) of the first and second cameras are computed, using singular value decomposition, as the right and left null-space of \(\mathbf{B}_{1}\) respectively. Thereafter they are normalized such that \(\left(e_{s_{1}}^{1}\right)^{2}+\left(e_{s_{1}}^{2}\right)^{2}=1\) and \(\left(e_{s_{2}}^{1}\right)^{2}+\left(e_{s_{2}}^{2}\right)^{2}=1\). The second step of the rigid transformation applies rotations \(\mathbf{R}_{1}^{pm}\) and \(\mathbf{R}_{2}^{pm}\) to the ideal sensor CSs of the first and second cameras respectively in order to place their epipoles on the x-axes of their respective CSs as \(\mathbf{R}_{1}^{pm}\)\(\mathbf{\varepsilon}_{e_{1}}=\left[ \begin{array}{ccc}1&0&e_{s_{1}}^{3}\end{array}  \right]^{T}\) and \(\mathbf{R}_{2}^{pm}\)\(\mathbf{\varepsilon}_{e_{2}}=\left[ \begin{array}{ccc}1&0&e_{s_{2}}^{3}\end{array}  \right]^{T}\). \[\mathbf{R}_{1}^{pm}=\left[