Patent Publication Number: US-10764559-B2

Title: Depth information acquisition method and device

Description:
CROSS REFERENCE TO RELATED APPLICATION 
     This application is based upon and claims priority to Chinese Patent Application No. 2018112475372, filed on Oct. 23, 2018, the entire content of which is incorporated herein by reference. 
     TECHNICAL FIELD 
     The present disclosure relates to the technical fields of depth sensors, machine vision, image processing, binocular stereo vision and time of flight (TOF), and particularly relates to a depth information acquisition method and device. 
     BACKGROUND 
     In recent years, three-dimensional depth sensing devices have begun to catch people&#39;s eyes. High-precision three-dimensional depth sensing devices as a new medium for acquiring external information are conducive to the development of machine vision, enabling robots to understand the outside world, and also promoting the development of man-machine interaction. Depth sensing technology can be roughly divided into a passive type and an active type. The traditional binocular stereo vision ranging is a passive ranging method, which is greatly affected by ambient light and is complicated in the stereo matching process. Active ranging methods mainly include structured light coding and ToF (time of flight). A ToF camera acquires the depth information of the corresponding pixel by calculating the time of flight of the emitted laser. The acquired depth image has a lower resolution but a higher remote depth precision. When combined with binocular stereo vision, the ToF camera can obtain complementary advantages, so that the resolution of the depth image can be increased, the complexity of binocular stereo matching and depth calculation is reduced, and image information and depth information of each pixel can be acquired simultaneously. 
     Therefore, a heretofore unaddressed need exists in the art to address the aforementioned deficiencies and inadequacies. 
     SUMMARY 
     In view of this, the present disclosure provides a depth information acquisition method, including the following steps: 
     S 100 : determining a relative geometric position relationship between a pixel of a depth map generated by a ToF camera and pixels of images of left and right cameras in a binocular camera, and internal parameters of the ToF camera and the left and right cameras; 
     S 200 : collecting the depth map generated by the ToF camera and the images of the two cameras; 
     S 300 : converting the depth map into a binocular disparity value between corresponding pixels in the images of the two cameras; 
     S 400 : mapping, by using the converted binocular disparity value, any pixel in the depth map generated by the ToF camera to corresponding pixel coordinates of the images of the two cameras to obtain a sparse disparity map; and 
     S 500 : step S 400  on all pixels in the depth map generated by the ToF camera to obtain a dense disparity map, thereby obtaining more accurate and denser depth information; or inversely calibrating the depth map generated by the ToF camera collected in step S 200  with the sparse disparity map, thereby outputting more accurate depth information. 
     The present disclosure further provides a depth information acquisition device, including: a ToF camera, left and right cameras in a binocular camera, and a processing unit, wherein the ToF camera obtains a depth map; and the two cameras obtain two images with disparity, and the processing unit is used to execute the depth information acquisition method according to claim  1 . 
     Through the above technical solution, the sparse depth map of the ToF camera is converted and registered, and then mapped onto the images of the high-resolution left and right cameras to obtain a more accurate and denser depth map, and meanwhile, the images of the left and right cameras can also be utilized to calibrate the original depth map of the ToF camera. The method combines the advantages of ToF camera and binocular stereo ranging, and greatly improves the precision and resolution of depth ranging by multi-sensor fusion algorithm processing. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The accompanying drawings illustrate one or more embodiments of the present invention and, together with the written description, serve to explain the principles of the invention. Wherever possible, the same reference numbers are used throughout the drawings to refer to the same or like elements of an embodiment. 
         FIG. 1  is a schematic flowchart of a depth information acquisition method provided in one embodiment of the present disclosure; 
         FIG. 2  is a structure diagram of a depth information acquisition device provided in one embodiment of the present disclosure; 
         FIG. 3  is a schematic diagram of calibration of binocular and ToF cameras in one embodiment of the present disclosure; 
         FIG. 4  is a schematic diagram showing the position relationship between left and right cameras and a ToF camera in one embodiment of the present disclosure; and 
         FIG. 5  is a schematic diagram of image block extraction in one embodiment of the present disclosure. 
     
    
    
     DETAILED DESCRIPTION 
     The present invention will be further described in detail below with reference to  FIG. 1  through  FIG. 5 . 
     In one embodiment, referring to  FIG. 1 , a depth information acquisition method is disclosed, including the following steps: 
     S 100 : determining a relative geometric position relationship between a pixel of a depth map generated by a ToF camera and pixels of images of left and right cameras in a binocular camera, and internal parameters of the ToF camera and the left and right cameras; 
     S 200 : collecting the depth map generated by the ToF camera and the images of the two cameras; 
     S 300 : converting the depth map into a binocular disparity value between corresponding pixels in the images of the two cameras; 
     S 400 : mapping, by using the converted binocular disparity value, any pixel in the depth map generated by the ToF camera to corresponding pixel coordinates of the images of the two cameras to obtain a sparse disparity map; and 
     S 500 : performing step S 400  on all pixels in the depth map generated by the ToF camera to obtain a dense disparity map, thereby obtaining more accurate and denser depth information; or inversely calibrating the depth map generated by the ToF camera collected in step S 200  with the sparse disparity map, thereby outputting more accurate depth information. 
     In another embodiment, referring to  FIG. 2 , the present disclosure further provides a depth information acquisition device, including: a ToF camera, left and right cameras in a binocular camera, and a processing unit, wherein the ToF camera obtains a depth map; and the two cameras obtain two images with disparity, and the processing unit is used to execute the depth information acquisition method according to claim  1 ; 
     wherein the ToF camera includes a transmitter, a receiving camera and a synchronization processing circuit. The distance is calculated by the time difference between transmission and reception, the sparse depth information can be obtained according to a certain frame rate and FoV, and the depth precision decreases as the distance increases; and 
     wherein the two cameras are arranged horizontally or vertically to form binocular disparity. The two cameras may be the same model of color cameras, or a color camera and a black and white camera, or a high-resolution variable-focus color camera and a low-resolution color camera, or an OIS optical anti-shake color camera and a fixed-focus color camera. 
     In another embodiment, step S 100  further includes the following sub-steps: 
     S 1001 : capturing checkerboard images from multiple angles by using the two cameras and the ToF camera; and S 1002 : solving internal parameters, external parameters and distortion coefficients of the two cameras, internal parameters, external parameters and distortion coefficients of the ToF camera, and the relative geometric position relationship between the two cameras and the ToF camera. 
     Preferably, the binocular camera comprises two independent cameras with the same performance index (same optical lens and image sensor) arranged symmetrically in left and right and equidistantly on both sides of the ToF camera, and the optical axis thereof is parallel to and on the same baseline as the optical axis of the ToF camera, as shown in  FIG. 4 . Assume that the binocular camera has a focal length ƒ, a dot pitch parameter of u and a baseline distance between the left and right cameras of s, and the ToF camera has an infrared camera focal length of ƒ t  and a dot pitch parameter of u t . 
     In practical applications, the baseline between the two cameras may be adjusted according to different needs, or two cameras with different focal lengths or models may be used to fulfill different functions; and the two cameras can be placed horizontally or vertically. The baseline distance s 1  between the ToF camera and the left camera can also be adjusted according to needs. 
     In practical applications, the positions of the ToF camera and the left and right cameras may not be on the same horizontal line or vertical line, and the relative position between the ToF camera and the left and right cameras may be set according to the structure requirements of a smart device. 
     In another embodiment, the ToF camera calculates the depth by measuring the phase difference between emitted light and reflected light, and step S 300  further includes the following sub-steps: 
     S 3001 : representing the depth map generated by the ToF camera by a grayscale image, the depth value being linear with the distance: d t =αG t +β, wherein d t  is the depth value measured by the ToF camera, G t  is the grayscale value, and α and β are coefficients; 
     S 3002 : obtaining, by binocular vision, spatial distance information by calculating the disparity value between the left and right images, the depth calculation formula of the binocular vision being 
               d   =     fs     μΔ   ⁢           ⁢   x         ,         
wherein μ is the physical dot pitch of the camera image sensor, ƒ is the focal length of the camera, and s is the baseline distance between the left and right cameras; and
 
     S 3003 : obtaining, according to d=d t , the conversion formula 
               Δ   ⁢           ⁢   x     =     fs     μ   ⁡     (       α   ⁢           ⁢     G   t       +   β     )               
from the grayscale value in the depth map to the binocular disparity Δx.
 
     In another embodiment, step S 400  further includes the following sub-step: 
     combining internal parameters of the camera obtained by calibrating with the relative geometric position relationship between the ToF camera and the left camera, converting coordinates (u 0 ,v 0 ) of any pixel in the depth map generated by the ToF camera to the position coordinates (u l ,v l ) of the corresponding pixel in the image of the left camera, and then the corresponding pixel (u r ,v r ) in the image of the right camera being u r =u l +Δx 0 ,v r =v l , wherein Δx 0  is the disparity value between the corresponding pixels in the left and right images. 
     In another embodiment, step S 500  further includes the following sub-steps: repeating step S 400 , searching the optimal matching block in the image of the right camera according to matching blocks by taking pixels around the pixel (u l ,v l ) in the image of the left camera as the center, and combining the binocular depth calculation formula 
             d   =     fs     μΔ   ⁢           ⁢   x             
to obtain the depth value, thereby obtaining a dense depth map corresponding to the image of the left camera; and similarly, expanding with the pixel (u r ,v r ) in the image of the right camera to obtain a dense depth map corresponding to the image of the right camera, wherein μ is the physical dot pitch of the camera image sensor, ƒ is the focal length of the camera, and s is the baseline distance between the left and right cameras.
 
     After mapping in step S 400 , the ToF converted disparity data will be sparsely and evenly distributed on the image collected by the left camera. However, due to the intrinsic measurement error of the ToF camera, there is an error between the converted disparity data and the disparity of the binocular measurement, so the converted disparity value needs to be corrected. In addition, due to the occlusion problem in the vision, the converted disparity value on the occlusion boundary in the left and right images may have many erroneous mapping relationships, and these erroneous disparity mapping points need to be eliminated one by one. 
     In another embodiment, a step of correcting the abovementioned mapped sparse disparity map is included between steps S 400  and S 500 , 
     wherein, the step of correcting the abovementioned mapped sparse disparity map includes the following sub-steps: taking the coordinate origin of the left camera as the viewpoint and the image collected by the right camera as a reference, an m×n image block B l  is extracted in the image of the left camera with the pixel (u l ,v l ) as the center, a neighborhood of a certain size is selected in the image of the right camera with (u r ,v r ) as the center, and then an m×n image block B n  is extracted with each pixel in the neighborhood as the center; as shown in  FIG. 5 , O is the pixel (u r ,v r ), each small square in the figure represents a pixel, that is, a part of the image pixels taking O as the center are shown in the figure, the eight neighborhoods taking O as the center are A 1  to A 8 , the dashed box is a 3×3 image block extracted by taking the pixel O as the center, the dotted line box is a 3×3 image block extracted by taking the pixel A l  as the center, and in a similar fashion, nine image blocks may be extracted in the eight neighborhoods of the pixel O; and then, these image blocks B ri , extracted from the image of the right camera are sequentially subjected to block matching calculation with the image block B l  extracted from the image of the left camera, the similarity measure between the blocks is performed, then the image block with the highest similarity in the neighborhood is selected, if its corresponding similarity is greater than the threshold, the image block is regarded as the optimal matching block and the disparity point is corrected according to the corresponding position of the optimal matching block, or otherwise, the disparity point is eliminated as error mapping. 
     The resolution of the images of the left and right cameras of binocular vision is generally higher than that of the depth map of ToF, so after the data registration of the ToF depth map and the image of the binocular vision camera, only a sparse disparity map can be obtained, and it is required to perform calculation on the disparity of other pixels to obtain the dense disparity map. 
     The specific calculation method is as follows: 
     Method 1: The corrected disparity point obtained in the step of correcting the mapped sparse disparity map can be used as a seed pixel, and the disparity values of other pixels are continuously grown in the surrounding neighborhoods with the seed as the center. The growth method is as follows: taking a certain pixel in the neighborhood of the seed pixel as the center and the disparity of the seed pixel as a reference, the step of correcting the mapped sparse disparity map is repeated, an image block is extracted in the left image by taking a certain pixel in the neighborhood as the center, a search window is extracted by taking the corresponding pixel of the seed pixel in the right image as the center, and the disparity of a certain pixel in the neighborhood of the seed pixel is calculated by block matching. The pixel subjected to disparity calculation becomes a seed pixel, and step S 500  is repeated. 
     Method 2: Starting from the upper left corner of the sparse disparity map, the pixels are calculated one by one line by line from left to right and from top to bottom; if the pixel is a reference disparity point, skipping is performed; if the pixel is not the reference disparity point, the reference disparity point closest to the pixel is selected as a reference, and the disparity point of the pixel is calculated; similarly, in the image of the left camera, an image block is extracted by taking the pixel as the center, a search window is extracted by taking the corresponding point of the reference disparity point in the image of the right camera as the center, and the disparity of the pixel is calculated by block matching; and after the one-by-one pixel calculation is completed, the disparity value of the whole image can be obtained, thereby making its resolution reach the resolution of the left and right images. 
     Compared with method 1, there is no complicated iterative algorithm in this method. The data starts from the upper left corner of the image and is processed pixel by pixel until the lower right corner of the image. This method is a good assembly line implementation method. 
     In another embodiment, a step of correcting the abovementioned mapped sparse disparity map is included between steps S 400  and S 500 . After the inverse correction of the corrected disparity point obtained in the step, the original depth map of the ToF can be subjected to calibration and precision improvement, wherein, the inverse conversion is the inverse process of the conversion formula in step S 300 , 
                 G   t   ′     =       α     -   1       ⁡     (       fs     μΔ   ⁢           ⁢     x   ′         -   β     )         ,         
wherein Δx′ is the calibrated disparity value, and G′ t  is the exact grayscale value obtained after the inverse conversion of the calibrated disparity. After the grayscale value is subjected to inverse mapping, the original ToF depth map is calibrated, wherein the inverse mapping is to re-map the original ToF depth map mapped to the left and right images to the ToF depth map.
 
     In terms of the abovementioned embodiment, the method can output depth maps of two modes, one mode is a more accurate and denser depth map obtained by mapping the converted and registered sparse depth map of the ToF camera to the high-resolution images of the left and right cameras, and the other mode is a more accurate ToF depth map. The depth maps of different modes can be selectively output according to different application scenarios. 
     The method can be similarly applied to a multi-sensor fusion device of similar active and passive vision modes, and the application thereof is not limited to smart phones, robots, smart home appliances, unmanned vehicles and the like. The binocular camera of the method is not limited to the same specification, and also supports different specifications of cameras. Meanwhile, the structure placement of the ToF camera and the binocular camera is flexible, and is not limited to horizontal or vertical placement. The method of expanding a sparse depth map into a dense depth map is not limited to the neighborhood expansion method and the pixel-by-pixel scanning method shown in the examples, and other super-resolution processing methods such as interpolation, filtering, and similarity may also be adopted. 
     Although the embodiments of the present invention have been described above with reference to the drawings, the present invention is not limited to the specific embodiments and the application fields described above, and the specific embodiments described above are merely illustrative and instructive, and not restrictive. A person skilled in the art can make various forms under the teachings of the present invention and without departing from the scope of the invention as claimed, and these are all protected by the present invention.