Parallax confidence acquisition method and device, electronic equipment, readable storage medium
By obtaining the disparity confidence in binocular stereo vision and utilizing texture confidence and auxiliary confidence calculation methods, the problems of occlusion, weak texture, and repeated texture in disparity calculation are solved, thereby improving the accuracy of disparity confidence and the precision of 3D image reconstruction.
Patent Information
- Application Number
- CN202210295165.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In existing technologies, binocular stereo vision suffers from problems such as disparity occlusion, weak texture, and repetitive texture when calculating disparity, resulting in inaccurate disparity calculation results and affecting 3D image reconstruction.
By acquiring the texture confidence and at least one auxiliary confidence of the first and second views, and combining the texture confidence and auxiliary confidence to calculate the disparity confidence, and using the sum and difference of pixel values within a preset window to calculate the confidence, the accuracy of the disparity confidence is improved.
By comprehensively reflecting the disparity confidence level, the accuracy of the disparity confidence level is improved, thereby enhancing the precision of 3D image reconstruction.
Smart Images

Figure CN116843739B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data processing, and particularly relates to a parallax confidence acquisition method and device, electronic equipment and readable storage medium. BACKGROUND
[0002] Binocular stereo vision is to calculate the distance information of an object to a camera according to the difference (parallax) of the positions of the images of the same object on two cameras, and then the three-dimensional information of the objects around the camera can be recovered based on the distance information. Figure 1 The image points of the same object point p on the left and right cameras are X left and X right , and the parallax Disparity is X left -X right . According to the parallax Disparity, the image y coordinate, the distance between the optical centers of the two cameras (baseline distance B), and the camera focal length, the three-dimensional coordinates of the object point P can be obtained.
[0003] In practical applications, considering that there are problems such as parallax occlusion, weak texture, and repeated texture in left and right images, the parallax calculation result will have error values, which is not conducive to the subsequent reconstruction of three-dimensional images. SUMMARY
[0004] The present disclosure provides a parallax confidence acquisition method and device, electronic equipment and readable storage medium to solve the problems of the related art.
[0005] According to a first aspect of an embodiment of the present disclosure, a parallax confidence acquisition method is provided, comprising:
[0006] obtaining a first view and a second view; the shooting scenes corresponding to the first view and the second view have a common part;
[0007] obtaining a texture confidence and at least one auxiliary confidence based on the first view and the second view;
[0008] obtaining a parallax confidence of the parallax of the first view and the second view according to the texture confidence and the at least one auxiliary confidence.
[0009] Optionally, obtaining a texture confidence based on the first view and the second view comprises:
[0010] obtaining a sum value of pixel values of pixel points in a preset window centered on each pixel point in the first view, and taking the sum value as a texture value of the first view;
[0011] determining a texture confidence according to the texture value and a preset texture threshold range.
[0012] Optionally, determining a texture confidence according to the texture value and a preset texture threshold range comprises:
[0013] determining a first numerical value as the texture confidence when the texture value is less than a minimum value of the texture threshold range;
[0014] determining a first specified ratio value as the texture confidence when the texture value is greater than the minimum value of the texture threshold range and less than a maximum value of the texture threshold range, the first specified ratio value being a ratio of a texture difference value and a threshold difference value, wherein the texture difference value is a difference between the texture value and the minimum value of the texture threshold range, and the threshold difference value is a difference between the maximum value of the texture threshold range and the minimum value of the texture threshold range;
[0015] determining a second numerical value as the texture confidence when the texture value is greater than the maximum value of the texture threshold range.
[0016] Optionally, obtaining at least one auxiliary confidence based on the first view and the second view comprises:
[0017] obtaining a disparity cost curve of each pixel point in the first view based on the first view and the second view;
[0018] for each pixel point, obtaining a position of a minimum cost value in the corresponding disparity cost curve, and calculating an optimal disparity of the pixel point in the disparity cost curve according to the position of the minimum cost value;
[0019] respectively obtaining a maximum cost value on each side of the minimum cost value in the disparity cost curve, to obtain a first cost value and a second cost value;
[0020] calculating the at least one auxiliary confidence according to the minimum cost value and / or the first cost value and the second cost value.
[0021] Optionally, the at least one confidence comprises a first auxiliary confidence, and the first auxiliary confidence is calculated according to the minimum cost value and / or the first cost value and the second cost value, comprising:
[0022] obtaining a smaller value of the first cost value and the second cost value;
[0023] obtaining a difference between the smaller value and the minimum cost value;
[0024] obtaining a local uniqueness percentage of the disparity cost curve according to the difference and the minimum cost value;
[0025] determine a uniqueness confidence according to the local uniqueness percentage and a preset percentage range, and take the uniqueness confidence as the first auxiliary confidence.
[0026] Optionally, determining the uniqueness confidence according to the local uniqueness percentage and a preset percentage range comprises:
[0027] when the local uniqueness percentage is less than or equal to a minimum value of the preset percentage range, determining a value of the uniqueness confidence as a first numerical value;
[0028] when the local uniqueness percentage is greater than the minimum value of the preset percentage range and less than a maximum value of the preset percentage range, determining a first specified numerical value as the uniqueness confidence, the first specified numerical value being a ratio of a first difference value and a second difference value; wherein the first difference value is a difference between the local uniqueness percentage and the minimum value of the preset percentage range, and the second difference value is a difference between the maximum value of the preset percentage range and the minimum value of the preset percentage range;
[0029] when the local uniqueness percentage is greater than or equal to the maximum value of the preset percentage range, determining a second numerical value as the uniqueness confidence.
[0030] Optionally, the at least one confidence comprises a second auxiliary confidence, and the second auxiliary confidence is calculated according to the minimum generation value and / or the first generation value and the second generation value, comprising:
[0031] obtaining a larger value of the first generation value and the second generation value;
[0032] obtaining a difference between the larger value and the minimum generation value;
[0033] obtaining a global contrast corresponding to the disparity cost curve according to the difference and the minimum generation value;
[0034] determining the second auxiliary confidence according to the global contrast and a preset first contrast range.
[0035] Optionally, determining the second auxiliary confidence according to the global contrast and a preset first contrast range comprises:
[0036] when the global contrast is less than or equal to a minimum value of the first contrast range, determining a first numerical value as the second auxiliary confidence;
[0037] determining a second specified value as the second auxiliary confidence when the global contrast is greater than a minimum value of the first contrast range and less than a maximum value of the first contrast range, the second specified value being a ratio of a third difference value and a fourth difference value, wherein the third difference value is a difference between the global contrast and the minimum value of the first contrast range, and the fourth difference value is a difference between the maximum value of the first contrast range and the minimum value of the first contrast range;
[0038] determining a second value as the second auxiliary confidence when the global contrast is greater than or equal to the maximum value of the first contrast range.
[0039] Optionally, the at least one confidence includes a third auxiliary confidence, the third auxiliary confidence being calculated according to the minimum generation value and / or the first generation value and the second generation value, including:
[0040] obtaining a fifth difference value of the first generation value and the minimum generation value, and obtaining a sixth difference value of the second generation value and the minimum generation value;
[0041] obtaining left and right side contrasts of the disparity cost curve according to the fifth difference value and the sixth difference value;
[0042] determining the third auxiliary confidence according to the left and right side contrasts and a preset second contrast range.
[0043] Optionally, determining the third auxiliary confidence according to the left and right side contrasts and a preset second contrast range includes:
[0044] determining a first value as the third auxiliary confidence when the left and right side contrasts are less than or equal to a minimum value of the second contrast range;
[0045] determining a third specified value as the third auxiliary confidence when the left and right side contrasts are greater than the minimum value of the second contrast range and less than a maximum value of the second contrast range, the third specified value being a ratio of a seventh difference value and an eighth difference value, wherein the seventh difference value is a difference between the left and right side contrasts and the minimum value of the second contrast range, and the eighth difference value is a difference between the maximum value of the second contrast range and the minimum value of the second contrast range;
[0046] determining a second value as the third auxiliary confidence when the left and right side contrasts are greater than or equal to the maximum value of the second contrast range.
[0047] Optionally, the at least one confidence includes a fourth auxiliary confidence, the fourth auxiliary confidence being calculated according to the minimum generation value and / or the first generation value and the second generation value, including:
[0048] obtaining a first minimum value and a second minimum value by obtaining sub-minimum values on both sides of the minimum value in the disparity cost curve;
[0049] obtaining a ninth difference value by obtaining a smaller value between the first minimum value and the second minimum value and obtaining a difference between the smaller value and the minimum value;
[0050] obtaining a global uniqueness percentage of the disparity cost curve according to the ninth difference value and the minimum value;
[0051] calculating the fourth auxiliary confidence according to the global uniqueness percentage and a preset percentage range.
[0052] Optionally, the calculating the fourth auxiliary confidence according to the global uniqueness percentage and a preset percentage range comprises:
[0053] determining a first numerical value as the fourth auxiliary confidence when the global uniqueness percentage is less than or equal to a minimum value of the percentage range;
[0054] determining a fourth specified numerical value as the fourth auxiliary confidence when the global uniqueness percentage is greater than the minimum value of the percentage range and less than a maximum value of the percentage range, the fourth specified numerical value being a ratio of a tenth difference value and an eleventh difference value, the tenth difference value being a difference between the global uniqueness percentage and the minimum value of the percentage range, and the eleventh difference value being a difference between the maximum value of the percentage range and the minimum value of the percentage range;
[0055] determining a second numerical value as the fourth auxiliary confidence when the global uniqueness percentage is greater than or equal to the maximum value of the percentage range.
[0056] Optionally, the method further comprises:
[0057] determining a third auxiliary confidence and / or a fourth auxiliary confidence as the second numerical value when the optimal disparity is less than or equal to a preset distance threshold with respect to a preset disparity threshold and a side of a disparity cost curve on which a pixel corresponding to the optimal disparity is located is in a monotonic state.
[0058] Optionally, the obtaining the disparity confidence of the disparity between the first view and the second view according to the texture confidence and the at least one auxiliary confidence comprises:
[0059] calculating a product of the texture confidence and the at least one auxiliary confidence, and taking the product as the disparity confidence.
[0060] According to a second aspect of the embodiments of the present disclosure, a disparity confidence obtaining device is provided, comprising:
[0061] a view obtaining module configured to obtain a first view and a second view, wherein a photographed scene corresponding to the first view and the second view has a common part;
[0062] an auxiliary confidence obtaining module configured to obtain a texture confidence and at least one auxiliary confidence based on the first view and the second view;
[0063] a disparity confidence obtaining module configured to obtain a disparity confidence of a disparity between the first view and the second view according to the texture confidence and the at least one auxiliary confidence.
[0064] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, comprising a memory and a processor;
[0065] the memory is configured to store a computer program executable by the processor;
[0066] the processor is configured to execute the computer program in the memory to implement the method as described above.
[0067] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which can implement the method as described above when a computer program executable in the storage medium is executed by a processor.
[0068] The technical solutions provided by the embodiments of the present disclosure can have the following beneficial effects:
[0069] As can be seen from the above embodiments, the scheme provided by the embodiments of the present disclosure can obtain a first view and a second view, wherein a photographed scene corresponding to the first view and the second view has a common part; then, a texture confidence and at least one auxiliary confidence are obtained based on the first view and the second view; and then, a disparity confidence of a disparity between the first view and the second view is obtained according to the texture confidence and the at least one auxiliary confidence. Since the at least one auxiliary confidence can assist in explaining the disparity confidence from different angles, the disparity confidence is obtained by the texture confidence and the at least one auxiliary confidence in the embodiment, which can more comprehensively reflect the disparity confidence, and is beneficial to improving the accuracy of the disparity confidence.
[0070] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0071] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0072] Figure 1is a flowchart of a disparity confidence acquisition method according to an exemplary embodiment.
[0073] Figure 2 is a flowchart of a texture confidence acquisition method according to an exemplary embodiment.
[0074] Figure 3 is an effect diagram of a preset window according to an exemplary embodiment.
[0075] Figure 4 is a flowchart of an auxiliary confidence acquisition method according to an exemplary embodiment.
[0076] Figure 5 is an effect diagram of a minimum cost position in a disparity cost curve according to an exemplary embodiment.
[0077] Figure 6 is a flowchart of a first auxiliary confidence acquisition method according to an exemplary embodiment.
[0078] Figure 7 is a flowchart of a second auxiliary confidence acquisition method according to an exemplary embodiment.
[0079] Figure 8 is a flowchart of a third auxiliary confidence acquisition method according to an exemplary embodiment.
[0080] Figure 9 is a flowchart of a fourth auxiliary confidence acquisition method according to an exemplary embodiment.
[0081] Figure 10 is an effect diagram of a sub-minimum value according to an exemplary embodiment.
[0082] Figure 11 is a flowchart of another disparity confidence acquisition method according to an exemplary embodiment.
[0083] Figure 12 is an effect diagram of a weak texture and repetitive texture region according to an exemplary embodiment.
[0084] Figure 13 is an effect diagram of a confidence of a weak texture and repetitive texture region according to an exemplary embodiment.
[0085] Figure 14 is a block diagram of a disparity confidence acquisition apparatus according to an exemplary embodiment.
[0086] Figure 15 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0087] The exemplary embodiments will be described in detail below with reference to the drawings. In the following description, unless otherwise indicated, like numbers in the different drawings represent similar or identical elements. The following exemplary description is, therefore, not to be taken in a limiting sense. Rather, the scope of the present disclosure is defined by the appended claims. It is to be understood that features of the following embodiments, and embodiments implicit from the disclosure, can be combined with each other, if not inconsistent.
[0088] To solve the above technical problems, the present disclosure provides a parallax confidence acquisition method, which can be applied to an electronic device comprising two cameras. Wherein, the scenes captured by the two cameras have a common part (such as the same person or the same object, etc.), that is, there is an overlapping part in the two images captured. For the convenience of description, the two images are referred to as the first image and the second image in the following. It can be understood that the first image and the second image can also be captured by one camera at different positions or from different angles, and it is ensured that the corresponding scenes of the two images have a common part, which can be set according to the specific scene, which is not limited here.
[0089] Figure 1 FIG. 1 is a flowchart of a parallax confidence acquisition method according to an exemplary embodiment. Referring to FIG. 1, a parallax confidence acquisition method comprises steps 11-13. Figure 1 , a parallax confidence acquisition method comprises steps 11-13.
[0090] In step 11, a first view and a second view are acquired; the corresponding scenes of the first view and the second view have a common part.
[0091] In this embodiment, the first image and the second image captured by the camera of the electronic device can be stored in a specified location, which can include but is not limited to a local memory, a cache or a cloud. The processor of the electronic device can read the first image and the second image from the specified location. Of course, the processor can also communicate directly with the camera to obtain the first image and the second image uploaded by the camera. The skilled person can select a suitable image acquisition method according to the specific scene, which is not limited here.
[0092] In this embodiment, after obtaining the first image and the second image, the processor rectifies the distortion of the first image and the second image, for example, perspective distortion correction, barrel distortion correction, pincushion distortion correction, etc., so as to restore the photographed object in the first image and the second image to a normal state.
[0093] In this embodiment, the processor can perform parallel correction on the first and second images after distortion correction. For example, the processor can transform the pixel coordinate systems of the first and second images to the camera coordinate system using a common intrinsic parameter matrix. Then, the processor can rotate the two camera coordinate systems to obtain new camera coordinate systems. Afterward, distortion correction operations are performed on the left and right cameras respectively for the new camera coordinates. After both distortion correction operations are completed, the left and right camera coordinate systems are transformed back to the pixel coordinate systems of the left and second images using the intrinsic parameter matrices of the left and right cameras, respectively, and the pixel values of the left and second images are interpolated to the pixels of the new left and second images.
[0094] In this embodiment, after distortion correction and parallelism correction, the processor performs disparity search preprocessing on the first and second images, including but not limited to brightness correction, blur correction, normalization filtering and Sobel filtering. In one example, the processor can use XSobel filtering or Normalized Response filtering. Finally, the processor can obtain the first and second views.
[0095] In step 12, texture confidence and at least one auxiliary confidence are obtained based on the first view and the second view.
[0096] In this embodiment, the processor can obtain texture confidence based on the first view, see [link to relevant documentation]. Figure 2 This includes steps 21 and 22.
[0097] In step 21, the processor can obtain the sum of pixel values of pixels within a preset window, centered on each pixel in the first view, and use the sum as the texture value of the first view. Here, the texture value is a quantization method of texture. Texture reflects the surface organization and arrangement properties of an object's surface that have slowly changing or periodically varying characteristics, and can be represented by the grayscale distribution of pixels and their surrounding spatial neighborhood.
[0098] The processor can use either a first view or a second view as a reference view. In this step, the texture value is obtained using the first view as an example. The width of the preset window is w, and w is an odd number greater than 3. For example, if w equals 5, the size of the preset window is 5*5. Then, each pixel in the first view is the center of the preset window, resulting in an area with a height and width of 5 pixels, as shown below. Figure 3 As shown. See also Figure 3 , Figure 3 A 5x5 preset window is shown, and the pixels are represented by black rectangles. Then, the processor can calculate the sum of the pixel values of all pixels within the preset window, as shown in equation (1):
[0099] ; (1)
[0100] In equation (1), Represents the texture value of a pixel (x, y). This represents the maximum offset of a pixel at its top, bottom, left, and right sides, where i and j represent the pixel's offset.
[0101] In step 22, the processor can determine the texture confidence level based on the texture value and a preset texture threshold range. The preset texture threshold range is... You can choose according to the specific scenario. The value of the texture value. For example, when the texture value is less than the minimum value of the texture threshold range, the processor can determine the first value (such as 0) as the texture confidence. Or, when the texture value is greater than the minimum value of the texture threshold range and less than the maximum value of the texture threshold range, the processor can determine the first specified ratio as the texture confidence, which is the ratio of the texture difference to the threshold difference, wherein the texture difference is the difference between the texture value and the minimum value of the texture threshold range, and the threshold difference is the difference between the maximum value of the texture threshold range and the minimum value of the texture threshold range. Or, when the texture value is greater than the maximum value of the texture threshold range, the processor can determine the texture confidence as the second value (such as 1). The texture confidence is calculated as shown in equation (2):
[0102] ; (2)
[0103] In equation (2), This represents the texture confidence of a pixel (x, y).
[0104] In this embodiment, by obtaining the texture confidence score, a lower confidence score can be assigned to weak textures and a higher confidence score to strong textures. That is, weak texture regions in the first view and the second view are filtered out, which helps to improve the confidence score of finding the optimal disparity.
[0105] In this embodiment, the processor can obtain at least one auxiliary confidence level based on the first view and the second view, see [link / reference]. Figure 4 This includes steps 41 to 44.
[0106] In step 41, the processor can obtain a disparity cost curve of each pixel point in the first view based on the first view and the second view. For example, the processor can obtain each pixel point in the reference image, and obtain pixel values of pixel points in the above-mentioned preset window centered on each pixel point; a matching pixel point in the second view also generates a preset window, and pixel values of pixel points in the preset window are obtained. Then, the processor can calculate the difference value of the pixel values of the pixel points at the same position in the two preset windows, calculate the absolute value of each difference value, and then calculate the sum value of all the difference values to obtain the cost value of the pixel point in the reference image. The preset window in the second view is moved within the disparity search range, and the cost value is continuously calculated, and so on. A plurality of cost values are obtained for the one pixel point in the reference image. The processor can establish a disparity cost curve corresponding to each pixel point according to the disparity and the cost value.
[0107] In this embodiment, the manner of obtaining the disparity cost curve includes but is not limited to MAD (mean absolute difference algorithm), SAD (sum of absolute differences algorithm), SSD (sum of squared differences algorithm), MSD (mean sum of squared differences algorithm), SSDA (sequential similarity detection algorithm), SATD (handmard transform algorithm), NCC (normalized cross correlation algorithm), and a suitable obtaining manner can be selected according to a specific scene. Taking the SAD algorithm for obtaining the disparity cost curve as an example, the expression of the disparity cost curve is shown in formula (3):
[0108] (3)
[0109] In formula (3), (x, y) represents the position of the pixel point, represents the pixel value of the pixel point (x, y) in the first view, represents the disparity cost of the pixel point (x, y) in the first view and the pixel point (x+d, y) in the second view, represents the pixel point after the pixel point (x, y) in the second view is right-shifted by a distance d, , represents the absolute value of X.
[0110] In step 42, for each pixel point, the processor can obtain the position of the minimum cost value in the disparity cost curve corresponding to the pixel point, and calculate the optimal disparity of the pixel point corresponding to the disparity cost curve according to the position of the minimum cost value.
[0111] In this embodiment, after obtaining the disparity cost curve of each pixel point, the processor can obtain the position of the minimum cost value in each disparity cost curve, and the effect is as follows: Figure 5As shown. In other words, for each disparity cost curve, the processor can obtain its minimum cost and the position of that minimum cost. The method for obtaining the minimum cost can be the mathematical method of finding the minimum value within a curve segment, which will not be elaborated here. It is understandable that when the disparity cost between two pixels in the first and second views is minimized, the distance between these two pixels is the disparity, often referred to as the optimal disparity. Based on the above analysis, the processor can calculate the optimal disparity of the pixel corresponding to the disparity cost curve based on the position of the minimum cost.
[0112] In step 43, the processor can obtain the maximum cost value on each side of the minimum cost value in the disparity cost curve to obtain the first generation value and the second generation value.
[0113] In this embodiment, the processor can further acquire the maximum cost value on each side of the minimum cost value in each disparity cost curve. It is understood that each disparity cost curve contains a minimum cost value, and each minimum cost value has a left and a right side. Therefore, the processor can obtain the maximum cost value to the left and the maximum cost value to the right of the minimum cost value. The maximum cost value to the left of the minimum cost value is referred to as the first-generation value, and the maximum cost value to the right of the minimum cost value is referred to as the second-generation value. It should be noted that the method of acquiring the maximum cost value on each side of the minimum cost value can be converted into the mathematical method of solving for the maximum value on a curve within a closed region, which will not be elaborated here. See also... Figure 5 Within a certain disparity cost curve, the minimum cost value is minsad, the corresponding optimal disparity is mind, and the first cost value is madsad. L This corresponds to position d1; the second cost value is madsad. R This corresponds to position d2.
[0114] In step 44, the processor can calculate the at least one auxiliary confidence level based on the minimum generation value, the first generation value, and the second generation value.
[0115] In this embodiment, the processor can calculate the at least one auxiliary confidence according to the minimum generation value, the first generation value and the second generation value. The auxiliary confidence can be at least one of a first auxiliary confidence, a second auxiliary confidence, a third auxiliary confidence and a fourth auxiliary confidence. The first auxiliary confidence is used to represent the confidence of the local uniqueness detection percentage, so as to determine whether the adjacent pixels in the second view correspond to the same pixel in the scene of the first view (the reference image) according to the generation value adjacent to the optimal disparity. The second auxiliary confidence is used to represent the confidence of the global contrast, which is a supplement to the weak texture confidence, so as to filter out some scenes that are forced to be calculated as strong textures, such as horizontal straight lines that can be calculated as strong textures. The third auxiliary confidence is used to represent the confidence of the left-right contrast, so as to determine whether the matching degree of the minimum generation value is reliable, such as the generation value on one side of the minimum generation value is high, and the generation values on the other side are all low. Then, from high to low, it indicates that the matching degree of the minimum generation value corresponding to the optimal disparity is higher and higher, but the matching result of the minimum value is not good because the generation values on the other side are all low. The fourth auxiliary confidence is used to represent the confidence of the global uniqueness percentage, so as to filter out scenes with repeated textures, and can also filter out other error cost curves. The skilled person can select at least one auxiliary confidence according to the specific scene, and the corresponding scheme falls within the scope of the present disclosure.
[0116] In one embodiment, the at least one confidence includes a first auxiliary confidence, and the processor calculates the first auxiliary confidence according to the minimum generation value, as shown in Figure 6 , including steps 61-64.
[0117] In step 61, the processor can obtain the generation values of the minimum generation value adjacent points, obtain the third generation value and the fourth generation value, and obtain the smaller value of the third generation value and the fourth generation value. Continue to refer to Figure 5 , assuming that the third generation value p is the generation value on the left side of the minimum generation value, and the fourth generation value n is the generation value on the right side of the minimum generation value, then the smaller value of the third generation value p and the fourth generation value n can be represented as min(p, n).
[0118] In step 62, the processor can obtain the difference between the smaller value and the minimum generation value. Continue to refer to Figure 5 , the difference is min(p, n)-minsad.
[0119] In step 63, the processor can obtain the local uniqueness percentage of the disparity cost curve according to the difference and the minimum value, for example, calculating the ratio of the difference and the minimum value, which is the local uniqueness percentage of the disparity cost curve. Wherein, the calculation formula of the local uniqueness percentage is shown in formula (4):
[0120] ; (4)
[0121] In formula (4), q represents the local uniqueness percentage, minsad represents the minimum generation value, and min(p, n) represents the smaller value between the third generation value p and the fourth generation value n.
[0122] In step 64, the processor can determine the uniqueness confidence according to the local uniqueness percentage and the preset percentage range, and take the uniqueness confidence as the first auxiliary confidence. The preset percentage range is In this step, the processor can compare the local uniqueness percentage with the maximum value and the minimum value in the preset percentage range. When the local uniqueness percentage is less than or equal to the minimum value of the preset percentage range, the processor can determine a first value (such as 0) as the uniqueness confidence; when the local uniqueness percentage is greater than the minimum value of the preset percentage range and less than the maximum value of the preset percentage range, the processor can determine a first specified value as the uniqueness confidence, where the first specified value is the ratio of a first difference value and a second difference value; the first difference value is the difference between the local uniqueness percentage and the minimum value of the preset percentage range, and the second difference value is the difference between the maximum value of the preset percentage range and the minimum value of the preset percentage range; when the local uniqueness percentage is greater than or equal to the maximum value of the preset percentage range, the processor can determine a second value (such as 1) as the uniqueness confidence.
[0123] Alternatively, the processor can calculate the first auxiliary confidence according to formula (5):
[0124] ; (5)
[0125] In formula (5), min represents the minimum value of the preset percentage range, max represents the maximum value of the preset percentage range, q represents the local uniqueness percentage, min(p, n) represents the uniqueness confidence of the pixel point , that is, the first auxiliary confidence.
[0126] In this embodiment, whether the optimal disparity adjacent generation value is close to the minimum generation value can be used to determine whether the adjacent pixels in the second view are likely to correspond to the same pixel in the first view, so as to determine whether the optimal disparity is unique.
[0127] In an embodiment, the at least one confidence includes a second auxiliary confidence, and the processor calculates the second auxiliary confidence according to the minimum generation value, the first generation value and the second generation value, see Figure 7 , including steps 71-74.
[0128] In step 71, the processor can obtain the larger value between the first generation value and the second generation value. Continuing to refer to FIG. 7, the larger value between the first generation value and the second generation value is maxsad = max(maxsad Figure 5 , maxsad L ). R The larger value between the two is maxsad = max(maxsad L , maxsad R ).
[0129] In step 72, the processor can obtain the difference between the larger value and the minimum generation value. Continuing to refer to FIG. 7, the difference between the larger value and the minimum generation value is maxsad - min sad. Figure 5
[0130] In step 73, the processor can obtain the global contrast corresponding to the disparity cost curve according to the difference and the minimum generation value, for example, calculating the ratio of the difference to the minimum value, which is the global contrast. The global contrast can be calculated by formula (6):
[0131] (6)
[0132] In formula (6), c represents the global contrast.
[0133] In step 74, the processor can determine the second auxiliary confidence according to the global contrast and a preset first contrast range. For example, the processor can compare the global contrast with the minimum value and the maximum value in the preset first contrast range. When the global contrast is less than or equal to the minimum value of the first contrast range, the processor can determine a first value as the second auxiliary confidence; when the global contrast is greater than the minimum value of the first contrast range and less than the maximum value of the first contrast range, the processor can determine a second specified value as the second auxiliary confidence, the second specified value being the ratio of a third difference value to a fourth difference value; the third difference value being the difference between the global contrast and the minimum value of the first contrast range, and the fourth difference value being the difference between the maximum value of the first contrast range and the minimum value of the first contrast range; when the global contrast is greater than or equal to the maximum value of the first contrast range, the processor can determine a second value as the second auxiliary confidence.
[0134] Alternatively, the processor can calculate the second auxiliary confidence according to formula (6):
[0135] (6)
[0136] In formula (6), represents the minimum value of the preset first contrast range, represents the maximum value of the preset first contrast range, representing a global contrast, representing a pixel point at which the second auxiliary confidence is obtained.
[0137] The global contrast confidence, i.e., the second auxiliary confidence, obtained in the embodiment can supplement the confidence of weak texture, and the flatness of the disparity cost curve can filter out the error problem that a horizontal line is calculated as strong texture, thereby improving the accuracy of subsequent detection results.
[0138] In an embodiment, the at least one confidence includes a third auxiliary confidence, and the processor calculates the third auxiliary confidence according to the minimum cost value, the first cost value, and the second cost value, see Figure 8 , which includes steps 81-83.
[0139] In step 81, the processor can obtain a fifth difference value of the first cost value and the minimum cost value, and obtain a sixth difference value of the second cost value and the minimum cost value. For example, the fifth difference value S1 is , and the sixth difference value S2 is .
[0140] In step 82, the processor can obtain the left and right side contrasts of the disparity cost curve according to the fifth difference value and the sixth difference value. For example, the processor can obtain the ratio of the larger value of the fifth difference value and the sixth difference value to the smaller value of the fifth difference value and the sixth difference value, and take the ratio as the left and right side contrasts of the disparity cost curve. The larger value of the fifth difference value and the sixth difference value is , the smaller value of the fifth difference value and the sixth difference value is , and the left and right side contrasts are .
[0141] In step 83, the processor can determine the third auxiliary confidence according to the left and right side contrast and a preset second contrast range. For example, the processor can compare the left and right side contrast with the preset second contrast range. When the left and right side contrast is less than or equal to the minimum value of the second contrast range, the processor can determine a first numerical value as the third auxiliary confidence; when the left and right side contrast is greater than the minimum value of the second contrast range and less than the maximum value of the second contrast range, the processor can determine a third specified numerical value as the third auxiliary confidence, the third specified numerical value being the ratio of a seventh difference value and an eighth difference value; the seventh difference value being the difference between the left and right side contrast and the minimum value of the second contrast range, and the eighth difference value being the difference between the maximum value of the second contrast range and the minimum value of the second contrast range; when the left and right side contrast is greater than or equal to the maximum value of the second contrast range, the processor can determine a second numerical value as the third auxiliary confidence. Alternatively, the processor can calculate the third auxiliary confidence according to formula (7):
[0142] ; (7)
[0143] In formula (7), represents the minimum value of the preset second contrast range, represents the maximum value of the preset second contrast range, represents the left and right side contrast, represents the third auxiliary confidence at the pixel point.
[0144] In the embodiment, by obtaining the left and right side contrast, it can be determined whether the uniqueness of the matching result of the minimum cost value is good by using the high and low of the cost values on both sides of the minimum cost value. For example, the cost values on one side of the curve minimum cost value are high, and the cost values on the other side are all low. From high to low, it indicates that the matching degree is higher and higher, but because the cost values on the other side are all low, the uniqueness of the matching result of the minimum value is not good, which is beneficial to improve the accuracy of the subsequent detection result.
[0145] In an embodiment, the at least one confidence includes a fourth auxiliary confidence, and the processor calculates the fourth auxiliary confidence according to the minimum cost value, the first cost value and the second cost value, see Figure 9 , including steps 91-94.
[0146] In step 91, the processor can obtain the second minimum value on both sides of the minimum cost value in the disparity cost curve, to obtain a first minimum value and a second minimum value. See Figure 10 , the second minimum value on both sides of the minimum value is minsad L and minsad R , the first minimum value is minsad L , and the second minimum value is minsadR The first minimum value and the second minimum value can be converted into extreme points of a curve in a closed region in mathematics, and the extreme points are sorted, so that a sub-minimum point can be selected from the sorted extreme points, which will not be described herein.
[0147] In step 92, the processor can obtain a smaller value of the first minimum value and the second minimum value, and obtain a difference between the smaller value and the minimum cost value, to obtain a ninth difference value. For example, the smaller value of the first minimum value and the second minimum value is min(minsad L , minsad R ), and the ninth difference value is min(minsad L , minsad R )-minsad.
[0148] In step 93, the processor can obtain the global uniqueness percentage of the disparity cost curve according to the ninth difference value and the minimum cost value. For example, the processor can calculate a ratio of the ninth difference value to the minimum cost value, and the ratio is the global uniqueness percentage of the disparity cost curve, that is:
[0149] ; (8)
[0150] In formula (8), t represents the global uniqueness percentage of the disparity cost curve.
[0151] In step 94, the processor can calculate the fourth auxiliary confidence according to the global uniqueness percentage and a preset percentage range. For example, the processor can compare the global uniqueness percentage with the preset percentage range. When the global uniqueness percentage is less than or equal to a minimum value of the percentage range, the processor can determine a first value as the first auxiliary confidence; when the global uniqueness percentage is greater than the minimum value of the percentage range and less than a maximum value of the percentage range, the processor can determine a fourth specified value as the fourth auxiliary confidence, the fourth specified value being a ratio of a tenth difference value to an eleventh difference value; the tenth difference value being a difference between the global uniqueness percentage and the minimum value of the percentage range, and the eleventh difference value being a difference between the maximum value of the percentage range and the minimum value of the percentage range; when the global uniqueness percentage is greater than or equal to the maximum value of the percentage range, the processor can determine a second value as the fourth auxiliary confidence.
[0152] Alternatively, the processor can calculate the fourth auxiliary confidence according to formula (9):
[0153] ; (9)
[0154] In formula (9), min represents the minimum value of the percentage range, This indicates the maximum value within the percentage range. Indicates the percentage of global uniqueness. Represents pixels The fourth auxiliary confidence level.
[0155] In this embodiment, obtaining the global uniqueness confidence score can filter out duplicate textures in the view, as well as other erroneous disparity cost curves, which helps improve the accuracy of subsequent detection results.
[0156] It should be noted that the above embodiments describe the first to fourth auxiliary confidence levels. Of course, those skilled in the art can choose the above multiple confidence levels or other confidence levels according to the specific scenario, and the corresponding solutions fall within the protection scope of this disclosure.
[0157] In one embodiment, considering that the disparity cost curve is an offline curve, the difference between adjacent costs may jump, causing spikes on the disparity cost curve, which in turn affects the accuracy of the maximum, minimum, second maximum, and second minimum values obtained in the above process, and ultimately affects the accuracy of the confidence score. Therefore, in this embodiment, when obtaining the second, third, and fourth auxiliary confidence scores, the processor can perform low-pass filtering on each disparity cost curve to smooth the curve, filter out local noise interference, and avoid the impact of cost jumps on the accuracy of the confidence score. The low-pass filtering method may include, but is not limited to, mean filtering, median filtering, Gaussian filtering, etc., and can be selected according to the specific scenario; the corresponding scheme falls within the protection scope of this disclosure.
[0158] In one embodiment, when the distance between the optimal disparity and a preset disparity threshold is less than or equal to a preset distance threshold, and one side of the disparity cost curve corresponding to the pixel with the optimal disparity is monotonic, the processor can set the third auxiliary confidence level and / or the fourth auxiliary confidence level to the second value. Thus, this embodiment improves the accuracy of the auxiliary confidence level by adjusting the third and fourth auxiliary confidence levels.
[0159] In step 13, the disparity confidence of the first view and the second view is obtained based on the texture confidence and the at least one auxiliary confidence.
[0160] In this embodiment, the processor can obtain the disparity confidence of the first view and the second view disparity according to the texture confidence and at least one auxiliary confidence. The at least one auxiliary confidence can be one, that is, the first auxiliary confidence, the second auxiliary confidence, the third auxiliary confidence, or the fourth auxiliary confidence. The at least one auxiliary confidence can be two, that is, the first auxiliary confidence and the second auxiliary confidence, the first auxiliary confidence and the third auxiliary confidence, the first auxiliary confidence and the fourth auxiliary confidence, the second auxiliary confidence and the third auxiliary confidence, the second auxiliary confidence and the fourth auxiliary confidence, or the third auxiliary confidence and the fourth auxiliary confidence. The at least one auxiliary confidence can be three, that is, the first auxiliary confidence, the second auxiliary confidence, and the third auxiliary confidence, the first auxiliary confidence, the second auxiliary confidence, and the fourth auxiliary confidence, or the second auxiliary confidence, the third auxiliary confidence, and the fourth auxiliary confidence. The at least one auxiliary confidence can be four, that is, the first auxiliary confidence, the second auxiliary confidence, the third auxiliary confidence, and the fourth auxiliary confidence.
[0161] In this embodiment, taking the case of four auxiliary confidences as an example, the processor can calculate the product of the texture confidence and the at least one auxiliary confidence, and take the product as the disparity confidence, as shown in the following formula (10):
[0162] (10)
[0163] In formula (10), disparity confidence, i represents the ordinal number of the texture confidence and the four confidences, represents the product of the plurality of confmaps.
[0164] In this embodiment, after obtaining the disparity confidence of the first view and the second view, the processor can obtain the disparity confidence of a plurality of views, and then align and fuse the plurality of views to obtain a fused three-dimensional reconstruction image. In the three-dimensional reconstruction process, the processor can fill in the pixel points and optimize the pixel points according to the disparity confidence, so as to obtain a better dense disparity and improve the alignment and fusion quality in the three-dimensional reconstruction process.
[0165] Thus, the scheme provided by the embodiment of the present disclosure can obtain a first view and a second view; then, obtain a texture confidence and at least one auxiliary confidence based on the first view and the second view; and then obtain a disparity confidence of the first view and the second view disparity according to the texture confidence and the at least one auxiliary confidence. Since the at least one auxiliary confidence can assist in explaining the disparity confidence from different angles, the texture confidence and the at least one auxiliary confidence are used to obtain the disparity confidence in this embodiment, which can more comprehensively reflect the disparity confidence and is beneficial to improving the accuracy of the disparity confidence.
[0166] The process of obtaining the parallax confidence level in combination with a specific scene is described below, referring to Figure 11 , including:
[0167] (1) Collect two images with a common field of view, and take the first image as the reference image.
[0168] (2) Correct the distortion of the two images.
[0169] (3) Correct the parallelism of the two images.
[0170] (4) Preprocess the parallax search of the two images, including but not limited to brightness correction, blur correction, normalization filtering, and sobel filtering. The left image after preprocessing is I L , and the right image is I R .
[0171] (5) Calculate the texture confidence level. Take each pixel point (x, y) of the reference image as the center, select a certain window size, the window width is w, w is an odd number, w>3, r=(w-1) / 2, calculate the sum of pixel values in the window as the texture value Texture(x, y), and obtain the texture confidence level confmap1 according to the given texture threshold range (T T1 , T T2 ), see formula (2).
[0172] (6) Use the BM (Boyer-Moore, string matching) algorithm to obtain the parallax cost curve of each pixel point in the parallax search, and obtain the optimal parallax of each pixel point through the position of the minimum cost value. It can be understood that there are many ways to obtain the parallax cost curve, and the SAD method is used to obtain the parallax cost curve in this step. Given the parallax search range [d1, d2], for the selected search window size w (consistent with the window size in the texture confidence level calculation), the parallax search cost curve sad(x, y) corresponding to the pixel position (x, y) is obtained by formula (3).
[0173] (7) Calculate the local uniqueness detection percentage q for each parallax cost curve, and obtain the first auxiliary confidence level confmap2 according to the preset percentage range , see formula (5).
[0174] (8) Low-pass filter the cost curve sad(x, y), including but not limited to the mean filter algorithm, to filter out local noise interference.
[0175] (9) Calculate the global contrast c for each parallax cost curve, and obtain the first contrast range (T c1 , T c2) to obtain a second auxiliary confidence confmap3, see equation (6).
[0176] (10) Calculate the left and right side contrasts c of each disparity cost curve lr , and obtain a third confidence confmap4 according to a preset second contrast range (T clr1 , T clr2 ), see equation (7).
[0177] (11) Calculate the global uniqueness percentage t of each disparity cost curve, and obtain a fourth auxiliary confidence confmap5 according to a percentage range (T t1 , T t2 ), see equation (9).
[0178] (12) Further process the confidence of the disparity cost curve with the minimum cost value close to the disparity search boundary. In confmap4 and confmap5, if the distance of the minimum cost value from the disparity boundary (i.e., a preset disparity threshold) is less than a preset distance threshold mw and the disparity cost curve on the side close to the boundary exhibits monotonicity (decreasing or increasing), the confidence can be increased, such as setting confmap4 and confmap5 to 1.
[0179] (13) Merge confmap1~ confmap5, such as multiplying the confidences of the corresponding positions to obtain the confidence conf of the final optimal disparity.
[0180] The scheme provided in this embodiment can give a low confidence for scenes such as weak texture, disparity occlusion, and repeated texture. Referring to Figure 12 , taking repeated texture as an example, if disparity search is performed on two images with repeated texture, the disparity search result of the repeated texture region is unreliable. Referring to Figure 13 , in this embodiment, the weak texture region and a small part of the repeated texture region can be filtered out to obtain Figure 13 , which is better than Figure 13 , (obtained in the related art) the right image.
[0181] On the basis of the disparity confidence acquisition method provided in the embodiment of the disclosure, the embodiment of the disclosure further provides a disparity confidence acquisition device, see Figure 14 , the device comprises:
[0182] A view acquisition module 141 is configured to acquire a first view and a second view; the first view and the second view correspond to a shooting scene with a common part;
[0183] An auxiliary confidence acquisition module 142 is configured to acquire a texture confidence and at least one auxiliary confidence based on the first view and the second view.
[0184] a disparity confidence obtaining module 143, configured to obtain a disparity confidence of disparity between the first view and the second view according to the texture confidence and the at least one auxiliary confidence.
[0185] It should be noted that the device and method embodiments shown in the present embodiment are matched with the content of the method embodiments, and the content of the method embodiments can be referred to, which will not be described here again.
[0186] Figure 15 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 1500 can be a smartphone, a computer, a digital broadcast terminal, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
[0187] Referring to Figure 15 , the electronic device 1500 can include one or more of the following components: a processing component 1502, a memory 1504, a power supply component 1506, a multimedia component 1508, an audio component 1510, an input / output (I / O) interface 1512, a sensor component 1514, a communication component 1516, and an image acquisition component 1518.
[0188] The processing component 1502 usually controls the overall operation of the electronic device 1500, such as operations associated with display, telephone call, data communication, camera operation and recording operation. The processing component 1502 can include one or more processors 1520 to execute computer programs. In addition, the processing component 1502 can include one or more modules to facilitate interaction between the processing component 1502 and other components. For example, the processing component 1502 can include a multimedia module to facilitate interaction between the multimedia component 1508 and the processing component 1502.
[0189] The memory 1504 is configured to store various types of data to support the operation of the electronic device 1500. Examples of these data include computer programs for operating any application or method on the electronic device 1500, contact data, phonebook data, messages, pictures, videos, etc. The memory 1504 can be realized by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0190] The power component 1506 provides power to various components of the electronic device 1500. The power component 1506 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 1500. The power component 1506 can include a power chip, and a controller can communicate with the power chip to control the power chip to turn on or off a switching device to supply or not supply power from a battery to a main board circuit.
[0191] The multimedia component 1508 includes a screen providing an output interface between the electronic device 1500 and a target object. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input information from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or sliding action, but also detect duration and pressure related to the touching or sliding action.
[0192] The audio component 1510 is configured to output and / or input audio file information. For example, the audio component 1510 includes a microphone (MIC) configured to receive external audio file information when the electronic device 1500 is in a mode such as a call mode, a recording mode, and a voice recognition mode. The received audio file information can be further stored in the memory 1504 or transmitted via the communication component 1516. In some embodiments, the audio component 1510 also includes a speaker to output audio file information.
[0193] The I / O interface 1512 provides an interface between the processing component 1502 and peripheral interface modules, which can be a keypad, a click wheel, buttons, and the like.
[0194] The sensor component 1514 includes one or more sensors to provide various state assessments for the electronic device 1500. For example, the sensor component 1514 can detect an open / closed state of the electronic device 1500, relative positioning of components such as a display screen and a keypad of the electronic device 1500, a change in position of the electronic device 1500 or a component, presence or absence of contact of a target object with the electronic device 1500, orientation or acceleration / deceleration of the electronic device 1500, and a change in temperature of the electronic device 1500. In this example, the sensor component 1514 can include a magnetic force sensor, a gyroscope, and a magnetic field sensor including at least one of a Hall sensor, a thin-film magnetoresistive sensor, and a magnetic liquid acceleration sensor.
[0195] The communication component 1516 is configured to facilitate wired or wireless communication between the electronic device 1500 and other devices. The electronic device 1500 can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 1516 receives broadcast information or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1516 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technology.
[0196] In an exemplary embodiment, the electronic device 1500 can be implemented using one or more application-specific integrated circuits (ASICs), digital information processors (DSPs), digital information processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements.
[0197] In an exemplary embodiment, a computer-readable storage medium, such as a memory including instructions, is also provided, which can be executed by a processor to execute the above-described executable computer program. The readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0198] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. It is intended that the present disclosure cover any and all variations of the disclosure that come within the scope of the claims and their equivalents. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.
[0199] It should be understood that the present disclosure is not limited to the precise structures herein described and illustrated in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims that follow.
Claims
1. A method for obtaining disparity confidence, characterized in that, The method comprises: obtaining a first view and a second view; the first view and the second view correspond to a shooting scene with a common part; obtaining a texture confidence and at least one auxiliary confidence based on the first view and the second view; determining a disparity confidence of a disparity between the first view and the second view according to the texture confidence and the at least one auxiliary confidence; obtaining at least one auxiliary confidence based on the first view and the second view, comprising: obtaining a disparity cost curve of each pixel point in the first view based on the first view and the second view; for each pixel point, obtaining a position of a minimum cost value in the corresponding disparity cost curve, and calculating an optimal disparity of the pixel point in the disparity cost curve according to the position of the minimum cost value; obtaining a first cost value and a second cost value respectively from maximum cost values on both sides of the minimum cost value in the disparity cost curve; calculating the at least one auxiliary confidence according to the minimum cost value and / or the first cost value and the second cost value.
2. The method of claim 1, wherein, obtaining a texture confidence based on the first view, comprising: obtaining a sum value of pixel values of pixel points in a preset window centered on each pixel point in the first view, and taking the sum value as a texture value of the first view; determining a texture confidence according to the texture value and a preset texture threshold range.
3. The method of claim 2, wherein, determining a texture confidence according to the texture value and a preset texture threshold range, comprising: when the texture value is less than a minimum value of the texture threshold range, determining a first numerical value as the texture confidence; when the texture value is greater than the minimum value of the texture threshold range and less than a maximum value of the texture threshold range, determining a first specified ratio as the texture confidence, the first specified ratio being a ratio of a texture difference value and a threshold difference value, wherein the texture difference value is a difference between the texture value and the minimum value of the texture threshold range, and the threshold difference value is a difference between the maximum value of the texture threshold range and the minimum value of the texture threshold range; when the texture value is greater than the maximum value of the texture threshold range, determining a second numerical value as the texture confidence.
4. The method of claim 1, wherein, The at least one confidence includes a first auxiliary confidence, and the first auxiliary confidence is calculated according to the minimum cost value and / or the first cost value and the second cost value, comprising: obtaining cost values of adjacent points of the minimum cost value to obtain a third cost value and a fourth cost value, and obtaining a smaller value of the third cost value and the fourth cost value; obtaining a difference between the smaller value and the minimum cost value; obtaining a local uniqueness percentage of the disparity cost curve according to the difference and the minimum cost value; determining a uniqueness confidence according to the local uniqueness percentage and a preset percentage range, and taking the uniqueness confidence as the first auxiliary confidence.
5. The method of claim 4, wherein, determining a uniqueness confidence according to the local uniqueness percentage and a preset percentage range, comprising: when the local uniqueness percentage is less than or equal to a minimum value of the preset percentage range, determining a first numerical value as the uniqueness confidence; determining the first specified value as the uniqueness confidence when the local uniqueness percentage is greater than the minimum value of the preset percentage range and less than the maximum value of the preset percentage range, the first specified value being a ratio of a first difference value and a second difference value, wherein the first difference value is a difference between the local uniqueness percentage and the minimum value of the preset percentage range, and the second difference value is a difference between the maximum value of the preset percentage range and the minimum value of the preset percentage range; determining a second value as the uniqueness confidence when the local uniqueness percentage is greater than or equal to the maximum value of the preset percentage range.
6. The method of claim 1, wherein, The at least one confidence includes a second auxiliary confidence, the second auxiliary confidence being calculated according to the minimum cost value and / or the first cost value and the second cost value, including: obtaining a larger value of the first cost value and the second cost value; obtaining a difference value between the larger value and the minimum cost value; obtaining a global contrast corresponding to the disparity cost curve according to the difference value and the minimum cost value; determining the second auxiliary confidence according to the global contrast and a preset first contrast range.
7. The method of claim 6, wherein, Determining the second auxiliary confidence according to the global contrast and a preset first contrast range includes: determining a first value as the second auxiliary confidence when the global contrast is less than or equal to a minimum value of the first contrast range; determining a second specified value as the second auxiliary confidence when the global contrast is greater than the minimum value of the first contrast range and less than a maximum value of the first contrast range, the second specified value being a ratio of a third difference value and a fourth difference value, wherein the third difference value is a difference between the global contrast and the minimum value of the first contrast range, and the fourth difference value is a difference between the maximum value of the first contrast range and the minimum value of the first contrast range; determining a second value as the second auxiliary confidence when the global contrast is greater than or equal to the maximum value of the first contrast range.
8. The method of claim 1, wherein, The at least one confidence includes a third auxiliary confidence, the third auxiliary confidence being calculated according to the minimum cost value and / or the first cost value and the second cost value, including: obtaining a fifth difference value between the first cost value and the minimum cost value, and obtaining a sixth difference value between the second cost value and the minimum cost value; obtaining left and right side contrasts of the disparity cost curve according to the fifth difference value and the sixth difference value; determining the third auxiliary confidence according to the left and right side contrasts and a preset second contrast range.
9. The method of claim 8, wherein, Determining the third auxiliary confidence according to the left and right side contrasts and a preset second contrast range includes: determining a first value as the third auxiliary confidence when the left and right side contrasts are less than or equal to a minimum value of the second contrast range; determining a second specified value as the third auxiliary confidence when the left and right side contrasts are greater than the minimum value of the second contrast range and less than a maximum value of the second contrast range, the second specified value being a ratio of a seventh difference value and an eighth difference value, wherein the seventh difference value is a difference between the left and right side contrasts and the minimum value of the second contrast range, and the eighth difference value is a difference between the maximum value of the second contrast range and the minimum value of the second contrast range; determining a second value as the third auxiliary confidence when the left and right side contrasts are greater than or equal to the maximum value of the second contrast range. determining the third auxiliary confidence as a third specified value when the left-right side contrast is greater than a minimum value of the second contrast range and less than a maximum value of the second contrast range, the third specified value being a ratio of a seventh difference value and an eighth difference value, the seventh difference value being a difference between the left-right side contrast and the minimum value of the second contrast range, and the eighth difference value being a difference between the maximum value of the second contrast range and the minimum value of the second contrast range; determining a second value as the third auxiliary confidence when the left-right side contrast is greater than or equal to the maximum value of the second contrast range.
10. The method of claim 1, wherein, The at least one confidence includes a fourth auxiliary confidence, the fourth auxiliary confidence being calculated according to the minimum generation value and / or the first generation value and the second generation value, including: obtaining a first minimum value and a second minimum value by obtaining sub-minimum values on both sides of the minimum generation value in the disparity cost curve; obtaining a ninth difference value by obtaining a smaller value of the first minimum value and the second minimum value and obtaining a difference between the smaller value and the minimum generation value; obtaining a global uniqueness percentage of the disparity cost curve according to the ninth difference value and the minimum generation value; calculating the fourth auxiliary confidence according to the global uniqueness percentage and a preset percentage range.
11. The method of claim 10, wherein, calculating the fourth auxiliary confidence according to the global uniqueness percentage and a preset percentage range, including: determining a first value as the fourth auxiliary confidence when the global uniqueness percentage is less than or equal to a minimum value of the percentage range; determining a fourth specified value as the fourth auxiliary confidence when the global uniqueness percentage is greater than the minimum value of the percentage range and less than a maximum value of the percentage range, the fourth specified value being a ratio of a tenth difference value and an eleventh difference value, the tenth difference value being a difference between the global uniqueness percentage and the minimum value of the percentage range, and the eleventh difference value being a difference between the maximum value of the percentage range and the minimum value of the percentage range; determining a second value as the fourth auxiliary confidence when the global uniqueness percentage is greater than or equal to the maximum value of the percentage range.
12. The method according to claim 9 or 11, characterized in that, The method further includes: determining a third auxiliary confidence and / or a fourth auxiliary confidence as a second value when a distance between the optimal disparity and a preset disparity threshold is less than or equal to a preset distance threshold and a side of a disparity cost curve on which a pixel point corresponding to the optimal disparity is located is in a monotonic state.
13. The method of any one of claims 1-11, wherein, obtaining a disparity confidence of disparity between the first view and the second view according to the texture confidence and the at least one auxiliary confidence, including: calculating a product of the texture confidence and the at least one auxiliary confidence, and taking the product as the disparity confidence.
14. A disparity confidence acquisition apparatus characterized by comprising: including: a view acquisition module, configured to acquire a first view and a second view; a shooting scene corresponding to the first view and the second view has a common part; an auxiliary confidence acquisition module, configured to acquire a texture confidence and at least one auxiliary confidence based on the first view and the second view; a disparity confidence obtaining module configured to determine a disparity confidence of disparity between the first view and the second view according to the texture confidence and the at least one auxiliary confidence; the auxiliary confidence obtaining module obtains the texture confidence and the at least one auxiliary confidence based on the first view and the second view, including: obtaining a disparity cost curve of each pixel point in the first view based on the first view and the second view; for each pixel point, obtaining a position of a minimum cost value in the corresponding disparity cost curve, and calculating an optimal disparity of the pixel point in the disparity cost curve according to the position of the minimum cost value; obtaining a first cost value and a second cost value respectively from maximum cost values on both sides of the minimum cost value in the disparity cost curve; calculating the at least one auxiliary confidence according to the minimum cost value and / or the first cost value and the second cost value.
15. An electronic device, comprising: including: a memory and a processor; the memory is configured to store a computer program executable by the processor; the processor is configured to execute the computer program in the memory to implement the method according to any one of claims 1-13.
16. A computer-readable storage medium, characterized in that, when the executable computer program in the storage medium is executed by the processor, the method according to any one of claims 1-13 can be implemented.
Citation Information
Patent Citations
Pixel point disparity value calculating method and apparatus for binocular stereoscopic vision
CN107392898A
Parallax confidence estimation method and device, electronic equipment and medium
CN111784756A