# Bayesian Filtering Multi-Baseline Phase Unwrapping Method Based on a Two-Stage Programming Approach
## 2 MBPU Theory and Phase Gradient Estimation
### Phase Gradient Estimation  
Phase gradient estimation is a key step of PU. Whether we use an SBPU or MBPU method, accurate phase gradient estimation method is necessary to obtain a high-precision wrapped phase. According to Equation (4), we can obtain similar equations of a neighboring pixel \(k-1\) of pixel \(k\), so we will have:  
\[B_{2}\cdot(\varphi_{1}(k-1)+2n_{1}(k-1)\pi)=B_{1}\cdot(\varphi_{2}(k-1)+2n_{2 }(k-1)\pi) \tag{5}\]According to Equation (5) and Equation (4), we can obtain as follows:  
\[B_{2}\cdot(\varphi_{1}(k)-\varphi_{1}(k-1)+2(n_{1}(k)-n_{1}(k-1))\pi)=B_{1}\cdot( \varphi_{2}(k)-\varphi_{2}(k-1)+2(n_{2}(k)-n_{2}(k-1))\pi) \tag{6}\]  
We can further rewrite Equation (6) as:  
\[B_{2}\cdot(\varphi_{1}(k)-\varphi_{1}(k-1)+2(\hat{\Delta}n_{1}(k,k-1))\pi)=B_{ 1}\cdot(\varphi_{2}(k)-\varphi_{2}(k-1)+2(\hat{\Delta}n_{2}(k,k-1))\pi) \tag{7}\]  
where \(\hat{\Delta}n_{1}(k,k-1)=n_{1}(k)-n_{1}(k-1)\) and \(\hat{\Delta}n_{2}(k,k-1)=n_{2}(k)-n_{2}(k-1)\). From the Equation, it can be seen that \(\hat{\Delta}n_{1}(k,k-1)\) and \(\hat{\Delta}n_{2}(k,k-1)\) are the gradient information between neighboring pixels, and they are both integers. So, we can obtain them by the CRT-based optimization model:  
\[\arg\min_{\begin{subarray}{c}\Delta n_{1}(kk-1)\\ \Delta n_{2}(k,k-1)\end{subarray}}\big{|}R(\hat{\Delta}n_{1}(k,k-1),\hat{ \Delta}n_{2}(k,k-1))\big{|},\quad\hat{\Delta}n_{1}(k,k-1),\hat{\Delta}n_{2}(k,k-1)\in\text{integer} \tag{8}\]  
where \(R(\hat{\Delta}n_{1}(k,k-1),\hat{\Delta}n_{2}(k,k-1))=B_{2}\cdot((\varphi_{1}( k)-\varphi_{1}(k-1))+2(\hat{\Delta}n_{1}(k,k-1))\pi)-B_{1}\cdot((\varphi_{2}(k)- \varphi_{2}(k-1))+2(\hat{\Delta}n_{2}(k,k-1))\pi)\). According to the above equations, we can obtain the ambiguity numbers of the gradient, which is the first step of TSPA.  
We assume that an interferometric phase is \(M\times N\) pixels. According to Equation (8), we can obtain the ambiguity numbers of these gradients. The phase gradients can be obtained based on the relationship between a point and its neighbors. Therefore, the estimated gradients can be obtained by the following formula:  
\[\left\{\begin{array}{ll}\overline{\delta_{i_{V}}}&=\psi_{i}(m+1,n)-\psi_{i} (m,n)=\varphi_{i}(m+1,n)-\varphi_{i}(m,n)+2\cdot\pi\cdot\hat{\Delta}n_{i_{V}} \\ &=s_{i_{V}}+2\cdot\pi\cdot\hat{\Delta}n_{i_{V}}\\ &=\overline{s}_{i_{V}}+2\cdot\pi\cdot\overline{\Delta}n_{i_{V}}+\omega_{i_{V}} \\ \overline{\delta_{i_{H}}}&=\psi_{i}(m,n+1)-\psi_{i}(m,n)=\varphi_{i}(m,n+1)- \varphi_{i}(m,n)+2\cdot\pi\cdot\hat{\Delta}n_{i_{H}}\\ &=s_{i_{H}}+2\cdot\pi\cdot\hat{\Delta}n_{i_{H}}\\ &=\overline{s}_{i_{H}}+2\cdot\pi\cdot\overline{\Delta}n_{i_{H}}+\omega_{i_{H}} \end{array}\right. \tag{9}\]  
where \(\overline{\delta_{i_{V}}}\) and \(\overline{\delta_{i_{H}}}\) represent the gradients after slight median filtering, respectively; \(\hat{\Delta}n_{i_{V}}\) and \(\hat{\Delta}n_{i_{H}}\) represent the gradient ambiguity numbers; \(\overline{s}_{i_{V}}\) and \(\overline{s}_{i_{H}}\) represent the wrapped phase gradients without noise; \(\overline{\Delta}n_{i_{V}}\) and \(\overline{\Delta}n_{i_{H}}\) represent the gradient ambiguity numbers without noise; \(\omega_{i_{V}}\) and \(\omega_{i_{H}}\) represent the gradient estimation errors. As can be seen from Equation (9), the gradients estimation method proposed in this paper is not limited by the PCA.