## 2 Methodology
### Stereo-Matching Method Based on Spatiotemporal Correlation  
A diagram of stereo matching based on the spatiotemporal correlation is shown in Figure 1. A series of time-varying speckle patterns are projected onto the surface of the measured object, and two cameras synchronously acquire a set of speckle-coded stereo-image pairs. To implement the speckle spatiotemporal correlation calculation, the projector must project multiple different speckle patterns continuously. Most current solutions use commercial projectors [30; 31; 32; 33], but they are too large to meet the requirements of 3D face imaging equipment production. Given these considerations, our group designed a 3D face acquisition device based on a rotating speckle projector, which consists of a light-emitting diode (LED) light source, multiple sets of lenses and speckle diaphragms, which can project any number of speckle patterns. A schematic of a 3D face acquisition device with a rotary speckle projector is shown in Figure 2. After the binocular camera acquires a pair of stereo images, the speckle mask rotates at a certain angle and stops. The camera then acquires the next pair of images. In the experimental part of this study, the equipment is employed to acquire multiple speckle stereo image pairs to analyse the relationship between the number of projection patterns, 3D reconstruction accuracy and calculation speed. Figure 1: Spatiotemporal stereo scheme for fast three-dimensional face reconstruction. Figure 2: Schematic diagram of 3-dimensional face acquisition device with rotary speckle projector: (**a**) structure map of the device; (**b**) internal structure of the rotary speckle projector, where the speckle mask rotates at angular velocity \(\omega\). When performing spatiotemporal stereo matching, by calculating the correlation coefficients in two cubes composed of correlation windows in the time domain and the spatial domain, the matching positions of homologous points can be obtained. The stereo-matching method based on the spatiotemporal correlation is shown in Figure 3. Taking \(p\), one matching point in the left image, as the centre, a rectangular region, \(\Omega\), having a width of \(w_{x}\) and a length of \(w_{y}\) on the temporal domain along the sampling time, the axis is formed. The same-size cube from the right camera is chosen to perform the spatiotemporal correlation operation with the volume around \(p\). According to the epipolar constraint characteristics of binocular vision, the corresponding points in the left and right views are searched on a line parallel to the baseline. A similarity measure function is considered for spatiotemporal correlation: the spatiotemporal zero mean normalised cross-correlation (STZNCC) [34]. This function can better adapt to the characteristics of speckle images, which effectively reduce the impact of inconsistent brightness of the left and right images. STZNCC expression is defined as follows:  
\[\small \begin{split}\text{C}_{STZNCC}(x,y,d)=\frac{\sum\limits_{t=1 }^{N}\sum\limits_{h=-w_{y}/2}^{w_{y}/2}\sum\limits_{l=-w_{x}/2}^{w_{x}/2} \left[L_{(x,y)}(l,h,t)-\overline{L_{(x,y)}}\right]\cdot\left[R_{(x-d,y)}(l,h,t) -\overline{R_{(x-d,y)}}\right]}{\sqrt{\sum\limits_{t=1}^{N}\sum\limits_{h=-w_{ y}/2}^{w_{y}/2}\sum\limits_{l=-w_{x}/2}^{w_{x}/2}\left[L_{(x,y)}(l,h,t)- \overline{L_{(x,y)}}\right]^{2}\sqrt{\sum\limits_{t=1}^{N}\sum\limits_{h=-w_{ y}/2}^{w_{y}/2}\sum\limits_{l=-w_{x}/2}^{w_{x}/2}\left[R_{(x-d,y)}(l,h,t)- \overline{R_{(x-d,y)}}\right]^{2}}}\end{split}  \tag{1}\]  
where \((x,y)\) denotes the pixel coordinates, \(d\) is the disparity and \(C_{STZNCC}(x,y,d)\) is the correlation coefficient of the disparity; \(d\), in the right image.