A method and system for acquiring binocular disparity with asymptotic global matching

Through the asymptotic global matching method, interval sampling and interpolation processing are used to solve the problem of computational resource consumption and low accuracy in binocular visual matching, and achieve efficient disparity matching map acquisition.

CN112348859BInactive Publication Date: 2024-09-06ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011152473.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-26
Publication Date
2024-09-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing binocular visual matching algorithms consume huge computing resources and have high accuracy in global matching, but the frame rate is limited. Local matching is fast but has low accuracy, and it is easy to produce wrong matching areas.

Method used

The asymptotic global matching method is used to reduce the amount of calculation by performing interval sampling and interpolation processing on the image. Global matching is performed using the low-resolution initial disparity map as a reference to narrow the search range to obtain the optimized disparity map.

Benefits of technology

It effectively saves computing resources and memory resources, improves computing efficiency, obtains high-precision optimized disparity matching maps, and reduces the calculation amount of global matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112348859B
    Figure CN112348859B
Patent Text Reader

Abstract

The present invention discloses a binocular disparity acquisition method and system for asymptotic global matching, the method comprising: performing interval sampling on the rows and columns of a left image to obtain a first left image with a low resolution; performing interval sampling on the rows and columns of a right image to obtain a first right image with a low resolution; matching the first left image and the first right image based on a global matching method to obtain a first initial disparity map; performing interpolation processing on the first initial disparity map to obtain a first equal pixel initial disparity map having the same pixel array as the left image or the right image; taking the first equal pixel initial disparity map as a reference, performing global matching on the left image and the right image within a set relative disparity range to obtain an optimized disparity map. Taking the first equal pixel initial disparity map as a reference facilitates narrowing the search range of global matching, thereby improving computational efficiency, saving computational resources and memory resources, and obtaining a high-precision optimized disparity map.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer perspective technology, and in particular to a binocular disparity acquisition method and system for asymptotic global matching. Background Art

[0002] Binocular vision matching is a machine technology that recovers spatial depth information by performing calculations on a pair of images taken from different angles. This technology has received widespread attention in recent years and has become one of the foundations of many intelligent technologies such as autonomous driving, robot vision, virtual / augmented reality, and industrial automation measurement. Currently, the widely used algorithms include the interactive pixel difference (BT) cost algorithm and the quasi-global aggregate cost matching (SGM, Semiglobal Matching) algorithm. The BT cost algorithm is a commonly used local algorithm (S. Birchfield and C.Tomasi, “Depth Discontinuities by Pixel-toPixel Stereo,” Proc. Sixth IEEE Int'l Conf. Computer Vision, pp. 1073-1080, Jan. 1998.), and the SGM global algorithm performs multi-directional aggregation based on the BT cost (Heiko Hirschmüller, “StereoProcessing by Semiglobal Matching and Mutual Information”, IEEE TRANSACTIONSON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. 30, NO. 2, FEBRUARY 2008). In another paper (D. Scharstein and R. Szeliski, “A Taxonomy and Evaluation of Dense Two-Frame Stereo Correspondence Algorithms,” Int'l J. Computer Vision, vol. 47, nos. 1 / 2 / 3, pp. 7-42, Apr.-June 2002.), existing binocular vision matching algorithms were classified and compared.

[0003] Global aggregate cost matching has high accuracy, but consumes huge computing and memory resources, and the frame rate that can be achieved is very limited; while local matching is fast, but its accuracy is low, which will cause local matching errors, or fail to find the optimized matching disparity value locally, resulting in a large number of discretely distributed erroneous matching areas in areas where the matching features are not obvious. Summary of the invention

[0004] In view of the above technical problems existing in the prior art, the present invention provides a binocular disparity acquisition method and system with asymptotic global matching, which performs matching through the asymptotic global matching method to reduce the amount of global matching calculation, save computing resources, and obtain a high-precision optimized disparity matching map.

[0005] The present invention discloses a binocular disparity acquisition method of asymptotic global matching, the method comprising: performing interval sampling on rows and columns of a left image to obtain a first left image with a low resolution; performing interval sampling on rows and columns of a right image to obtain a first right image with a low resolution; matching the first left image and the first right image based on a global matching method to obtain a first initial disparity map; performing interpolation processing on the first initial disparity map to obtain a first equal-pixel initial disparity map having the same pixel array as the left image or the right image; taking the first equal-pixel initial disparity map as a reference, performing global matching on the left image and the right image to obtain an optimized disparity map.

[0006] Preferably, the method of the present invention further comprises an image smoothing method: smoothing the first initial disparity map and then performing interpolation processing.

[0007] Preferably, the method for performing interval sampling on the rows and columns of the left image or the right image includes: taking points on the rows and columns at intervals as re-sampled points; and taking the average value of the adjacent area of ​​the re-sampled point as the value of the re-sampled point.

[0008] Preferably, the method of globally matching the left image and the right image with the first equal-pixel initial disparity map as a reference includes: setting a search range for the right image with the first equal-pixel initial disparity map as a reference; within the search range, searching for the best match with the left image point in the right image through a global matching method to obtain a relative disparity; and obtaining an optimized disparity based on the relative disparity and the initial disparity of the first equal-pixel initial disparity map.

[0009] Preferably, the method for searching the right image for the best match with the left image point includes: calculating the left image and the right image respectively. Figure 3 The combined single-channel BT cost is obtained by accumulating the combined single-channel BT cost by channel; the combined single-channel BT cost is calculated in the X direction and the modulus is taken to obtain the single-channel BT cost gradient modulus; the left and right images are calculated respectively Figure 3The gradient of each row of the channel in the X direction is calculated and the modulus is taken to obtain a three-channel left gradient map and a three-channel right gradient map; according to the three-channel left gradient map and the three-channel right gradient map, the BT cost is calculated by channel respectively to obtain a three-channel combined BT; after the three-channel combined BT is accumulated by channel, a single-channel gradient BT cost is obtained; the single-channel BT cost gradient modulus and the single-channel gradient BT cost are weighted summed to obtain a composite BT cost; based on the composite BT cost, multi-directional SGM global cost aggregation is performed within the disparity search range of the right image; the minimum aggregation cost is matched within the disparity range of the right image, and the corresponding point is the optimal match to obtain the relative disparity.

[0010] Preferably, the method of multi-directional SGM global cost aggregation includes:

[0011] L(p,d e (p)+d)=C(p,d e (p)+d)+min(T(pr,d e (pr)+d), T(pr,d e (p)+d-1)+P1,T(pr,d e (p)+d+1) +P1, min i ((T(pr,i))+P2) (2)

[0013] Where L is the aggregation cost in the aggregation direction, C(p, d e (p)+d) is the cost of the current point p, p refers to the current point, d e (p) is the initial disparity at point p, d is the relative disparity, T(pr, d e (pr)+d) is the cost of the previous point in the convergence direction under its absolute disparity, pr refers to the previous point of point p in the convergence direction, T(pr, d e (p)+d-1) is the cost of the absolute disparity of the previous point at the current point in the aggregation direction -1, T(pr, d e (p)+d+1) is the cost of the absolute disparity of the previous point in the aggregation direction +1 at the current point, min i ((T(pr, i)) is the minimum directional disparity of the previous point within the relative search range, and P1 and P2 are dynamic programming parameters.

[0014] Preferably, the optimized disparity map includes absolute disparity, and the absolute disparity is obtained by summing the relative disparity and the initial disparity.

[0015] Preferably, the method of the present invention also includes a method for obtaining binocular disparity through a second initial disparity: performing interval sampling on the rows and columns of the left image to obtain a low-resolution second left image, and the resolution of the second left image is higher than that of the first left image; performing interval sampling on the rows and columns of the right image to obtain a low-resolution second right image, and the resolution of the second right image is higher than that of the first right image; the first initial disparity map is processed by interpolation to obtain a second equal-pixel initial disparity map having the same pixel array as the second left image or the second right image; using the second equal-pixel initial disparity map as a reference, matching the second left image and the second right image based on a global matching method to obtain a second initial disparity map; the second initial disparity map is processed by interpolation to obtain a third equal-pixel initial disparity map having the same pixel array as the left image or the right image; using the third equal-pixel initial disparity map as a reference, matching the left image and the right image based on a global matching method to obtain an optimized disparity map.

[0016] Preferably, the method of the present invention further comprises an image preprocessing method: aligning the left image and the right image in the Y direction; and cropping the left image and the right image according to matching requirements.

[0017] The present invention also includes a binocular acquisition system for implementing the above method, including a resampling module, a first matching module, an interpolation module and a second matching module, wherein the resampling module is used to perform interval sampling on the rows and columns of the left image to obtain a low-resolution first left image, and to perform interval sampling on the rows and columns of the right image to obtain a low-resolution first right image; the first matching module is used to match the first left image and the first right image based on a global matching method to obtain a first initial disparity map; the interpolation module is used to perform interpolation processing on the first initial disparity map to obtain a first equal-pixel initial disparity map having the same number of pixels as the left image or the right image; the second matching module is used to use the first equal-pixel initial disparity map as a reference, and perform global matching on the left image and the right image within a set relative disparity range to obtain an optimized disparity map.

[0018] Compared with the prior art, the present invention has the following beneficial effects:

[0019] When globally matching the left image and the right image, the first pixel initial disparity map is used as a reference, and global matching is performed within the set relative disparity range (±NTB / 2), so as to narrow the search range of global matching and reduce the amount of calculation; the resolution of the first left image and the first right image is low, and when performing global matching, the amount of calculation is much lower than that of the global matching of the left image and the right image. Therefore, although one step of calculation is added, the overall amount of calculation is reduced, thereby improving the calculation efficiency, saving computing resources and memory resources, and obtaining a high-precision optimized disparity map. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of the binocular disparity acquisition method of the present invention;

[0021] Figure 2 is a flow chart of a method for performing interval sampling on rows and columns of a left image or a right image;

[0022] Figure 3 is a flow chart of a method for globally matching a left image and a right image using a first equal pixel initial disparity map as a reference;

[0023] Figure 4 It is a flow chart of the method of searching the right image for the best match with the left image point;

[0024] Figure 5 It is a schematic diagram of the direction of multi-directional SGM global cost aggregation;

[0025] Figure 6 is a flow chart of a method for obtaining binocular disparity through a second initial disparity;

[0026] Figure 7 It is a flow chart of the method for preprocessing the left or right image;

[0027] Figure 8 It is a logic block diagram of the binocular parallax acquisition system of the present invention. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] In order to facilitate the description of the present invention, the names in the specification are explained: the X direction refers to the direction of the image row coordinates, and the Y direction refers to the direction of the image column coordinates; when the images are aligned in the Y direction, that is, the same point on the spatial object has the same Y direction of the pixel coordinates in the left and right images, and the X coordinates differ according to the depth. The difference value is called disparity. The depth of the target point in space has a corresponding relationship with the disparity, which can be calculated by triangulation principles, such as according to the binocular view imaging principle. After correction, a calculation formula is obtained. Therefore, the binocular disparity acquisition method of the present invention can also be applied to the acquisition of depth. In this specification, "full disparity range" is used to represent a pre-set possible disparity range that needs to be searched.

[0030] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0031] A binocular disparity acquisition method based on asymptotic global matching, such as Figure 1 As shown, the method includes:

[0032] Step 101: perform interval sampling on the rows and columns of the left image to obtain a low-resolution first left image. Resolution determines the fineness of image details and reflects the number of pixels per unit area. By using interval sampling, the number of pixels is reduced to obtain a low-resolution first left image.

[0033] Step 102: Perform interval sampling on the rows and columns of the right image to obtain a low-resolution first right image. The interval sampling method of the first right image and the first left image is the same, so that the first right image and the first left image have the same pixel array. For example, the pixel arrays of the left image and the right image are N x ×N y , the interval in the X direction is n x1 Pixels are sampled with an interval of n in the Y direction y1 Pixels are sampled, then the pixel arrays of the first left image and the first right image are N x / n x1 ×N y / n y1 , where n in the interval sampling method is x1 and n y1 Can be set as needed.

[0034] Step 103: Match the first left image and the first right image based on a global matching method to obtain a first initial disparity map. The pixel array of the first initial disparity map is: N x / n x1 ×N y / n y1 , the parallax step is n x1 Among them, the initial disparity map is a two-dimensional grayscale image. For a multi-channel color image, the grayscale of multiple channels can be accumulated and then global matching can be performed.

[0035] Step 105: interpolate the first initial disparity map to obtain a first equal-pixel initial disparity map having the same pixel array as the left image or the right image. The pixel array of the first initial disparity map is different from that of the left image or the right image, and needs to be restored to the same resolution as the original image through interpolation. The interpolation process can be regarded as the inverse process of interval sampling. The initial disparity of the interpolated pixel can be obtained according to the initial visual value of the pixels on its left and right sides.

[0036] Step 106: With the first equal pixel initial disparity map as a reference, globally match the left image and the right image within the set relative disparity range to obtain an optimized disparity map. The left image is used as the target base image and the right image is used as the matching image for explanation. With the first equal pixel initial disparity map as a reference, the points in the left image can find corresponding points in the right image through the initial disparity map. However, since the first equal pixel initial disparity map is calculated by matching the low-resolution image, it is only an estimate of the optimal disparity and has a certain error. At the same time, after interpolation processing, the disparity value after interpolation is also an approximate value. With the corresponding point as the center, globally match again within the set relative disparity range (±NTB / 2). Among them, the relative disparity range can be set according to the first initial disparity map and the first equal pixel initial disparity map.

[0037] When performing global matching on the left image and the right image, the first pixel initial disparity map is used as a reference to narrow the search range of the global matching and reduce the amount of calculation; the resolution of the first left image and the first right image is low, and when performing global matching, the amount of calculation is much lower than the global matching of the left image and the right image. Therefore, although one step of calculation is added, the overall amount of calculation is reduced, thereby improving the calculation efficiency, saving computing resources and memory resources, and obtaining a high-precision optimized disparity map.

[0038] The method of the present invention also includes a method for image smoothing:

[0039] Step 104: Smoothing the first initial disparity map. After the first initial disparity map obtained in step 103 is smoothed, the interpolation process of step 105 is performed. There will be some invalid interference disparities in the first initial disparity map generated initially, which will affect the subsequent disparity refinement process. After smoothing, most of the invalid disparities are filtered out. Smoothing can effectively suppress image noise.

[0040] The size of the smoothing window can be reasonably configured according to the actual situation, and the smoothing process is mainly carried out in two directions, X and Y. In each direction, due to the existence of the boundary, when the distance between the pixel position and the boundary is less than the set window size, the value on the path is accumulated and the average is taken; when the distance is greater than the window size, the sliding window method is used to move forward one pixel on the path and accumulate, and then the pixel value of the previous pixel point is subtracted to ensure that the overall window size remains unchanged and the average is taken.

[0041] Among them, Figure 2 As shown, in steps 101 and 102, the method for performing interval sampling on the rows and columns of the left image or the right image includes:

[0042] Step 201: alternately sampling points on rows and columns as re-sampling points.

[0043] Step 202: taking the average value of the area adjacent to the re-mined point as the value of the re-mined point.

[0044] By taking the average value, the image noise can be filtered out. However, it is not limited to this. For example, the re-sampled points and their values ​​can be directly obtained without taking the average value, which has high computational efficiency. The square root of the sum of the squares of the points in the adjacent area can also be used as the value of the re-sampled point.

[0045] Example 1

[0046] This embodiment provides a specific implementation method for optimizing parallax acquisition.

[0047] like Figure 3 As shown, in step 105, the method for globally matching the left image and the right image with the first equal pixel initial disparity map as a reference includes:

[0048] Step 301: Using the first equal pixel initial disparity map as a reference, set a search range for the right image, such as a disparity range of ±10.

[0049] Step 302: By global matching, the best match with the left image point is searched in the search range to obtain relative disparity. Specifically, the left image point is used as the target point, the search range of the right image is determined by the first equal pixel initial disparity map, and the best matching point is searched in the right image.

[0050] Step 303: Obtaining an optimized disparity according to the relative disparity and the initial disparity in the first equal pixel initial disparity map. The optimized disparities of multiple points constitute an optimized disparity map.

[0051] The optimized disparity is the sum of the initial disparity and the relative disparity.

[0052] In a specific embodiment, Figure 4 As shown in the figure, through SGM global cost aggregation, the method of searching for the best match with the point on the left image in the right image includes:

[0053] Step 401: Calculate the left image and the right image respectively Figure 3 The BT cost of each channel is calculated, and the combined single-channel BT cost is obtained by accumulation. The three-channel BT cost of the points in the left figure and the search range in the right figure can be calculated to reduce the amount of calculation.

[0054] Step 402: Calculate the gradient of the combined single-channel BT cost in the X direction and take the modulus to obtain the single-channel BT cost gradient modulus.

[0055] Step 403: Calculate the left image and the right image respectively Figure 3 The gradient of each row in the X direction of the channel is taken and the modulus is taken to obtain a three-channel left gradient map and a three-channel right gradient map. For example, the left gradient map of the R channel, the left gradient map of the B channel and the left gradient map of the G channel. Similarly, the three-channel right gradient map also has three images.

[0056] Step 404: Calculate the BT cost by channel according to the three-channel left gradient map and the three-channel right gradient map to obtain the three-channel combined BT, such as calculating the R channel combined BT cost according to the R channel right gradient map and the R channel left gradient map.

[0057] Step 405: After accumulating the three-channel combined BT by channel, a single-channel gradient BT cost is obtained, such as accumulating the combined BT of the three channels after taking the modulus.

[0058] Step 406: Weight the single-channel BT cost gradient modulus and the single-channel gradient BT cost to obtain a composite BT cost. The weighted sum effectively avoids the positive and negative values ​​generated by multiple channels from being offset in the accumulation, thereby retaining more gradient information; the composite BT cost obtained after weighting can obtain a better parallax effect than the single-channel BT cost commonly used in the prior art. The weighted sum refers to the sum of the weight coefficients of the two after setting them separately.

[0059] Step 407: Based on the composite BT cost, based on the points in the left image, multi-directional SGM global cost aggregation is performed within the disparity search range of the right image.

[0060] Step 408: Match the minimum aggregation cost within the disparity range of the right image, and the corresponding point is the optimal match, and obtain the relative disparity.

[0061] Among them, the method for obtaining the multi-directional SGM global cost aggregation cost includes:

[0062] L=C(p,d)+min(TO,T1,T2,T3)-δ (1)

[0063] Among them, C(p, d) is the current cost, L is the aggregation cost in the aggregation direction, T0 is the cost of pixel p when the disparity is d in the aggregation direction, T1 is the cost + P1 when the disparity is d-1 in the aggregation direction, T2 is the cost + P1 when the disparity is d+1 in the aggregation direction, T3 is the minimum cost + P2 when the disparity is not d-1 and d+1 in the aggregation direction, δ is the minimum cost sum of the previous pixel, P1 is to adapt to the inclined or curved surface, P2 is to retain discontinuity, in a specific embodiment, after achieving dimensional balance, P1 is 0.01, P2 is 8×P1 to obtain a good disparity map. The dynamic programming parameters P1 and P2 need to be multiplied by the window size on the basis of the set value. This is because the window smoothing calculation is performed in the block matching process but the accumulated number is not removed. The present invention uses normalization in each calculation step, maintains dimensional consistency, is comparable, and can directly perform equal weight calculation.

[0064] Preferably, the following SGM formula can be used to obtain the aggregation cost:

[0065] L(p,d e (p)+d)=C(p,d e (p)+d)+min(T(pr,d e (pr)+d), T(pr,d e (p)+d-1)+P1,T(pr,d e (p)+d+1) +P1, min i ((T(pr,i))+P2) (2)

[0067] Where L is the aggregation cost in the aggregation direction, C(p, d e (p)+d) is the cost of the current point p, p refers to the current point, d e (p) is the initial disparity at point p, d is the relative disparity, T(pr, d e (pr)+d) is the cost of the previous point in the convergence direction under its absolute disparity, pr refers to the previous point of point p in the convergence direction, T(pr, d e (p)+d-1) is the cost of the absolute disparity of the previous point at the current point in the aggregation direction -1, T(pr, d e (p)+d+1) is the cost of the absolute disparity of the previous point in the aggregation direction +1 at the current point, min i ((T(pr, i)) is the minimum cost of the previous point in the aggregation direction within the relative search range, and P1 and P2 are dynamic programming parameters.

[0068] like Figure 5 As shown, it can be 4-direction or 6-direction cost aggregation, preferably 8-direction, such as L0-L7. Multi-directional SGM global cost aggregation makes the cost aggregation process of the current pixel affected by all pixels in multiple directions (or paths). The more directions, the more neighborhood pixels participate in affecting the current pixel, ensuring the constraints of the global pixel but avoiding the problem of global pixel calculation.

[0069] Example 2

[0070] This embodiment provides a method for multi-stage asymptotic matching processing.

[0071] Take the second-level asymptotic matching process as an example, Figure 6 As shown, the method of obtaining binocular disparity through the second initial disparity is:

[0072] Step 601: perform interval sampling on the rows and columns of the left image to obtain a second left image with a low resolution, wherein the resolution of the second left image is higher than that of the first left image.

[0073] Step 602: perform interval sampling on the rows and columns of the right image to obtain a second right image with a low resolution, wherein the resolution of the second right image is higher than that of the first right image.

[0074] Step 603: The first initial disparity map is interpolated to obtain a second equal-pixel initial disparity map having the same pixel array as the second left image or the second right image. The second equal-pixel initial disparity map can have the same pixel array as the second left image or the second right image.

[0075] Step 604: using the second equal-pixel initial disparity map as a reference, matching the second left image and the second right image based on a global matching method to obtain a second initial disparity map.

[0076] Step 605: The second initial disparity map is interpolated to obtain a third equal-pixel initial disparity map having the same number of pixels as the left image or the right image.

[0077] Step 606: using the third equal-pixel initial disparity map as a reference, matching the left image with the right image based on a global matching method to obtain an optimized disparity map.

[0078] In a specific embodiment, the first step is to use 1 / 8 resolution and full range search to obtain a first initial disparity map; the second step is to use 1 / 4 resolution, take the first initial disparity as a reference, 1 / 4 as the search range, perform global matching on the 1 / 4 resolution map, and obtain a second initial disparity map; the third step is to use the second initial disparity map as a reference, perform global matching on the full resolution original image, and use 1 / 8 as the search range to obtain the most detailed full resolution disparity map.

[0079] But not limited to this, multiple levels of asymptotic matching may be set as needed, such as three levels or four levels.

[0080] Example 3

[0081] like Figure 7 As shown, this embodiment provides a method for preprocessing a left image or a right image:

[0082] Step 701: Align the left image and the right image in the Y direction.

[0083] Step 702: Crop the left image and the right image according to matching requirements.

[0084] When collecting binocular images, although the binocular camera is adjusted and centered, the images taken are aligned on the Y axis, and parallax is generated in the X direction. Usually, there is an operation error, which makes the left and right images misaligned on the Y axis. By cropping the information beyond the matching range, the basic conditions of stereo matching are met, while reducing the amount of calculation.

[0085] In a specific embodiment, when calculating the BT cost, the disparity range of the right image is calculated first, and then the left image. The disparity range of the right image in the X direction must be greater than the given disparity range before the left image can be calculated. This is to prepare for the subsequent misalignment cost calculation. Otherwise, when the left image is compared with the right image, the result of the right image may not be calculated. If there are multiple channels, the same calculation is performed on each channel and accumulated. This is convenient for submitting calculation efficiency and reducing waiting time.

[0086] In the cost aggregation algorithm, in order to improve the efficiency of the algorithm and the flexibility of calculation when setting different disparity ranges, the preferred embodiment uses dynamic shared memory as the storage location of temporary variables.

[0087] The normal disparity range is dsprange. To facilitate the calculation of boundary data, the size of the front and rear extension boundaries of the dynamic shared memory is 1, so the shared memory of each thread block is set to dsprange+2. The dynamic shared memory stores the cost value calculated under each disparity range of the current pixel and transfers it to the global memory. At the same time, it enters the next cycle as the previous pixel data of the next pixel. The use of dynamic shared memory facilitates the arbitrary configuration of the disparity range, but the global memory needs to be reallocated and initialized each time it is configured.

[0088] Example 4

[0089] The main parameters that affect the disparity search efficiency of global matching are the number of image points and the disparity search range. The time for global matching disparity search is:

[0090] t=cN x ×N y ×N d

[0091] Where t is the time required for global matching disparity search, c is defined as the time required for single-point disparity search, N x is the number of points in the X direction, N y is the number of image points in the Y direction, N d The parallax search range.

[0092] Take the case where the row and column resolutions are reduced by 4 times as an example:

[0093]

[0094] Wherein, t1 is the matching time of the first initial disparity;

[0095] Using the first-order pixel initial disparity as reference, the range of the fine global disparity search can be reduced by a factor of 4:

[0096]

[0097] The total disparity search time for global matching is:

[0098]

[0099] That is, the method for acquiring binocular disparity by asymptotic global matching provided by the present invention consumes much less time than the time of global matching disparity in the prior art, and the calculation efficiency is significantly improved, which is conducive to saving calculation resources.

[0100] The present invention also provides a binocular disparity acquisition system for implementing the above method, such as Figure 8 As shown, it includes a resampling module 1, a first matching module 2, an interpolation module 3 and a second matching module 4.

[0101] The resampling module 1 is used to perform interval sampling on the rows and columns of the left image to obtain a first left image with a low resolution, and to perform interval sampling on the rows and columns of the right image to obtain a first right image with a low resolution. The interval sampling method of the first right image is the same as that of the first left image.

[0102] The first matching module 2 is used to match the first left image and the first right image based on a global matching method to obtain a first initial disparity map;

[0103] The interpolation module 3 is used to perform interpolation processing on the first initial disparity map to obtain a first equal-pixel initial disparity map having the same number of pixels as the left image or the right image;

[0104] The second matching module 4 is used to perform global matching on the left image and the right image within a set relative disparity range, taking the first equal-pixel initial disparity map as a reference, to obtain an optimized disparity map.

[0105] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A binocular disparity acquisition method based on asymptotic global matching, characterized in that: The method comprises: Performing interval sampling on the rows and columns of the left image to obtain a first left image with a low resolution; Performing interval sampling on the rows and columns of the right image to obtain a first right image with a low resolution; Matching the first left image and the first right image based on a global matching method to obtain a first initial disparity map; Performing interval sampling on the rows and columns of the left image to obtain a second left image with a low resolution, wherein the resolution of the second left image is higher than that of the first left image; Performing interval sampling on the rows and columns of the right image to obtain a second right image with a low resolution, wherein the resolution of the second right image is higher than that of the first right image; The first initial disparity map is interpolated to obtain a second equal-pixel initial disparity map having the same pixel array as the second left image or the second right image; Using the second equal-pixel initial disparity map as a reference, matching the second left image with the second right image based on a global matching method to obtain a second initial disparity map; The second initial disparity map is interpolated to obtain a third equal-pixel initial disparity map having the same pixel array as the left image or the right image; Taking the third equal pixel initial disparity map as a reference, the left image and the right image are matched based on the global matching method to obtain the optimized disparity map.

2. The binocular disparity acquisition method according to claim 1, characterized in that: Also includes methods for image smoothing: The first initial disparity map is smoothed and then interpolated.

3. The binocular disparity acquisition method according to claim 1, characterized in that: Methods for sampling the rows and columns of the left or right image at intervals include: Take the points on the rows and columns alternately as re-sampling points; The average value of the area adjacent to the re-mining point is taken as the value of the re-mining point.

4. The binocular disparity acquisition method according to claim 1, characterized in that: The method for globally matching the left image and the right image with the third equal pixel initial disparity map as a reference includes: Using the third equal pixel initial disparity map as a reference, set the search range for the right image; In the search range, the best match with the point in the left image is searched in the right image by a global matching method to obtain a relative disparity; An optimized disparity map is obtained according to the relative disparity and the initial disparity of the third equal-pixel initial disparity map.

5. The binocular disparity acquisition method according to claim 4, characterized in that: Methods for searching the right image for the best match with the left image point include: Calculate the three-channel BT costs of the left and right images respectively, and add them up by channel to obtain the combined single-channel BT cost; The combined single-channel BT cost is calculated in the X direction and then its modulus is taken to obtain the single-channel BT cost gradient modulus; Calculate the gradient of each row of the three channels in the left image and the right image in the X direction and take the modulus to obtain a three-channel left gradient image and a three-channel right gradient image; According to the three-channel left gradient map and the three-channel right gradient map, the BT cost is calculated by channel to obtain the three-channel combined BT; After accumulating the three-channel combined BT by channel, the single-channel gradient BT cost is obtained; The composite BT cost is obtained by weighting the single-channel BT cost gradient modulus and the single-channel gradient BT cost; Based on the composite BT cost, multi-directional SGM global cost aggregation is performed within the disparity search range in the right figure; The minimum aggregation cost is matched within the disparity range of the right image, and the corresponding point is the optimal match, obtaining the relative disparity.

6. The binocular disparity acquisition method according to claim 5, characterized in that: The methods of multi-directional SGM global cost aggregation include: (2) in, L is the aggregation cost in the aggregation direction, For the current point p The price, p Point to the current point. yes p The initial disparity of the point, d refers to relative parallax, is the cost of the previous point in the convergence direction under its absolute disparity, p-r In the direction of aggregation p A point before the point, is the cost of the absolute disparity of the previous point at the current point in the aggregation direction -1, The cost of the absolute disparity of the previous point at the current point in the aggregation direction + 1, is the minimum directional disparity of the previous point within the relative search range, and P1 and P2 are dynamic programming parameters.

7. The binocular disparity acquisition method according to claim 4, characterized in that: The optimized disparity map includes absolute disparity, and the absolute disparity is obtained by summing the relative disparity and the initial disparity.

8. The binocular disparity acquisition method according to claim 1, characterized in that: Also includes image preprocessing methods: Align the left and right images in the Y direction; The left and right images are cropped according to matching needs.

9. A binocular disparity acquisition system for implementing the method according to any one of claims 1 to 8, characterized in that: It includes a resampling module, a first matching module and a second matching module, The resampling module is used to perform interval sampling on the rows and columns of the left image to obtain a first left image with a low resolution, and perform interval sampling on the rows and columns of the right image to obtain a first right image with a low resolution; The first matching module is used to match the first left image and the first right image based on a global matching method to obtain a first initial disparity map; The second matching module is used for: Performing interval sampling on the rows and columns of the left image to obtain a second left image with a low resolution, wherein the resolution of the second left image is higher than that of the first left image; Performing interval sampling on the rows and columns of the right image to obtain a second right image with a low resolution, wherein the resolution of the second right image is higher than that of the first right image; The first initial disparity map is interpolated to obtain a second equal-pixel initial disparity map having the same pixel array as the second left image or the second right image; Using the second equal-pixel initial disparity map as a reference, matching the second left image with the second right image based on a global matching method to obtain a second initial disparity map; The second initial disparity map is interpolated to obtain a third equal-pixel initial disparity map having the same pixel array as the left image or the right image; Taking the third equal pixel initial disparity map as a reference, the left image and the right image are matched based on the global matching method to obtain the optimized disparity map.