Stereo matching method and system integrating AD cost and multi-modal local feature cost
By fusing AD cost and multi-mode local feature cost, combined with spatial distance and color distance, the disparity map is optimized, which solves the problem of poor matching effect of stereo matching method in weak texture areas and edges, and improves matching accuracy and lighting robustness. .
Patent Information
- Application Number
- CN202210577207.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-25
AI Technical Summary
Existing stereo matching methods have poor matching results in weak texture areas and edges, mainly because they ignore the structural information between the pixel to be matched and its neighbor pixels.
The method of fusing AD cost and multi-modal local feature cost is adopted. By calculating the AD cost and multi-modal local feature cost of pixels, and weighting the fusion, cost aggregation is performed by combining spatial distance and color distance to represent the gray level similarity between pixels. and structural similarity to optimize the disparity map.
It improves the matching accuracy of the stereo matching method in weak texture areas and edges, improves the matching effect under the influence of lighting, and reduces the depth discontinuous area calculation error during the cost aggregation process.
Smart Images

Figure CN114862926B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image matching, and more specifically, relates to a stereo matching method and system integrating AD cost and multi-modal local feature cost. Background Art
[0002] In many fields such as virtual reality, unmanned driving, and 3D reconstruction, binocular stereo matching is a key step in restoring images from 2D space to 3D space.
[0003] Existing technical paths are mainly divided into stereo matching methods based on deep learning and stereo matching methods based on traditional image processing. Stereo matching methods based on deep learning mostly rely on data sets and cannot achieve good matching results in some scenarios; stereo matching methods based on traditional image processing characterize the similarity between pixels to be matched by constructing matching costs and use the size of similarity for stereo matching.
[0004] However, existing matching costs are mostly characterized by the difference in pixel grayscale values, ignoring the characterization of the structural information between the pixel to be matched and its neighboring pixels, resulting in poor matching results in weak texture areas and edges of the image. Summary of the invention
[0005] In view of the defects and improvement needs of the prior art, the present invention provides a stereo matching method and system that integrates AD cost and multi-modal local feature cost, which aims to improve the matching accuracy of the stereo matching method in weak texture areas and edges.
[0006] To achieve the above object, according to one aspect of the present invention, a stereo matching method integrating AD cost and multi-modal local feature cost is provided, comprising:
[0007] Data acquisition step: acquiring an image pair, wherein the image pair includes a left image L and a right image R;
[0008] Stereo matching steps: take the left image L as the target image and the right image R as the reference image, and obtain the disparity map through stereo matching; take the right image R as the target image and the left image L as the reference image, and obtain the disparity map through stereo matching;
[0009] Disparity optimization step: perform consistency comparison on the disparity maps obtained from the two matches, optimize the inconsistent pixels and the pixels in the occluded area, and obtain the final disparity map;
[0010] Wherein, the stereo matching process includes:
[0011] Cost calculation step: taking any pixel point (x, y) in the target image as the pixel point to be matched, and calculating the AD cost and multi-modal local feature cost of the pixel point (x, y) in the reference image within the disparity search range; weighted fusion of the AD cost and the multi-modal local feature cost to obtain the initial matching cost of the pixel point (x, y) corresponding to the pixel point within the disparity range of the reference image; wherein the multi-modal local feature cost is used to characterize the relative size relationship between the pixel to be matched and its neighboring pixels;
[0012] Cost aggregation step: in the target image, an aggregation window is set, and within the aggregation window, the initial matching costs are aggregated by weighting the spatial distance and the color distance to obtain the aggregation cost of the pixel point (x, y);
[0013] Disparity calculation step: taking the disparity corresponding to the minimum value of the aggregation cost of the pixel point (x, y) as the disparity of the pixel point, and obtaining the disparity map of the target image.
[0014] Furthermore, the multi-mode local feature cost is obtained through the following sub-steps:
[0015] Graying the left image and the right image respectively, and performing multi-mode local feature coding on the grayed images, wherein the multi-mode local feature coding includes central gradient feature coding, angle feature coding and radial gradient feature coding;
[0016] The Hamming distance of the binary string corresponding to the multimodal local feature encoding is calculated to obtain the corresponding multimodal local feature cost, wherein the multimodal local feature cost includes a center gradient cost, an angle cost, and a radial gradient cost, which are respectively used to characterize the gradient change, angle change, and radial gradient change between the pixel to be matched and its neighboring pixels.
[0017] Furthermore, the central gradient cost C center (x,y,d), angle cost C angle (x,y,d) and radial gradient cost C radial (x,y,d) is:
[0018]
[0019]
[0020]
[0021] Among them, T 1 center (x,y), T 1 angle (x,y), T 1 radial (x,y), They respectively represent the central gradient feature coding, angle feature coding, and radial gradient feature coding of the pixel point (x, y) in the target image and the pixel point (x+d, y) in the reference image in their corresponding matching windows. d represents any disparity value within the disparity range. Hamming() represents the Hamming distance calculation operator.
[0022] Furthermore, the initial matching cost C(x, y, d) is:
[0023] C(x,y,d)=ρ(C AD (x,y,d),λ AD )+ρ(C Center (x,y,d),λ Center ) +ρ(C Angle (x,y,d),λ Angle )+ρ(C Radial (x,y,d),λ Radial )
[0024] In the formula, C AD (x,y,d) represents the AD cost, λ AD , Center , Angle and λ Radial Respectively represent the normalized weighted coefficients of AD cost, center gradient cost, angle cost and radial gradient cost, ρ is the normalization function; Among them, AD cost C AD (x,y,d) is represented as:
[0025]
[0026] In the formula, Represents the pixel value of the target image at (x, y), Represents the pixel value of the reference image at (x+d,y), and i=R,G,B represents the three channels of R, G, and B.
[0027] Furthermore, the cost aggregation step includes the following sub-steps:
[0028] In the aggregation cost window, the aggregation weight w of the initial matching cost is calculated by weighting the spatial distance and the color distance. p ;
[0029] With the aggregation weight w p The initial matching costs within the aggregation window are weighted averaged to obtain the aggregation cost of the pixel (x, y).
[0030] Furthermore, the aggregation weight w pThe relationship between the spatial distance and color distance between pixels in the aggregation area is:
[0031]
[0032] Where (x, y) is the coordinate of the pixel point p to be matched in the aggregation area, (x other ,y other ) is any other pixel point p in the aggregation area other The coordinates of , α and β are parameters that characterize the importance of spatial distance and color distance, respectively. other ) represents pixel point p and pixel point p other The color distance between two pixels indicates the maximum grayscale distance between the three channels of R, G, and B.
[0033] Furthermore, the parallax optimization step includes the following sub-steps:
[0034] Each disparity value in the disparity map is interpolated using the aggregate cost of each pixel in the target image to obtain the sub-pixel disparity value d with the left image as the target image. l and the sub-pixel disparity value d with the right image as the target image r ;
[0035] Within a given error range, for the same pixel, compare the corresponding sub-pixel disparity value d l and the sub-pixel disparity value d r Are they equal? If they are equal, the disparity corresponding to the pixel point on the disparity map is accurate. If they are not equal, the pixel point is recorded as a mismatched point and the mismatched point is removed from the corresponding disparity map.
[0036] The mismatched points are filled with the median of the neighborhood disparity values, and the pixel points in the occluded area are filled with the minimum of the neighborhood disparity values to obtain a final disparity map.
[0037] According to another aspect of the present invention, a stereo matching system integrating AD cost and multi-modal local feature cost is provided, comprising:
[0038] A data acquisition module, used to acquire a matching image pair, wherein the matching image pair includes a left image L and a right image R;
[0039] A stereo matching module is used to use the left image L as the target image and the right image R as the reference image to obtain a disparity map through a stereo matching submodule; use the right image R as the target image and the left image L as the reference image to obtain a disparity map through a stereo matching submodule;
[0040] The disparity optimization module is used to compare the disparity maps obtained from the two matches, optimize the inconsistent pixels and the pixels in the occluded area, and obtain the final disparity map;
[0041] Wherein, the stereo matching submodule includes:
[0042] A cost calculation unit is used to take any pixel point (x, y) in the target image as a pixel to be matched, and calculate the AD cost and multi-modal local feature cost of the pixel point (x, y) in the reference image within the disparity search range; weightedly fuse the AD cost and the multi-modal local feature cost to obtain the initial matching cost of the pixel point (x, y) corresponding to the pixel point within the disparity range of the reference image; wherein the multi-modal local feature cost is used to characterize the relative size relationship between the pixel to be matched and its neighboring pixels;
[0043] A cost aggregation unit, used for setting an aggregation window in the target image, and aggregating the initial matching costs within the aggregation window by weighting the spatial distance and the color distance to obtain an aggregation cost of the pixel point (x, y);
[0044] The disparity calculation unit is used to take the disparity corresponding to the minimum value of the aggregation cost of the pixel point (x, y) as the disparity of the pixel point to obtain a disparity map of the target image.
[0045] Furthermore, the multi-mode local feature cost includes:
[0046] A multi-mode local feature coding structure, used to grayscale the left image and the right image respectively, and perform multi-mode local feature coding on the grayscaled images, wherein the multi-mode local feature coding includes central gradient feature coding, angle feature coding and radial gradient feature coding;
[0047] The Hamming distance calculation structure is used to calculate the Hamming distance of the binary string corresponding to the multimodal local feature encoding to obtain the corresponding multimodal local feature cost; wherein the multimodal local feature is represented by the center gradient cost, angle cost and radial gradient cost, which are respectively used to characterize the gradient change, angle change and radial gradient change between the pixel to be matched and its neighboring pixels.
[0048] Furthermore, the cost aggregation unit includes:
[0049] The aggregation weight calculation structure is used to calculate the aggregation weight w of the initial matching cost by weighting the spatial distance and the color distance within the aggregation cost window. p ;
[0050] The weighted average operation structure is used to use the aggregation weight w pPerforming weighted averaging on the initial matching costs within the aggregation window to obtain the aggregation cost of the pixel (x, y);
[0051] Among them, the aggregation weight w p for:
[0052]
[0053] Where (x, y) is the coordinate of the pixel point p to be matched in the aggregation area, (x other ,y other ) is any other pixel point p in the aggregation area other The coordinates of , α and β are parameters that characterize the importance of spatial distance and color distance, respectively. other ) represents pixel point p and pixel point p other The color distance between two pixels indicates the maximum grayscale distance between the three channels of R, G, and B.
[0054] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:
[0055] (1) The stereo matching method of the present invention uses AD cost to characterize the grayscale similarity between pixels, and uses multi-modal local feature cost to characterize the relative size relationship between the to-be-matched pixel and its neighboring pixels. The relative size relationship reflects the structural similarity between the pixels. That is, the present invention creatively introduces the structural information between the to-be-matched pixel and its neighboring pixels into the matching cost, fully considering the characterization of the grayscale similarity and structural similarity between pixels, improving the problem that the matching cost designed by the existing method is greatly affected by lighting and the matching accuracy is low in weak texture areas and edges, thereby improving the matching accuracy of the stereo matching method in weak texture areas and edges.
[0056] (2) Furthermore, when calculating the aggregation cost, the present invention introduces spatial distance and color distance influencing factors in the aggregation process, and comprehensively considers the influence of the spatial position and color similarity of the pixel points in the aggregation area on the weight distribution of the center pixel matching cost, thereby improving the problem of inaccurate calculation of the aggregation cost of the depth discontinuous area caused by the existing method that only considers color similarity in the cost aggregation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A flow chart of a stereo matching method for integrating AD cost and multi-modal local feature cost provided by the present invention;
[0058] Figure 2 A schematic diagram of central gradient feature encoding according to an embodiment of the present invention;
[0059] Figure 3is a schematic diagram of angle feature coding according to an embodiment of the present invention;
[0060] Figure 4 is a schematic diagram of radial gradient feature encoding according to an embodiment of the present invention;
[0061] Figure 5 Schematic diagram of sub-pixel optimization according to an embodiment of the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0063] like Figure 1 As shown, the binocular stereo matching method provided by the present invention that integrates AD cost and multi-modal local feature cost mainly includes the following steps:
[0064] Data acquisition step: obtain the left image L and the right image R of the binocular stereo vision sensor and use them as a matching image pair;
[0065] Stereo matching steps: take the left image L as the target image and the right image R as the reference image, and obtain the disparity map of the left image through stereo matching; take the right image R as the target image and the left image L as the reference image, and obtain the disparity map of the right image through stereo matching;
[0066] Disparity optimization step: By optimizing the disparity map of the left image and the disparity map of the right image, the mismatched points are removed, the matching accuracy is improved, and the final disparity map is obtained.
[0067] Among them, the stereo matching process in the stereo matching step includes:
[0068] Cost calculation steps: Take any pixel point (x, y) in the target image as the pixel point to be matched, and calculate the cost of the pixel point (x, y) in the disparity search range {d 0 ,d 1 ,...,d n}, at the pixel point {(x+d 0 ,y),(x+d 1 ,y),...,(x+d n ,y)}; the AD cost and the multi-modal local feature cost are weightedly fused to obtain the initial matching cost of the corresponding pixel in the disparity range of each pixel point (x, y) in the target image
[0069] The parallax range is determined according to the maximum parallax of the image. In this embodiment, the maximum parallax value is 64.
[0070] Cost aggregation step: In the target image, an aggregation window is obtained. Within the aggregation window, the initial matching cost of each pixel is aggregated by weighting the spatial distance and color distance to obtain the aggregated cost of each pixel in the target image.
[0071] Disparity calculation step: Minimize the aggregation cost of each pixel in the target image The corresponding disparity value is used as the disparity of the pixel point to obtain the disparity map of the target image.
[0072] Specifically, in this embodiment, the binocular stereo vision sensor is a binocular stereo camera.
[0073] Specifically, in the above stereo matching process, in the cost calculation step, for any pixel point (x, y) in the target image, the AD cost C of the pixel point in the corresponding reference image within the disparity search range is AD (x,y,d) is:
[0074]
[0075] in, Represents the pixel value of the target image at the pixel point (x, y). Represents the pixel value of the reference image at the position (x+d,y), and i=R,G,B represents the three channels of R, G, and B.
[0076] The multimodal local feature cost represents the structural information between the pixel to be matched and its neighboring pixels, including: center gradient cost, angle cost and radial gradient cost, which respectively represent the gradient change, angle change and radial gradient change between the pixel to be matched and its neighboring pixels.
[0077] The center gradient cost, angle cost and radial gradient cost are obtained according to the following sub-steps:
[0078] Graying the left and right images respectively, and performing multi-mode local feature coding on each pixel in the grayed images, wherein the multi-mode local feature coding includes central gradient feature coding, angle feature coding and radial gradient feature coding;
[0079] The Hamming distance of the binary string corresponding to the multimodal local feature encoding is calculated to obtain the corresponding multimodal local feature cost.
[0080] Among them, the central gradient feature encoding method is to traverse in a certain order within the set matching window, taking the pixel to be matched as the reference pixel. If the current pixel grayscale value is greater than or equal to the reference pixel grayscale value, the current pixel position is encoded as 1. If the current pixel grayscale value is less than the reference pixel grayscale value, the current pixel position is encoded as 0, and a binary string representing the central gradient feature of the central pixel of the window is obtained.
[0081] The angle feature encoding method is to traverse the same matching window in the same order as the center gradient feature encoding method, select the next pixel in the traversal order as the reference pixel, and if the current pixel grayscale value is greater than or equal to the reference pixel grayscale value, the current pixel position is encoded as 1; if the current pixel grayscale value is less than the reference pixel grayscale value, the current pixel position is encoded as 0, and a binary string representing the angle feature of the center pixel of the window is obtained.
[0082] The radial gradient feature encoding method is to traverse in the same matching window in the same order as the central gradient feature encoding method, and compare the grayscale value relationship between the pixel to be traversed and its radially outward adjacent pixels. If the grayscale value of the pixel is greater than or equal to the grayscale value of the radially adjacent pixel, the pixel position is encoded as 1; if the grayscale value of the pixel is less than the grayscale value of the radially adjacent pixel, the pixel position is encoded as 0, and a binary string representing the radial gradient feature of the central pixel of the window is obtained.
[0083] Specifically, Figure 2 As shown, in this embodiment, the central gradient feature encoding method takes the minimum value of the row and column coordinates of the upper left corner of the matching window as the starting pixel point, and traverses in a clockwise order. Figure 2 The numbers 45, 150, ..., 110 in the figure represent the grayscale values of the pixels in the matching window respectively. The number 81 at the center is the pixel to be matched. The numbers ①, ②, ..., ⑧ represent the matching order in a clockwise direction respectively. According to the center gradient feature encoding method, the binary code of the center gradient feature is 01110110.
[0084] like Figure 3 As shown, in this embodiment, the angle feature encoding method takes the minimum value of the row and column coordinates of the upper left corner of the window as the starting pixel point, traverses in a clockwise order, selects the next pixel in the clockwise order as the reference pixel, and according to the angle feature encoding method, the obtained angle feature binary code is 11001000.
[0085] like Figure 4As shown, in this embodiment, the radial gradient feature encoding method takes the minimum value of the row and column coordinates of the upper left corner in the matching window as the starting pixel, and compares the grayscale value relationship of the pixel with the adjacent pixels in the radial outward direction in a clockwise order. According to the radial gradient feature encoding method, the binary code of the radial gradient feature obtained is 01010010.
[0086] Calculate the Hamming distance of the central gradient feature encoding binary string to obtain the corresponding central gradient cost C center (x,y,d):
[0087]
[0088] Where, T 1 center (x,y) and They represent the binary encoding of the central gradient features of the pixel (x, y) in the target image and the pixel (x+d, y) in the reference image in their corresponding matching windows, and d represents any value within the disparity range, that is, d∈{d 0 ,d 1 ,...,d n}, Hamming() represents the Hamming distance calculation operator.
[0089] Angle cost C angle (x, y, d) is obtained by calculating the Hamming distance of the angle feature encoding binary string, as follows:
[0090]
[0091] Where, T 1 angle (x,y) and Represents the binary encoding of the angle features of the pixel (x, y) in the target image and the pixel (x+d, y) in the reference image within their corresponding matching windows.
[0092] Radial gradient cost C radial (x, y, d) is obtained by calculating the Hamming distance of the radial gradient feature encoding binary string, as follows:
[0093]
[0094] Where, T 1 radial (x,y) and Represents the binary encoding of the radial gradient features of the pixel (x, y) in the target image and the pixel (x+d, y) in the reference image within their corresponding matching windows.
[0095] Specifically, in the cost calculation step, the AD cost and the multi-modal local feature cost are weighted and fused, and the resulting cost C(x, y, d) is:
[0096] C(x,y,d)=ρ(C AD (x,y,d),λ AD )+ρ(C Center (x,y,d),λ Center ) +ρ(C Angle (x,y,d),λ Angle )+ρ(C Radial (x,y,d),λ Radial )
[0097] In the formula, C AD (x,y,d) represents AD cost, C center (x,y,d) represents the center gradient cost, C angle (x, y, d) represents the angle cost, C radial (x, y, d) represents the radial gradient cost, λ AD , Center , Angle and λ Radial Respectively represent the normalized weighting coefficients of AD cost, center gradient cost, angle cost and radial gradient cost. In this embodiment, λ AD and λ Radial The value of is 10, Center , Angle The general value of is 30, and ρ is the normalization function, as shown below:
[0098]
[0099] Among them, c and λ represent the cost and normalized weight coefficient respectively.
[0100] Specifically, in the cost aggregation step, obtaining the aggregation window includes:
[0101] The aggregation cost window area is obtained by using the size difference of pixel grayscale values in an adaptive cross window manner. The adaptive cross window is constructed as follows:
[0102]
[0103] Where p represents the cross arm center reference pixel, p next Indicates the next pixel to be expanded, D c Represents the color distance between pixels, i.e. D c (p next ,p)=max i=R,G,B |I i (p next )-Ii (p)|,D s Indicates the position distance between pixels, that is, D s (p next ,p)=|p next -p|, the above expansion rules mainly include three constraints: ① It is necessary to ensure that the color distance between the next pixel to be expanded and the central pixel is less than the color distance between the previous pixel to be expanded and the central pixel. 1 , which ensures the homogeneity of pixel colors in the extended area; ② The length of the extended cross arm should be less than L 1 , to avoid the cross arm length being too long; ③ When the arm length reaches L 2 After the length, the color threshold τ needs to be reduced 1 is τ 2 In the present invention, L 1 The value is 34, L 2 The value is 14, τ 1 The value is 20, τ 2 The value is 6.
[0104] Get the aggregate cost of each pixel in the target image include:
[0105] In the aggregation cost window, the aggregation weight w of the initial matching cost of each pixel obtained above is calculated by weighting the spatial distance and color distance. p ;
[0106] Use the aggregation weight w p The initial matching cost of each pixel in the aggregation window is weighted averaged to obtain the aggregation cost of each pixel in the target image.
[0107] Specifically, the aggregation weight w p It is determined by introducing the color distance and space distance influencing factors, expressed as:
[0108]
[0109] Where (x, y) is the coordinate of the pixel point p to be matched in the aggregation area, (x other ,y other ) is any other pixel point p in the aggregation area other The coordinates of D(p,p other ) represents the pixel point p and the pixel point p in the aggregation area other The color distance between two pixels indicates the maximum grayscale distance between the three channels of R, G, and B. D(p, pother) = max i=R,G,B|I(p)-I(pother)|, α and β are parameters that characterize the importance of spatial distance and color distance, respectively. They are generally between 10 and 30. When there are many areas of color homogeneity in the image, the color should be weakened and the influence of distance should be highlighted, that is, the distance weight α should be increased.
[0110] Among them, the aggregation cost C within the window d for:
[0111]
[0112] Where R is the aggregation window area determined by the adaptive cross window, w p It is the weight corresponding to the pixel in the aggregation window, and n represents the number of pixels in the aggregation window.
[0113] In the parallax optimization step, parallax optimization can be performed by the following methods:
[0114] Sub-pixel optimization: Taking the left image as the target image, interpolate each disparity value in the disparity map using the aggregate cost of each pixel in the target image to obtain the sub-pixel disparity value d corresponding to each pixel in the left image. l , taking the right image as the target image, interpolate each disparity value in the disparity map using the aggregate cost of each pixel in the target image, and obtain the sub-pixel disparity value d corresponding to each pixel in the right image r ;
[0115] Specifically, Figure 5 As shown, take the aggregation cost C corresponding to the disparity d d 'The adjacent cost value C d-1 ' and C d+1 ', using C d-1 ' and C d+1 'Perform quadratic fitting interpolation according to the following formula to obtain the sub-pixel disparity value:
[0116]
[0117] Consistency check: Within a given error range, for the same pixel, compare the sub-pixel disparity value d corresponding to the pixel. l and the sub-pixel disparity value d r Are they equal? If they are equal, the disparity corresponding to the pixel point on the disparity map is accurate. If they are not equal, the pixel point is recorded as a mismatched point and the mismatched point is removed from the corresponding disparity map. In practical applications, blank points that appear simultaneously on the disparity map of the left image and the disparity map of the right image due to occlusion are recorded as undefined disparity points.
[0118] Disparity filling: Use the median of the neighborhood disparity value to fill the above mismatched points, and use the minimum value of the neighborhood disparity value to fill the undefined disparity points to obtain the final disparity map.
[0119] In the process of disparity optimization, sub-pixel disparity optimization is used to improve matching accuracy, consistency check is used to remove mismatched points, and hole filling is used to compensate for mismatched points and occlusion points, ultimately obtaining an accurate disparity map.
[0120] During the consistency check, stereo matching is performed on the left and right images respectively, and the disparity of the pixel (x, y) in the left image is obtained as d l , the disparity d of the pixel (x+d,y) in the right image r , if |d r -d l |>T, then let the pixel (x, y) in the left image be the mismatch point, and the disparity d l is an invalid parallax. In this embodiment, T is a set error and its value is 1.
[0121] In the above embodiment, since the center gradient cost, angle cost and radial gradient cost are introduced in the process of constructing the matching cost, that is, the structural information between the pixel to be matched and its neighborhood pixels is introduced into the matching cost, the perception of the matching cost to the structural texture is enhanced, and the matching effect in the weak texture area and edge is improved, which is manifested in that the stereo matching algorithm can achieve higher matching accuracy in the weak texture area and edge.
[0122] In addition, since color distance and spatial distance influencing factors are introduced in the cost aggregation process, the weights of low color similarity and long-distance pixels in the cost aggregation process are reduced, so that the final matching result disparity map can obtain better matching effects in areas with large disparity changes.
[0123] This embodiment conducts comparative experiments on the commonly used IGF algorithm, ADSG algorithm and SGBM1 algorithm on the Training Dense data set of the professional stereo matching test platform Middlebury V3. The evaluation indicators are average error (Avgerr) and bad1.0. The average error measures the mean error between the calculated disparity of the stereo matching algorithm and the real disparity. The smaller the value, the better the algorithm. Bad 1.0 describes the ratio of the calculated disparity to the real disparity calculated difference greater than one pixel. The smaller the value, the better the algorithm. The experimental results are shown in Table 1. It can be seen from the experimental results that the stereo matching algorithm proposed in the present invention is lower than the traditional stereo matching method in terms of average error and bad 1.0 indicators, indicating that the stereo matching method proposed in the present invention has certain advancement.
[0124] Table 1 Comparison of stereo matching accuracy of different algorithms
[0125]
[0126] The present invention also provides a stereo matching system integrating AD cost and multi-mode local feature cost, comprising:
[0127] A data acquisition module, used to acquire a matching image pair, the matching image pair comprising a left image L and a right image R;
[0128] A stereo matching module is used to use the left image L as the target image and the right image R as the reference image to obtain a disparity map through a stereo matching submodule; use the right image R as the target image and the left image L as the reference image to obtain a disparity map through a stereo matching submodule;
[0129] The disparity optimization module is used to compare the disparity maps obtained from the two matches, optimize the inconsistent pixels and the pixels in the occluded area, and obtain the final disparity map;
[0130] Among them, the stereo matching submodule includes:
[0131] The cost calculation unit is used to take any pixel point (x, y) in the target image as a pixel to be matched, and calculate the AD cost and multi-modal local feature cost of the pixel point (x, y) in the reference image within the disparity search range; the AD cost and the multi-modal local feature cost are weightedly fused to obtain the initial matching cost of the pixel point (x, y) corresponding to the pixel point within the disparity range of the reference image; wherein the multi-modal local feature cost is used to characterize the relative size relationship between the pixel to be matched and its neighboring pixels;
[0132] The cost aggregation unit is used to set an aggregation window in the target image, and aggregate the initial matching costs within the aggregation window by weighting the spatial distance and the color distance to obtain the aggregation cost of the pixel point (x, y);
[0133] The disparity calculation unit is used to take the disparity corresponding to the minimum value of the aggregation cost of the pixel point (x, y) as the disparity of the pixel point to obtain the disparity map of the target image.
[0134] Among them, the multi-mode local feature costs include:
[0135] A multi-mode local feature coding structure is used to grayscale the left image and the right image respectively, and perform multi-mode local feature coding on the grayscaled images, wherein the multi-mode local feature coding includes central gradient feature coding, angle feature coding and radial gradient feature coding;
[0136] The Hamming distance calculation structure is used to calculate the Hamming distance of the binary string corresponding to the multi-modal local feature encoding to obtain the corresponding multi-modal local feature cost; wherein the multi-modal local feature is represented by the center gradient cost, angle cost and radial gradient cost, which are respectively used to characterize the gradient change, angle change and radial gradient change between the pixel to be matched and its neighboring pixels.
[0137] The cost aggregation unit includes:
[0138] Aggregation weight calculation structure, used to calculate the aggregation weight w of the initial matching cost within the aggregation cost window by weighting the spatial distance and color distance p ;
[0139] Weighted average operation structure, used to use the aggregate weight w p Perform weighted averaging on the initial matching costs within the aggregation window to obtain the aggregation cost of pixel (x, y);
[0140] Among them, the aggregation weight w p for:
[0141]
[0142] Where (x, y) is the coordinate of the pixel point p to be matched in the aggregation area, (x other ,y other ) is any other pixel point p in the aggregation area other The coordinates of , α and β are parameters that characterize the importance of spatial distance and color distance, respectively. other ) represents pixel point p and pixel point p other The color distance between two pixels indicates the maximum grayscale distance between the three channels of R, G, and B.
[0143] Parallax optimization module, including:
[0144] The sub-pixel optimization unit is used to interpolate each disparity value in the disparity map using the aggregate cost of each pixel in the target image to obtain the sub-pixel disparity value d with the left image as the target image. l and the sub-pixel disparity value d with the right image as the target image r ;
[0145] The consistency check unit is used to compare the corresponding sub-pixel disparity values d for the same pixel within a given error range. l and the sub-pixel disparity value d r Are they equal? If they are equal, the disparity corresponding to the pixel point on the disparity map is accurate. If they are not equal, the pixel point is recorded as a mismatched point and the mismatched point is removed from the corresponding disparity map.
[0146] The disparity filling unit is used to fill the mismatched points with the median value of the neighborhood disparity value, and to fill the pixel points in the occluded area with the minimum value of the neighborhood disparity value to obtain the final disparity map.
[0147] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A stereo matching method integrating AD cost and multi-modal local feature cost. It is characterized in that include: Data acquisition step: acquiring an image pair, wherein the image pair includes a left image L and a right image R; Stereo matching steps: take the left image L as the target image and the right image R as the reference image, and obtain the disparity map through stereo matching; take the right image R as the target image and the left image L as the reference image, and obtain the disparity map through stereo matching; Disparity optimization step: perform consistency comparison on the disparity maps obtained from the two matches, optimize the inconsistent pixels and the pixels in the occluded area, and obtain the final disparity map; Wherein, the stereo matching process includes: Cost calculation step: taking any pixel point (x, y) in the target image as the pixel point to be matched, and calculating the AD cost and multi-modal local feature cost of the pixel point (x, y) in the reference image within the disparity search range; weighted fusion of the AD cost and the multi-modal local feature cost to obtain the initial matching cost of the pixel point (x, y) corresponding to the pixel point within the disparity range of the reference image; wherein the multi-modal local feature cost is used to characterize the relative size relationship between the pixel to be matched and its neighboring pixels; Cost aggregation step: in the target image, an aggregation window is set, and within the aggregation window, the initial matching costs are aggregated by weighting the spatial distance and the color distance to obtain the aggregation cost of the pixel point (x, y); Disparity calculation step: taking the disparity corresponding to the minimum value of the aggregation cost of the pixel point (x, y) as the disparity of the pixel point, and obtaining the disparity map of the target image.
2. The method according to claim 1, It is characterized in that The multi-mode local feature cost is obtained by the following sub-steps: Graying the left image and the right image respectively, and performing multi-mode local feature coding on the grayed images, wherein the multi-mode local feature coding includes central gradient feature coding, angle feature coding and radial gradient feature coding; The Hamming distance of the binary string corresponding to the multimodal local feature encoding is calculated to obtain the corresponding multimodal local feature cost, wherein the multimodal local feature cost includes a center gradient cost, an angle cost, and a radial gradient cost, which are respectively used to characterize the gradient change, angle change, and radial gradient change between the pixel to be matched and its neighboring pixels.
3. The method according to claim 2, It is characterized in that The central gradient cost C center (x,y,d), angle cost C angle (x,y,d) and radial gradient cost C radial (x,y,d) is: Among them, T 1 center (x,y), T 1 angle (x,y), T 1 radial (x,y), They respectively represent the central gradient feature coding, angle feature coding, and radial gradient feature coding of the pixel point (x, y) in the target image and the pixel point (x+d, y) in the reference image in their corresponding matching windows. d represents any disparity value within the disparity range. Hamming() represents the Hamming distance calculation operator.
4. The method according to claim 3, It is characterized in that The initial matching cost C(x,y,d) is: C(x,y,d)=ρ(C AD (x,y,d),λ AD )+ρ(C Center (x,y,d),λ Center )+ρ(C Angle (x,y,d),λ Angle )+ρ(C Radial (x,y,d),λ Radial ) In the formula, C AD (x,y,d) represents the AD cost, λ AD , Center , Angle and λ Radial Respectively represent the normalized weighted coefficients of AD cost, center gradient cost, angle cost and radial gradient cost, ρ is the normalization function; Among them, AD cost C AD (x,y,d) is represented as: In the formula, Represents the pixel value of the target image at (x, y), Represents the pixel value of the reference image at (x+d,y), and i=R,G,B represents the three channels of R, G, and B.
5. The method according to claim 4, It is characterized in that The cost aggregation step includes the following sub-steps: In the aggregation cost window, the aggregation weight w of the initial matching cost is calculated by weighting the spatial distance and the color distance. p ; With the aggregation weight w p The initial matching costs within the aggregation window are weighted averaged to obtain the aggregation cost of the pixel (x, y).
6. The method according to claim 5, It is characterized in that The aggregation weight w p The relationship between the spatial distance and color distance between pixels in the aggregation area is: Where (x, y) is the coordinate of the pixel point p to be matched in the aggregation area, (x other ,y other ) is any other pixel point p in the aggregation area other The coordinates of , α and β are parameters that characterize the importance of spatial distance and color distance, respectively. other ) represents pixel point p and pixel point p other The color distance between two pixels indicates the maximum grayscale distance between the three channels of R, G, and B.
7. The method according to any one of claims 1 to 6, It is characterized in that The parallax optimization step includes the following sub-steps: Each disparity value in the disparity map is interpolated using the aggregate cost of each pixel in the target image to obtain the sub-pixel disparity value d with the left image as the target image. l and the sub-pixel disparity value d with the right image as the target image r ; Within a given error range, for the same pixel, compare the corresponding sub-pixel disparity value d l and the sub-pixel disparity value d r Are they equal? If they are equal, the disparity corresponding to the pixel point on the disparity map is accurate. If they are not equal, the pixel point is recorded as a mismatched point and the mismatched point is removed from the corresponding disparity map. The mismatched points are filled with the median of the neighborhood disparity values, and the pixel points in the occluded area are filled with the minimum of the neighborhood disparity values to obtain a final disparity map.
8. A stereo matching system integrating AD cost and multi-modal local feature cost, It is characterized in that include: A data acquisition module, used to acquire a matching image pair, wherein the matching image pair includes a left image L and a right image R; A stereo matching module is used to use the left image L as the target image and the right image R as the reference image to obtain a disparity map through a stereo matching submodule; use the right image R as the target image and the left image L as the reference image to obtain a disparity map through a stereo matching submodule; The disparity optimization module is used to compare the disparity maps obtained from the two matches, optimize the inconsistent pixels and the pixels in the occluded area, and obtain the final disparity map; Wherein, the stereo matching submodule includes: A cost calculation unit is used to take any pixel point (x, y) in the target image as a pixel to be matched, and calculate the AD cost and multi-modal local feature cost of the pixel point (x, y) in the reference image within the disparity search range; weightedly fuse the AD cost and the multi-modal local feature cost to obtain the initial matching cost of the pixel point (x, y) corresponding to the pixel point within the disparity range of the reference image; wherein the multi-modal local feature cost is used to characterize the relative size relationship between the pixel to be matched and its neighboring pixels; A cost aggregation unit, used for setting an aggregation window in the target image, and aggregating the initial matching costs within the aggregation window by weighting the spatial distance and the color distance to obtain an aggregation cost of the pixel point (x, y); The disparity calculation unit is used to take the disparity corresponding to the minimum value of the aggregation cost of the pixel point (x, y) as the disparity of the pixel point to obtain a disparity map of the target image.
9. The system according to claim 8, It is characterized in that The multi-mode local feature cost includes: A multi-mode local feature coding structure, used to grayscale the left image and the right image respectively, and perform multi-mode local feature coding on the grayscaled images, wherein the multi-mode local feature coding includes central gradient feature coding, angle feature coding and radial gradient feature coding; The Hamming distance calculation structure is used to calculate the Hamming distance of the binary string corresponding to the multimodal local feature encoding to obtain the corresponding multimodal local feature cost; wherein the multimodal local feature is represented by the center gradient cost, angle cost and radial gradient cost, which are respectively used to characterize the gradient change, angle change and radial gradient change between the pixel to be matched and its neighboring pixels.
10. The system according to claim 8, It is characterized in that The cost aggregation unit includes: The aggregation weight calculation structure is used to calculate the aggregation weight w of the initial matching cost by weighting the spatial distance and the color distance within the aggregation cost window. p ; The weighted average operation structure is used to use the aggregation weight w p Performing weighted averaging on the initial matching costs within the aggregation window to obtain the aggregation cost of the pixel (x, y); Among them, the aggregation weight w p for: Where (x, y) is the coordinate of the pixel point p to be matched in the aggregation area, (x other ,y other ) is any other pixel point p in the aggregation area other The coordinates of , α and β are parameters that characterize the importance of spatial distance and color distance, respectively. other ) represents pixel point p and pixel point p other The color distance between two pixels indicates the maximum grayscale distance between the three channels of R, G, and B.
