{'fraction_non_alphanumeric': 0.03452247975425859, 'fraction_numerical': 0.013543702876291539, 'mean_word_length': 4.6428993500098485, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Depth Estimation by Combining Binocular Stereo and Monocular Structured-Light

It is well known that the passive stereo system cannot adapt well to weak texture objects, e.g., white walls. However, these weak texture targets are very common in indoor environments. In this paper, we present a novel stereo system, which consists of two cameras (an RGB camera and an IR camera) and an IR speckle projector. The RGB camera is used both for depth estimation and texture acquisition. The IR camera and the speckle projector can form a monocular structured-light (MSL) subsystem, while the two cameras can form a binocular stereo subsystem. The depth map generated by the MSL subsystem can provide external guidance for the stereo matching networks, which can improve the matching accuracy significantly. In order to verify the effectiveness of the proposed system, we build a prototype and collect a test dataset in indoor scenes. The evaluation results show that the Bad 2.0 error of the proposed system is 28.2% of the passive stereo system when the network RAFT is used. The dataset and trained models are available at https://github.com/YuhuaXu/MonoStereoFusion.


Introduction
Depth estimation is a fundamental problem in computer vision, which has numerous applications in the fields of 3D modeling, robotics, UAVs, augmented realities (AR), and autonomous driving [1,10,30]. Depth estimation methods can be divided into active structured-light, binocular stereo vision, time-of-flight (TOF), and monocular depth estimation.
Since Microsoft Kinect [48] was released in 2010, consumer-grade depth sensors have been widely used. Kinect is based on the monocular structured-light method, which was also used in iPhone X released in 2017. However, it may fail to obtain depth measurements for distant objects, or outdoor scenes under strong light. The binocular stereo vision system has a larger measurement range than * Corresponding author the structured-light system, and it can also work in outdoor environment with strong sunlight, but it is easily affected by the surface texture of the objects. In recent years, stereo matching methods based on deep learning have achieved remarkable progress. However, these methods may still fail on scenes with weak texture (e.g., white walls). And this kind of weak texture objects are very common in indoor environment. The binocular active structured-light system (e.g., Intel D435 [14]) relies on two IR cameras and an IR projector for depth estimation, which has good adaptability in both indoor and outdoor situations. To acquire texture, a third camera (i.e. RGB camera) is required. Since there is a baseline between the RGB camera and IR camera, a coordinate system conversion step is required to make the depth image aligned with the RGB image. Due to the noise of the depth map and the error of the calibration parameters, it is difficult to accurately align the RGB image and depth map. In terms of hardware, three cameras and one projector are required, which is not compact. TOF has poor adaptability to objects with low reflectivity and distant objects. In addition, TOF suffers from multipath interference [29]. The monocular depth estimation methods cannot obtain the depth maps with a certain scale [11].
In this work, we seek a compact depth sensing solution that can integrate the advantages of the monocular structured-light and binocular stereo vision.
The main contributions of this work are: (1) We propose a novel stereo vision system, which consists of an RGB camera, an IR camera and an IR speckle projector. Especially, the IR camera is not attached with a filter. Thus the IR camera can receive IR light (invisible to human eyes) and ambient light (visible to human eyes) simultaneously. The IR camera and IR projector can form a monocular active structured-light system as Kinect, while the IR camera and the RGB camera can form a binocular stereo system. These two types of stereo systems have complementary advantages. The active structured-light system is robust to weak texture objects (e.g., white walls) which are hard to handle for the passive binocular stereo system. We can obtain a robust stereo system by fusing the initial depth map obtained by the active structured-light system in the cost volume of stereo matching network.
(2) We build a prototype system and collect a new stereo dataset for integrating the monocular structured light and binocular stereo vision (MonoBinoStereo) to verify the effectiveness of the proposed method. The dataset will be open for further research.
(3) We find that DNN can accurately estimate the disparity map of a pair of asymmetric stereo images, where one is passive and the other is active (with speckles). To the best of our knowledge, this is the first time that DNN is used to process this kind of stereo images with asymmetric texture.
The features of the proposed stereo system are as follows: (1) Compared with the classical binocular stereo vision, it is robust to weak texture objects and rich texture objects simultaneously in indoor environments.
(2) Compared with the existing monocular structuredlight system (e.g., Kinect), it has a larger measuring distance range and better performance in outdoor environment.
(3) Compared with the existing active depth sensing system (e.g., Kinect and Intel D435), its output depth maps have better completeness. In addition, the depth map is naturally aligned with the RGB image pixel-by-pixel.
(4) For the interference of strong sunlight, it will degenerate into an ordinary passive stereo system in outdoor environments.

Related Work
Zbontar et al. [44] first use convolutional neural network (CNN) to compare two image patches (e.g., 9×9 or 11×11) and calculate their matching costs. The following steps, such as cost aggregation, disparity computation, and disparity refinement, are still traditional methods [23]. This method (i.e. MC-CNN) significantly improves the accuracy, but still struggles to produce accurate disparity results in textureless, reflective and occluded regions and is timeconsuming. DispNetC [22] is the first end-to-end stereo matching network, which is more efficient, almost 1000 times faster than MC-CNN-Acrt [44]. In DispNetC, there is an explicit correlation layer. In traditional stereo matching methods, there is usually a disparity refinement module. Inspired by this, the residual refinement layers are exploited [19,20,24] to further improve the prediction accuracy. Besides, the segmentation information [42] and edge information [32] are incorporated into the stereo matching networks to improve the performance. Wang et al. [37,38] propose a generic parallax-attention mechanism to capture stereo correspondence regardless of disparity variations. Optical flow and rectified stereo are closely related problems. RAFT [35] uses a gated recurrent unit (GRU) based operator to iteratively update the flow field using features retrieved from the correlation volume. RAFT shows good generalization performance.
GC-Net [16] first uses 3D convolutions for cost aggregation in a 4D cost volume, and utilizes the soft argmin to regress the disparity. Duggal et al. [8] adopt the idea of PatchMatch Stereo [2], and build a thin cost volume to speed up the prediction process. The similar idea is also used in [12]. Variance-based uncertainty estimation is used to adaptively adjust disparity search space of the thin cost volume [4,31]. Recent work [3,8] shows that the 3D convolution can improve matching accuracy on specific datasets. However, 3D convolution is more time-consuming than 2D convolution, which makes it difficult to apply in real-time applications. In order to pursue real-time performance, StereoNet [17] performs 3D convolution at a low resolution (e.g., 1/8 resolution), and then refines the disparities hierarchically. The resulting network can run in real-time at 60 fps. However, this simplification decreases the network's accuracy.
Xu et al. [40] design a bilateral grid based edgepreserving cost volume upsampling module. With the upsampling module, a high quality cost volume of high resolution can be obtained from the low resolution version efficiently. The upsampling module can be embedded into many existing stereo matching networks, such as GCNet [16], PSMNet [3] and GANet [45]. The resulting networks can be accelerated by several times while maintaining comparable accuracy. HITNet [34] does not explicitly build a volume and instead relies on a fast multiresolution initialization step, differentiable 2D geometric propagation and warping mechanisms to infer disparity hypotheses. To achieve high accuracy, this method infers slanted plane hypotheses allowing to accurately perform geometric warping and upsampling operations. In order to reduce the computation burden, Yao et al. [43] propose a decomposition model which performs dense matching at a very low resolution (e.g., 20 × 36) and uses sparse matching at different higher resolutions to recover the disparity of lost details scale-by-scale.
ActiveStereoNet [47] is the first deep learning solution for active stereo systems. Due to the lack of ground truth, the network is designed to be fully self-supervised. Instead of formulating the depth estimation via a correspondence search problem, Riegler et al. [28] show that a simple convolutional architecture is sufficient for high-quality disparity estimates in a monocular structured-light system.
Our work is also related to image guided depth completion, whose task is to estimate the dense depth map from sparse depth measurement. Ma et al. [21] proposed to feed the concatenation of the sparse depth and the color image into an encoder-decoder deep network. Jaritz et al. [15] combined semantic segmentation to improve the depth completion. Cheng et al. [5] proposed a convolu-tional spatial propagation network (CSPN) to post process the depth completion results with neighboring depth values. However, CSPN relies on fixed-local neighbors, which could be from irrelevant objects. Park et al. [25] proposed a non-local spatial propagation network for depth completion. This method can effectively avoids irrelevant local neighbors and concentrates on relevant non-local neighbors during propagation. Qiu et al. [27] learned surface normals as the intermediate representation. Xu et al. [41] modeled the geometric constraints between depth and surface normal in a diffusion module and predicted the confidence of sparse LiDAR measurements to mitigate the impact of noise. For addressing the problem of depth smearing, Imran et al. [13] proposed a multi-hypothesis depth representation that explicitly models both foreground and background depths in the difficult occlusion-boundary regions.
Compared with depth completion methods, our method can utilize the stereo pair and the depth guidance from the monocular structured light subsystem for disparity estimation. When the depth guidance is not available, the stereo pair can still be used to estimate the depth of the targets. The stereo images can form stronger constraints than single images.

Hardware
In this paper, we design a novel stereo camera. As illustrated in Figure 1d, the proposed stereo camera consists of an RGB camera, an IR camera and an IR projector. Its layout is similar to the monocular structured-light system (Figure 1b), e.g., Kinect. However, it is significantly different from Kinect. In Kinect, the IR camera and IR projector are used for depth estimation. To obtain the depth map aligned with RGB image, a depth-to-color step is required to convert the depth map from the IR camera coordinate system to the RGB camera coordinate system. The proposed stereo system consists of two subsystems. First, the IR camera and the IR projector form an active monocular structured-light subsystem. Second, the IR camera and the RGB camera form a binocular stereo subsystem. The monocular structured-light subsystem is robust to weak texture objects, while the binocular subsystem has the ability to reconstruct distant objects and can work in outdoor environment. Thus the two subsystems have complementary advantages.
In the next subsections, we will show how the two subsystems are integrated.

Depth Estimation Pipeline
As mentioned before, the proposed depth camera consists of two subsystems. The input includes an RGB image, an IR image and a reference speckle image. The Figure 1. Layout of various depth cameras. (a) Binocular stereo camera (e.g., ZED [33]). (b) Monocular structured-light depth camera (e.g., Kinect [48]). (c) Active binocular depth camera (e.g., Intel D435 [14]). (d) Design of the proposed depth camera. Compared with (b), there should be enough baseline between the IR camera and RGB camera in the proposed depth camera since the two cameras are used for the binocular stereo subsystem. In addition, the IR camera and IR projector form a monocular structuredlight (MSL) subsystem. The depth map from the MSL subsystem can provide external guidance in stereo matching networks. reference image is pre-stored and fixed in the monocular structured-light subsystem, as shown in Figure 2. First, the current IR image of the targets and the reference speckle image are matched, and then a disparity map d m is obtained. With the calibration parameters of the monocular structured-light subsystem, a depth map Z m can be obtained and re-projected to the RGB camera coordinate system. We use Z m to denote the depth map aligned with the RGB image and d m to denote the corresponding disparity map. Then, the RGB image, IR image and disparity map d m are fed into the stereo matching network to estimate the final disparity map. The pipeline is illustrated in Figure 2.

Monocular Structured-Light
Different from the binocular stereo system, a camera is replaced by a projector in the monocular structured-light system, as shown in Figure 3. The depth estimation process is similar to Kinect [9,36]. The current speckle image of the targets is matched to the reference image, which is a speckle image captured when the camera's optical axis is perpendicular to a planar target at a known distance Z ref .
In order to eliminate the influence of different brightness of the two images to be matched, we follow the method in [36] to convert these images to binary images. Then, an efficient block matching algorithm is used to calculate the corresponding relationships between the two images to obtain the disparity map d m . The matching window size is set to 21×21. With the disparity map, we can obtain the depth map Z m via where B m is the baseline and f m is the focal length of the monocular structured-light system. With the calibration pa- rameters of the cameras, we can convert the depth map Z m onto the image plane of the RGB camera and obtain the depth map Z m aligned with the RGB image. Next, we can obtain the corresponding disparity map in the binocular stereo system via where B is the baseline and f is the focal length of the binocular system.

Stereo Matching Network and Fusion Strategy
Note that, the IR camera here does not have a narrowband filter as Kinect. So the IR camera can receive the active speckled light and ambient light. Thus the images of the two cameras are very different in appearance in indoor environments, as shown in Figure 2. It seems that it is difficult to match this kind of images. Fortunately, we find that accurate matching results can be obtained with the deep neural networks (DNN).
In order to verify the adaptability of the DNN to this kind of binocular images with asymmetric textures, we first modify the training dataset and testing dataset of Flyingth-ings3D. In the modified dataset, the left image remains unchanged, while tens of thousands of random speckle dots are added in the right image, as shown in Figure 4. So the stereo images in the modified dataset have asymmetric textures. The brightness of the speckles is decreased according to the distance from these points to the camera to mimicking energy attenuation of light energy. Then, we use both the original and modified training datasets to train two existing stereo matching networks, including PSMNet [3], and RAFT [35]. RAFT shows good generalization in optical flow estimation task, which requires to estimate displacement both in X and Y directions. Here, we make a small modification to estimate only the displacement in the X direction. Table 1 indicates that these networks have good adaptability to this kind of stereo images with asymmetric textures (more details are in subsection 4.3). Figure 4 shows the qualitative results.
Although there are usually many invalid values in the depth map from the active structured-light system ( Figure  2), the depth values are relatively reliable. So the valid depth values can be used as the guidance for the stereo matching network. The cost volume in stereo matching network consists of features with geometric and contextual information that allows the subsequent convolution to regress the disparity probability [3,16,19]. To integrate the advantage of the monocular structured-light system, we modify the cost volume according to the disparity map d m as done in guided stereo matching (GSM) [26], which peaks the correlation scores or the features activation related to the hypotheses suggested by the sparse hints and dampens the remaining ones.
Specifically, let g be a matrix of size w×h, conveying the externally provided disparity values, and v a binary mask, specifying which elements of g are valid (i.e., if v xy = 1). The cost volume is denoted as C ∈ R w×h×Dmax×F , where D max is the max disparity and F is the feature number. Given the pixel coordinate (x, y) and disparity value g(x, y) from external cue g, GSM applies Gaussian function on the features C(x, y, d) of the cost volume, and obtain a new cost volume C , (4) where σ determines the width of the Gaussian, while λ represents its maximum magnitude and should be greater than or equal to 1.
For RAFT, the correlation values in the cost volume are normalized to [0, 1] to avoid peak negative correlations via (5) where, F l and F r are features extracted from the left and right images, d denotes the disparity, and is a small constant.
In this work, the disparity map d m is taken as the external guidance for the stereo matching networks.

Prototype
To verify the effectiveness of the proposed system, we build a prototype system as shown in Figure 5. The system includes two synchronized CMOS cameras and an IR speckle projector. Both cameras have a focal length of 4.0 mm and a resolution of 1280×960. The maximum frame rate is 30 frames per second (fps). The baseline of the stereo subsystem is 94.14 mm and that of monocular structuredlight system is 63.0 mm. The diffractive optical element (DOE) based projector can project about 11,000 speckle dots onto the scenes. This kind of projector is very cheap (less than $3). We capture a speckle image of a white wall as the reference image at a distance of 80 cm when the optical axis of the camera is perpendicular to the white wall.
The RGB camera has an IR-cut filter, and the IR camera has no filter.

Dataset and Evaluation Metrics
Synthetic dataset. The synthetic SceneFlow [22] stereo dataset includes Flyingthings3D, Driving, and Monkaa. The dataset consists of 35,454 training images and 4,370 testing images of size 960 × 540 with accurate ground-truth disparity maps. We will use Flyingthings3D for study of the stereo matching networks. The End-Point-Error (EPE) will be used as the evaluation metric.
Real-scene dataset. To evaluate the performance of the proposed system, we collect a dataset (i.e., MonoBi-noStereo) in indoor environment, which covers different indoor scenes, including offices, living rooms, and bedrooms. The stereo pairs are easy to acquire. However, it is not a easy task to acquire the corresponding ground-truth disparity maps for the stereo pairs. Here, we choose to use the space-time stereo method [7,46] to obtain the ground truth disparities as done in [6]. 200 pairs of stereo images are captured for each scene. During the process of image capturing, thousands of moving speckles are projected. Therefore, the speckle distribution in each frame is different. The ground truth disparity maps are estimated by integrating all   Table 2. Quantitative evaluation on the real scene dataset. The suffix G denotes the guidance is used during training of the network models. Note that, when the projector is on, depth from MSL is used as the guidance in the models with suffix G. When the DOE projector is off (i.e., both the left and right images are passive), the guidance is not available and not used in network prediction.  Figure 6. For each scene, we collect two stereo pairs, where the left images are always passive, while one image of the right camera is passive (with projector off) and the other is active (with projector on). However, we lack a large training dataset in real indoor scenes. The synthetic IRS dataset [39] is considerably close to the real scenes. It contains more than 100,000 pairs of 960×540 resolution stereo images (84,946 for training and 15,079 for testing) in indoor scenes. We use the IRS dataset as the training dataset for evaluation on the MonoBinoStereo dataset. Details of the network training are presented in the supplementary material.

Quantitative Evaluation
We first evaluate the proposed method on the SceneFlow dataset. We trained PSMNet [3] and RAFT [35] with the original Flyingthings3D dataset and the modified Flyingth-ings3D dataset respectively. We use suffixes O, M and OM (e.g, PSMNet-O) to denote the models trained with the original Flyingthings3D dataset, the modified Flyingthings3D dataset and the mixture of the two datasets, respectively. The End-Point-Error (EPE) results are reported in Table 1. When the models are trained with the original dataset, the EPEs on the modified test dataset are large. For example, the EPE of the PSMNet-O on the modified test dataset is 3.922. When the modified training dataset is used, the EPE of the resulting model (PSMNet-M) is reduced to 0.955. However, the EPE for the original test dataset increases from 0.895 to 1.212. When both training datasets are used, the resulting model (PSMNet-OM) can balance the two test datasets. Furthermore, if the external guidance is available, we can use the strategy in GSM [26] to further improve the results. The resulting methods are denoted with a suffix G, e.g., PSMNet-OM-G. When 5% pixels of the ground truth depth map are used as the external guidance, the EPE is reduced from 0.984 to 0.686 on the modified test dataset. The results are similar for RAFT. The qualitative results are shown in Figure 4. Figure 6. Comparisons on the real dataset. The first row shows the left images (The RGB images are converted to grayscale images before network prediction). The second row shows the right images with speckles (the passive right images are not shown), the third row is the ground truth disparity maps generated with the space-time stereo method [7,46], the fourth row shows the depth images generated with the MSL subsystem, the fifth row shows the disparity maps of RAFT-O for the passive stereo images, and the last row shows the disparity maps of RAFT-OM-G, where the left image is passive and the right image is with speckles. In row 5 and row 6, Bad2.0 error is shown for each disparity map. The corresponding error maps are shown in the supplementary material.
To further verify the effectiveness of the proposed method, we evaluate the models on the collected real-scene dataset, MonoBinoStereo. The models are trained by mixing the Flyingthings3D and IRS datasets. The quantitative results are shown in Table 2. Take RAFT for example. The Bad 2.0 error of RAFT-O is up to 21.88% on the real test dataset with the DOE projector on, where only the original datasets (Flyingthings3D and IRS) are used for training. When the modified datasets are added, the Bad 2.0 error of the resulting model (RAFT-OM) is reduced to 14.60%. In our system, the depth map from the monocular structuredlight subsystem can be used as the external guidance for the stereo matching networks. We use 10% of the pixels in d m as the guidance 1 . When this guidance is utilized, the Bad 2.0 error is reduced to 3.59% (RAFT-OM-G). In Table 2, the quantitative results of the different models on the pure passive stereo dataset (see Subsection 4.2) are also shown. Note that the guidance information of the passive mode is Figure 7. Qualitative comparison. The first column shows the RGB images, the second column shows the disparity maps of RAFT-OM-G, the third column shows disparity maps of Kinect. The first row is the results in indoor scenes, and the second row shows the results in outdoor scenes. It is difficult for Kinect to output stable depth map out of doors. To keep anonymous, the faces are masked.  [14]. D435 uses two cameras to obtain depth map and a third camera for texture acquiring, where occlusion is inevitable. In contrast, Our system can output depth maps naturally aligned with RGB images with only two cameras. To keep anonymous, the face is masked. not available. We run the model RAFT-O on the passive test dataset. The Bad 2.0 error is 12.71%, which is 3.5 times of RAFT-OM-G. It indicates that the proposed method can improve stereo matching accuracy significantly. The Bad 2.0 error on the passive dataset of RAFT-OM-G is 10.51% (no guidance used), which indicates that RAFT-OM-G can be well generalized to passive scenes. The qualitative results are shown in Figure 6. Table 2 also shows that the overall performance of RAFT is better than PSMNet on MonoBi-noStereo.
In addition, we compare with a depth completion method, MSG [18], on the MonoBinoStereo dataset, where 1% of the pixels in d m are used as the guidance. The results are shown in Table 2. The Bad 2.0 error of MSG is 18.57%, which is much larger than RAFT-OM-G.

Qualitative Evaluation
We also test the proposed system in dynamic scenes with people and outdoor scenes, where it is difficult to obtain the ground truth disparity maps. For these scenes, we present the qualitative comparison results.
In Figure 7, we compare the proposed system with Kinect V1 in indoor and outdoor scenes. Kinect can output dense depth estimation in indoor scenes. However, in outdoor scenes, there are more holes in the depth maps because the IR speckles projected are interfered by the sun light. However, for the proposed system, it will degenerate into a passive binocular stereo system, where the stereo pairs can still be used to estimate the dense depth maps of the scenes. We also compare our system with Intel RealSense D435 [14], the results are shown in Figure 8.

Limitation
In the monocular structured light system, a reference image of a planar target with known depth Z ref is required. When capturing the reference image, we assume that the optical axis of the camera is perpendicular to the planar target, which is hard to guarantee in practice. Compared with the binocular stereo system, the monocular structured light system is more difficult to calibrate. The calibration error will lead to alignment error of the RGB image and the depth image Z m , which may cause wrong guidance in guided stereo matching network. In experiment, we find that increasing the number of guide points does not improve the accuracy (see supplementary material for details). Furthermore, if the same number of guidance points are sampled from the ground truth, the Bad0.5, Bad1.0 and Bad 2.0 errors are reduced to 12.94, 4.94, and 2.00 for RAFT-OM-G, respectively. So in the future, we will focus on the accurate calibration method of the monocular structured light system to further improve performance.

Conclusion
In this paper, we present a novel stereo system. This system includes a monocular structured-light subsystem and a binocular stereo subsystem. These two subsystems are combined to obtain robust depth estimation. Our system is unique in that it has only two cameras, an RGB camera and an IR camera. The RGB camera is used both for depth estimation and texture acquisition. The depth maps obtained are naturally aligned with RGB images pixel-by-pixel. We collect a real test dataset in indoor scenes. The quantitative results show that the Bad 2.0 error of the proposed system is 28.2% of the classical passive stereo system. Under strong outdoor light, the proposed system will degenerate to a passive stereo system. We hope the proposed system can provide a new solution for designing more robust depth cameras for the community.