# Stereo Digital Image Correlation in MATLAB
## 2 Framework Theory
### Polynomial Triangulation Method
\begin{array}{ccc}e_{s_{1}}^{1}&e_{s_{1}}^{2}&0\\ -e_{s_{1}}^{2}&e_{s_{1}}^{1}&0\\ 0&0&1\end{array} \right]\text{and }\mathbf{R}_{2}^{pm}=\left[ \begin{array}{ccc}e_{s_{2}}^{1}&e_{s_{2}}^{2}&0\\ -e_{s_{2}}&e_{s_{2}}^{1}&0\\ 0&0&1\end{array} \right]. \tag{37}\]The fundamental matrix is updated as  
\[B_{2}=R_{2}^{pm}B_{1}R_{1}^{pmT}. \tag{38}\]  
Since \(\mathbf{B}_{2}\big{[} \begin{array}{cccc}1&0&\varepsilon_{s_{1}}^{3}\end{array}  \big{]}^{T}=\big{[} \begin{array}{cccc}1&0&e_{s_{2}}^{3}\end{array} \big{]}B_{2}= \big{[} \begin{array}{cccc}0&0&0\end{array} \big{]}^{T}\) the elements of the fundamental matrix are represented as  
\[\mathbf{B}_{2}=\left[ \begin{array}{cccc}e_{s_{1}}^{3}e_{s_{2}}^{3}\varphi_{4}&- e_{s_{2}}^{3}\varphi_{3}&-e_{s_{2}}^{3}\varphi_{4}\\ -e_{s_{1}}^{3}\varphi_{2}&\varphi_{1}&\varphi_{2}\\ -e_{s_{1}}^{3}\varphi_{4}&\varphi_{3}&\varphi_{4}\end{array} \right]. \tag{39}\]  
An epipolar line of the first camera, \(\underline{\lambda}_{1}(t)\), passing through point \(\big{[} \begin{array}{cccc}0&t&1\end{array} \big{]}^{T}\) on the y-axis of the ideal sensor CS is represented as  
\[\underline{\lambda}_{1}(t)=\big{[} \begin{array}{cccc}0&t&1\end{array}  \big{]}^{T}\times\big{[} \begin{array}{cccc}1&0&e_{s_{1}}^{3}\end{array}  \big{]}^{T}=\big{[} \begin{array}{cccc}t\varepsilon_{s_{1}}^{3}&1&-t\end{array}  \big{]}^{T}. \tag{40}\]  
The corresponding epipolar line of the second camera, \(\underline{\lambda}_{2}(t)\), is computed as  
\[\underline{\lambda}_{2}(t)=\mathbf{B}_{2}\big{[} \begin{array}{cccc}0&t&1\end{array}  \big{]}^{T}=\big{[} \begin{array}{cccc}-e_{s_{2}}^{3}(\varphi_{3}t+\varphi_ {4})&\varphi_{1}t+\varphi_{2}&\varphi_{3}t+\varphi_{4}\end{array} \big{]}^{T}. \tag{41}\]  
Thus, \(\delta\big{(}\underline{\hat{x}}_{s_{1}},\underline{\lambda}_{1}(t)\big{)}^{2} =\frac{t^{2}}{1+\left(t\varepsilon_{s_{1}}^{3}\right)^{2}}\) and \(\delta\big{(}\underline{\hat{x}}_{s_{2}},\underline{\lambda}_{2}(t)\big{)}^{2} =\frac{(\varphi_{3}t+\varphi_{4})^{2}}{\left(\varphi_{1}t+\varphi_{2}\right)^ {2}+\varepsilon_{s_{2}}^{3}\left(\varphi_{3}t+\varphi_{4}\right)^{2}}\) and so Equation (34) has the form  
\[D(t)=\frac{t^{2}}{1+\left(t\varepsilon_{s_{1}}^{3}\right)^{2}}\frac{\left( \varphi_{3}t+\varphi_{4}\right)^{2}}{\left(\varphi_{1}t+\varphi_{2}\right)^{ 2}+\varepsilon_{s_{2}}^{3}\left(\varphi_{3}t+\varphi_{4}\right)^{2}}. \tag{42}\]  
Finding the optimal value of \(t\) involves taking the derivative Equation (42) in terms of \(t\), collecting terms over a common denominator and equating the resulting numerator to \(0\) as  
\[t\Big{(}\big{(}\varphi_{1}t+\varphi_{2}\big{)}^{2}+\varepsilon_{s_{2}}^{3} \left(\varphi_{3}t+\varphi_{4}\right)^{2}\Big{)}^{2}-\left(\varphi_{1}\varphi_ {4}-\varphi_{2}\varphi_{3}\right)\left(1+\left(t\varepsilon_{s_{1}}^{3} \right)^{2}\right)^{2}\left(\varphi_{1}t+\varphi_{2}\right)\left(\varphi_{3}t+ \varphi_{4}\right)=0. \tag{43}\]  
The \(6\) roots of Equation (43) are solved for and Equation (42) is evaluated at the real parts of these roots to determine the value of \(t\) which corresponds to a minimum. The asymptotic value of Equation (42) should also be evaluated as \(t\rightarrow\infty\) which corresponds to an epipolar line in the first image of \(e_{s_{1}}^{3}\hat{x}_{s_{1}}=1\)[65]. The optimal \(t\) is used to determine \(\hat{x}_{s_{1}}\) and \(\hat{x}_{s_{2}}\) as  
\[\hat{x}_{s_{1}}=\Phi\Bigg{(}\mathbf{T}_{1}^{pm-1}\mathbf{R}_{1}^{pmT}\Bigg{[} \begin{array} []{c}t^{2}e_{s_{1}}^{3}\\ t\\ \left(t\varepsilon_{s_{1}}^{3}\right)^{2}+1\end{array} \Bigg{]}\Bigg{)} \tag{44}\]  
\[\text{and }\hat{x}_{s_{2}}=\Phi\Bigg{(}\mathbf{T}_{2}^{pm-1}\mathbf{R}_{2}^{pmT}\Bigg{[} \begin{array}{c}e_{s_{2}}^{3}(\varphi_{3}t+\varphi_{4})^{2}\\ -\left(\varphi_{1}t+\varphi_{2}\right)(\varphi_{3}t+\varphi_{4})\\ \left(\varphi_{1}t+\varphi_{2}\right)^{2}+\varepsilon_{s_{2}}^{3}\left( \varphi_{3}t+\varphi_{4}\right)^{2}\end{array} \Bigg{]}\Bigg{)}.