## 3 Stmcf  
To find the matching point pairs between left and right speckle images more accurately and make full use of both spatial and temporal features provided by multiple speckle stereo image pairs, we expand our previously proposed matching cost function [27] to the temporal domain and a weighted-fusion-based STMCF is proposed. It combines four different similarity metrics: AD, Census transformation [18], horizontal image gradient and vertical image gradient. Each of them has expanded to the temporal domain and their computation methods are detailed as follows. Since the acquired speckle stereo image pairs are grayscale images, AD is computed by using the gray value between two points at the left and right speckle images. For a given point \(m\) (\(x_{m},y_{m}\)) in the left speckle image, the cost value \(C_{\text{AD}}\) (\(x_{m}\), \(y_{m}\), \(d\), \(N\)) is computed by the following equation:  
\[C_{\text{AD}}(x_{m},y_{m},d,N)=\frac{1}{N}\sum_{t=1}^{N}\left|I_{t}^{\text{Left }}(x_{m},y_{m})-I_{t}^{\text{Right}}(x_{m}-d,y_{m})\right| \tag{1}\]  
where \(N\) is the number of speckle stereo image pairs, which is equal to the number of projected speckle patterns, \(I_{t}^{\text{Left}}\) (\(x_{m}\), \(y_{m}\)) is the gray value of point \(m\) in the left image under the \(t\)-th speckle pattern projection and \(I_{t}^{\text{Right}}\) (\(x_{m}\)-\(d\), \(y_{m}\)) is the gray value of the corresponding point in the right image under the \(t\)-th speckle pattern projection when the disparity is \(d\). Census transformation [18] firstly obtains the binary code by comparing the gray value between the center pixel and other pixels in the given window as follows:  
\[S_{t}(x_{m},y_{m})=\underset{i\in w_{m}}{\otimes}F(I_{t}(x_{m},y_{m}),I_{t}(x _{i},y_{i})),\hskip 14.226378 pt(t\in[1,N]) \tag{2}\]  
\[F(I_{t}(x_{m},y_{m}),I_{t}(x_{i},y_{i}))= \begin{cases}1,&I_{t}(x_{m},y_{m})>I_ {t}(x_{i},y_{i})\\ 0,&\text{otherwise}\end{cases} ,\hskip 14.226378 pt(t\in[1,N]) \tag{3}\]  
where \(S_{t}\) (\(x_{m}\), \(y_{m}\)) is the binary code of point \(m\) in the left image under the \(t\)-th speckle pattern projection, \(\otimes\) represents the bitwise connection operation and \(w_{m}\) is the given window centered on point \(m\). Afterwards, Hamming distance is utilized for measuring similarity between the corresponding points. The cost value \(C_{\text{census}}\) (\(x_{m}\), \(y_{m}\), \(d\), \(N\)) is calculated by the following expression:  
\[C_{\text{census}}(x_{m},y_{m},d,N)=\frac{1}{N}\sum\limits_{t=1}^{N}\text{ Hamming}\Big{[}S_{t}^{\text{Left}}(x_{m},y_{m}),S_{t}^{\text{Right}}(x_{m}-d,y_{m}) \Big{]} \tag{4}\]  
where the notations are listed as follows:  
\[S_{t}^{\text{Left}}(x_{m},y_{m})=\underset{i\in w_{m}}{\otimes}F\Big{(}I_{t} ^{\text{Left}}(x_{m},y_{m}),I_{t}^{\text{Left}}(x_{i},y_{i})\Big{)},\ \ \ \ \ (t\in[1,N]) \tag{5}\]  
\[S_{t}^{\text{Right}}(x_{m}-d,y_{m})=\underset{i\in w_{m}}{\otimes}F\Big{(}I_{t }^{\text{Right}}(x_{m}-d,y_{m}),I_{t}^{\text{Right}}(x_{i},y_{i})\Big{)},\ \ \ \ \ (t\in[1,N]) \tag{6}\]  
The horizontal and vertical image gradient are computed by our proposed method, respectively. In contrast to traditional gradient computing method, besides the gradient of the speckle image itself, our method also takes the gradient of the guided image into account. The guided image is obtained by using the guided filter [28] (GF) because it has advantages of high computational efficiency, good smoothing effect and edge-preserving feature. The computing method of horizontal and vertical image gradient can be respectively expressed as follows:  
\[ \begin{array}{l}C_{\text{gh}}(x_{m},y_{m},d,N)=\frac{1}{N}\sum\limits_{t=1}^ {N}&\big{[}\big{|}gx_{t}^{\text{IL}}(x_{m},y_{m})-gx_{t}^{\text{IR}}(x_{m}-d, y_{m})\big{|}+\\ &\big{|}gx_{t}^{\text{GIL}}(x_{m},y_{m})-gx_{t}^{\text{GIR}}(x_{m}-d,y_{m}) \big{|}\big{]}\\ \end{array}  \tag{7}\]  
\[