Water level measuring method based on binocular stereoscopic vision
Through the water level measurement method based on binocular stereo vision, the iteratively optimized semi-global SGM stereo matching and RANSAC plane fitting technology solves the problem of low accuracy in complex lighting conditions, and realizes high-precision and low-cost water level measurement, which is suitable for a variety of complex water body scenes.
Patent Information
- Application Number
- CN202411849382.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-16
AI Technical Summary
The existing water level measurement technology has low accuracy under complex lighting conditions, especially in water bodies affected by seawater such as high sand content and estuaries, which have temperature and time drift problems, and is not suitable for measuring sections with severe siltations and gentle slopes.
The water level measurement method based on binocular stereo vision is adopted, and the parallax information is optimized through the iteratively optimized semi-global SGM stereo matching method, and the matching accuracy of weak texture areas is improved. The three-dimensional point cloud is plane fitted through the RANSAC method to generate horizontal plane equations to obtain the water level value.
High-precision water level measurement is achieved in many scenarios such as different light, water flow, floating objects, etc., which reduces the complexity of the algorithm and improves the accuracy of obtaining water level values. It is suitable for measuring sections with severe siltations and gentle slopes.
Smart Images

Figure CN119810041A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of water level measurement using an image method, and in particular to a water level measurement method based on binocular stereo vision. Background Art
[0002] Water level measurement is the basic work of hydrological monitoring of rivers, lakes and reservoirs. Timely and accurate water level measurement can be of great significance for the refined management of water resources and early warning and forecasting of water disasters. The water level measurement technologies used in the existing hydrological monitoring field are mainly divided into two categories: contact and non-contact. Among them, the contact water level gauge mainly includes: 1) Float water level gauge, which has good stability and high reliability. It is generally suitable for water level fluctuations within a range of 40m, but needs to be equipped with logging. The construction and operation and maintenance costs are high. It is not suitable for rivers with serious siltation and measurement sections with gentle slopes; 2) Pressure water level gauge, which has a simple structure and low price. It is generally suitable for water level fluctuations within a range of 20m. It is not suitable for water bodies with high sand content, and is not suitable for measuring points such as estuaries affected by seawater flow density changes and serious siltation; 3) Liquid medium ultrasonic water level gauge, which is suitable for measuring points where water level logging cannot be built. It usually needs to be installed underwater with a minimum water level of 0.5m. It is not suitable for silted rivers and has temperature drift and time drift problems. Non-contact water level meters mainly include: 1) Air-medium ultrasonic water level meter, which has a simple principle and low cost, and is suitable for installation at a position above 0.5m above the highest water level. However, it is necessary to ensure that there are no obstructing reflectors within the beam angle range of the transducer emission direction. It is not suitable for measuring sections with gentle slopes, and the temperature drift and time drift problems are more serious. 2) Laser water level meter, which has high ranging accuracy, up to millimeter level, but requires water level logging; 3) Radar water level meter, which has high measurement accuracy, up to centimeter level, and has no obvious temperature drift and time drift problems, but needs to be arranged vertically above the measured water body. It is not suitable for measuring sections with gentle slopes, and there must be no obstruction within the radar signal beam angle range, and measurement may be interrupted on rainy and snowy days. 4) Visual water level meter, which mainly identifies the water level line reading of reference objects such as water gauges in the water body and converts it into water level. In principle, it has no temperature drift and time drift problems, can detect at an angle and the results are intuitive, which is conducive to visual verification. However, water level line detection and identification is sensitive to complex lighting (reflections, glare), weather (fog, heavy rain) and water flow (waves, floating objects) conditions on the water surface. In particular, the surface of the water gauge is easily entangled by floating objects, resulting in measurement failure or even damage to the water gauge, requiring manual wading maintenance. Therefore, it is usually suitable for scenes with stable installation conditions such as vertical slopes or bridge piers.
[0003] Stereoscopic vision technology originates from the human need for depth perception and the understanding of binocular stereoscopic vision mechanism. As an important branch of machine vision, it has been widely used in the fields of industry, medicine, robotics and virtual reality after decades of development since its creation. Humans perceive the depth and distance information of objects in three-dimensional space through the parallax difference between the left and right eyes. Stereoscopic vision technology attempts to simulate this binocular vision principle to obtain the depth information of the three-dimensional scene. This technology uses the object images obtained by shooting at different angles, obtains the feature correspondence between the images through stereoscopic vision algorithms such as epipolar constraints and stereo matching, and then uses the triangulation principle to calculate the spatial geometric information of the object. In this regard, the present invention provides a water level measurement method based on binocular stereoscopic vision, which uses the parallax principle to restore the three-dimensional coordinates of the water surface from the left and right images, and then measures the distance from the camera to the fitting horizontal plane and converts it to obtain the water level value. Only relying on the natural feature information of the water surface, without the need to manually lay out reference objects such as water rulers, a completely non-contact shore-based inclined water level measurement can be achieved. This simple and low-cost measurement method can well meet the water level monitoring needs in conventional and emergency scenarios, and has great application potential in the fields of smart water conservancy and emergency rescue.
[0004] In the application of stereo vision, the baseline length of the binocular camera directly affects the measurement range and accuracy, so it is necessary to determine the appropriate baseline length based on the camera focal length and the actual detection distance. The technical core of the water level measurement method based on binocular stereo vision lies in how to obtain accurate disparity maps from the left and right eye images and obtain three-dimensional point cloud data using the disparity principle. At present, the methods for obtaining disparity maps can be divided into two categories: traditional stereo matching and deep learning stereo matching. Among them, traditional stereo matching algorithms include PMS (patch match stereo), BM (block matching), Census, etc. Since water surface images are easily affected by optical noise such as mirror reflection, shadow, glare, ripples, etc., it is difficult to extract and match the features of weak texture and repeated texture areas. The occlusion of bank slopes, vegetation and floating objects on the water surface also leads to holes in the generated disparity map or abnormal values that cannot represent the real water surface. Therefore, it is necessary to obtain the three-dimensional point cloud data using the disparity map. Then, it is necessary to realize the fitting of the point cloud plane, which is of great significance for obtaining the water level value. The classic plane fitting methods include the least square method and the eigenvalue method. However, these methods cannot eliminate the influence of outliers on plane fitting, resulting in low precision and poor robustness of horizontal plane fitting. Although deep learning methods can extract complex global features and contextual information, and have obvious advantages in dealing with mirror reflections, weak textures, or even textureless areas in water environments, there is currently no high-precision disparity map dataset in a real water environment in the field of stereo vision research. As a result, deep learning stereo matching models trained directly using existing land environments and artificially synthesized datasets still have problems such as insufficient generalization ability. Summary of the invention
[0005] Purpose of the invention: The present invention provides a water level measurement method based on binocular stereo vision, which can optimize the parallax information of repeated texture and weak texture areas of water surface images, and improve the accuracy of water level value acquisition under complex lighting conditions.
[0006] Technical solution: The water level measurement method based on binocular stereo vision described in the present invention comprises the following steps:
[0007] Step 1: Select the binocular camera according to the actual measurement scene;
[0008] Step 2: Set up the binocular camera horizontally on the river bank, adjust the pitch angle so that the left and right views can cover the water surface area under the full range of water level, and use the binocular camera to synchronously obtain the water surface images of the left and right views;
[0009] Step 3, using the iteratively optimized semi-global SGM stereo matching method, first calculate the SAD and Census initial cost values of the water surface image pixel by pixel, make full use of the neighborhood information of the pixel points to reduce the abnormal brightness of the single pixel point caused by the water surface reflection; then, use the iterative scan line optimization algorithm to aggregate and optimize the initial cost value, extrapolate the cost value of the weak texture area from the rich texture area based on the smoothness and continuity of the water surface, and obtain the optimized cost value of the left and right water surface images, which improves the matching accuracy of the weak texture area, and selects the disparity value corresponding to the minimum optimized cost value for each pixel to obtain the initial disparity map; finally, based on the disparity consistency constraint, use the consistency detection and sub-pixel optimization method to optimize the initial disparity value, and output the final disparity map;
[0010] Step 4: Based on the known calibration results of the binocular camera, the three-dimensional point cloud coordinate value corresponding to each pixel of the water surface image is obtained by using the conversion relationship between parallax and depth;
[0011] Step 5: Based on the RANSAC method, the three-dimensional point cloud is processed by plane fitting to generate a horizontal plane equation;
[0012] Step 6: Calculate the distance from the optical center of the left camera to the horizontal plane to obtain the elevation value of the water surface relative to the binocular camera.
[0013] Furthermore, in step 1, the binocular stereo vision system is selected according to the actual measurement scene. When the depth measurement distance Z is the minimum measurement distance, in order to ensure that the common field of view of the binocular camera occupies at least r of the left or right field of view, the influence of the binocular camera focal length f and the field of view angle α on the baseline length B is analyzed according to formula (1). From the principle of binocular vision, formula (2) can be obtained. For Z, the independent variable is d, and the partial derivative of d is obtained to obtain formula (3):
[0014]
[0015]
[0016]
[0017] Where d is the parallax, which is multiplied by the parallax accuracy s according to formula (3) d , it is concluded that when the parallax accuracy is one pixel, the focal length f, baseline length B and measurement distance Z have an influence on the depth measurement accuracy s z In actual measurement scenarios, the range of baseline B is obtained based on the sounding accuracy being less than η.
[0018]
[0019] Furthermore, in step 2, the water surface images of the left and right views are synchronously acquired using a binocular camera. First, the binocular camera needs to be connected, the measurement time needs to be set, and then the left and right image sequences are synchronously captured to obtain the water surface images of the left and right views after epipolar correction.
[0020] Furthermore, the water surface images include water surface images with different lighting, water flow, and floating objects to verify the generalization and scene adaptability of the method.
[0021] Furthermore, in step 3, the improved semi-global SGM stereo matching method includes the following steps:
[0022] Step 31: Calculate the initial SAD cost value C of the water surface image pixel by pixel according to formula (5): SAD (p,d):
[0023]
[0024] Where d is the disparity, and I is the gray value of the pixel to be measured;
[0025] According to formula (6), the Census transformation value C of the pixel point is obtained s (p):
[0026]
[0027] Where I is the gray value at pixel p; Indicates bitwise connection; N p represents the neighborhood of pixel p; the function ξ(I(p),I(q)) is defined by formula (7):
[0028]
[0029] The Hamming distance between two bit strings is used to represent the Census cost of pixel p:
[0030] C Census (p,d)=Hamming(C ls (p),C rs (pd)), d∈[d min ,d max ] (8)
[0031] The initial cost value of pixel p is calculated according to formula (9):
[0032] C(p,d)=ρ(C Census (p,d),λ Census )+ρ(C SAD (p,d),λ SAD ),d∈[d min ,d max ] (9)
[0033] in, is the normalized cost value of pixel p, c is the SAD and Census cost value, and λ is the control parameter;
[0034] Step 32: After obtaining the initial cost value, the cost value is optimized by using a semi-global (SGM) algorithm, combining the optimization method of the global energy function, and using a dynamic programming strategy to aggregate the 8-path costs, and performing multiple iterations;
[0035] Step 33: using a winner-takes-all (WTA) algorithm, for each pixel, select the disparity value corresponding to the minimum cost value as the initial disparity, and obtain left and right disparity maps, whose sizes are consistent with the input original image;
[0036] Step 34: Obtain the disparity value D for the pixel point p in the left disparity map p , then the disparity of the corresponding same-name point in the right disparity map is D pd , according to formula (12), the left and right consistency of the initial disparity map is detected:
[0037]
[0038] When the disparity value between the same-name point pairs differs by more than 1 pixel, the pixel is marked as an invalid pixel and removed. Then, the sub-pixel optimization technology is used to further improve the disparity accuracy. The disparity optimization result is obtained by the quadratic curve interpolation method according to formula (13), and the final disparity map is output;
[0039]
[0040] Among them, D p is the disparity value of pixel p, C agg (p,d+1) and Cagg (p, d-1) are the aggregation costs of point p when the disparity is d+1 and d-1 respectively.
[0041] Furthermore, in step 32, the 8-path cost aggregation is performed using a dynamic programming strategy, and multiple iterations are performed, specifically including the following steps:
[0042] Step 321: Calculate the aggregation cost C for each of the eight directions. r (p,d);
[0043] Step 322: Get the aggregation cost C of pixel p agg (p,d);
[0044] Step 323: If the upper limit of the number of iterations is reached, go to step 33; otherwise, continue iterating;
[0045]
[0046] Where C1(p,d) is the cost of pixel p when the parallax is d, the second term is the smoothing term, C r (pr,d) refers to the aggregation cost of a pixel along the aggregation direction, C r (pr,d±1) refers to the aggregation cost value when the disparity value along the aggregation direction differs by less than 1 pixel. It refers to the minimum value of all cost values when the disparity value differs by more than 1 pixel. The third term is to ensure that the new path cost value does not exceed a certain value, that is, C r (p,d)≤C max +P2, finally, the aggregation cost of pixel p when the disparity is d is:
[0047]
[0048] Furthermore, in step 4, the three-dimensional coordinate values of the water surface image are calculated according to formula (14):
[0049]
[0050] Where B is the baseline length of the binocular camera, f is the focal length of the binocular camera, and (x, y) is the coordinate of point p in the image coordinate system.
[0051] Furthermore, in step 5, the RANSAC method is used to construct the water surface plane equation, including the following steps:
[0052] Step 51: randomly select three non-collinear points from the water surface three-dimensional point cloud coordinate data set S to determine a preliminary plane model Ax+By+Cz+D=0, where A, B, C, and D are coefficients of the model;
[0053] Step 52: Calculate each other data point s according to formula (15): j ∈S is the distance h from this plane, and a threshold τ is set. If h≤τ, then s j Recorded as interior points, the number of interior points is recorded as M i :
[0054]
[0055] Where I is the indicator function. When the condition s j The value is 1 when ≤τ holds, otherwise it is 0, and n is the total number of data in the data set S;
[0056] Step 53: According to formula (16), if the number of internal points of the current model is M i 'Exceeded the previous maximum number of internal points M i , then the updated optimal model parameters are A'x+B'y+C'z+D'=0;
[0057] Step 54, repeat the above steps until the preset number of iterations N is reached;
[0058] Step 55. Finally, the model with the largest number of inliers is selected as the final result.
[0059] Furthermore, in step 6, the distance from the optical center of the left camera to the water surface is calculated according to formula (17) to obtain the elevation value:
[0060]
[0061] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: the present invention analyzes and selects binocular camera parameters according to the requirements of measurement distance, measurement accuracy, etc., to match the actual application scenarios; in addition, the present invention has strong anti-interference ability, and meets the needs of immediate measurement under multiple scenarios such as different lighting, water flow, and floating objects, and only requires one binocular camera and a processing unit to complete the water level measurement; the present invention also optimizes the stereo matching method, adopts a cost calculation method that is more robust to brightness difference and image noise, and optimizes the cost aggregation algorithm to ensure that the algorithm complexity is reduced while the "stripe effect" is effectively reduced, and the above aggregation method is iterated to smooth the aggregation cost, thereby improving the accuracy of the aggregation algorithm and making the acquired water level value more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a schematic diagram of the method flow of the present invention.
[0063] Figure 2 Schematic diagram of the relationship between the baseline length and the field of view angle of the binocular camera of the present invention.
[0064] Figure 3This is a depth error variation curve obtained by the present invention.
[0065] FIG4( a ) is a water surface image of the left view after epipolar correction.
[0066] FIG4( b ) is a water surface image of the right view after epipolar correction.
[0067] Figure 5 Schematic diagram of the Census cost calculation method of the present invention.
[0068] Figure 6 Schematic diagram of the scan line optimization method of the present invention.
[0069] Figure 7 Schematic diagram of the winner-take-all (WTA) method of the present invention.
[0070] Figure 8 Schematic diagram of the sub-pixel optimization method of the present invention.
[0071] Fig. 9 Schematic diagram of the binocular camera system of the present invention.
[0072] Fig.10 It is a schematic diagram of the plane fitting principle of the present invention.
[0073] Fig.11 This is a layout diagram of the measured scene of the present invention.
[0074] Fig.12 This is a diagram of the horizontal plane fitting results of the present invention. DETAILED DESCRIPTION
[0075] like Figure 1 As shown, a water level measurement method based on binocular stereo vision includes the following steps:
[0076] S1: Select the binocular stereo vision system according to the actual measurement scene. When the depth measurement distance Z is within the range of 2 to 20m, According to formula (18), the influence of the focal length of the binocular camera f = 4 mm and the field of view angle α = 72° on the baseline length is analyzed, as follows: Figure 2 As shown, the baseline value range is B max ≤1.94m, and according to formula (19), the error analysis of the baseline length B applicable to the measurement distance of 20m is carried out to obtain the depth error change curve, as shown in Figure 3 The data shown in Table 1 are as follows. To ensure the measurement accuracy within 2 cm, take B min =0.83m, and combined with formula (18), the range of the baseline is 0.83m≤B≤1.94m;
[0077]
[0078]
[0079] Table 1 Depth error changes with baseline length
[0080]
[0081] S2: Fig. 9 As shown in FIG4 , the water surface images of the left and right views are synchronously acquired by using a binocular camera. First, the binocular camera needs to be connected, the measurement time needs to be set, and then the left and right image sequences need to be synchronously captured. The water surface images of the left and right views after epipolar correction are obtained as shown in FIG4 (a) and FIG4 (b).
[0082] S3: The semi-global (SGM) stereo matching method based on iterative optimization includes the following steps:
[0083] S3.1: Calculate the initial SAD cost value C of the water surface image pixel by pixel according to formula (20) SAD (p,d):
[0084]
[0085] Wherein, d is the disparity, and I is the gray value of the pixel to be measured.
[0086] According to formula (21), the Census transformation value C of the pixel point is obtained s (p):
[0087]
[0088] Where I is the gray value at pixel p; Indicates bitwise connection; N p represents the neighborhood of pixel p; the function ξ(I(p),I(q)) is defined by formula (22):
[0089]
[0090] The Hamming distance between two bit strings is used to represent the Census cost value of pixel p, such as Figure 5 As shown:
[0091] C Census (p,d)=Hamming(C ls (p),C rs (pd)), d∈[d min ,d max ] (twenty three)
[0092] The initial cost value of pixel p is calculated according to formula (24):
[0093] C(p,d)=ρ(C Census (p,d),λ Census )+ρ(C SAD (p,d),λ SAD ),d∈[d min ,d max ] (twenty four)
[0094] in, is the normalized cost value of pixel p, c is the SAD and Census cost value, and λ is the control parameter.
[0095] S3.2: After obtaining the initial cost value, the cost value is optimized by using the semi-global (SGM) algorithm. By combining the optimization method of the global energy function, the dynamic programming strategy is used to aggregate the 8-path costs, such as Figure 6 As shown, multiple iterations are performed, and the iteration steps are as follows:
[0096] (1) Calculate the aggregation cost C for each of the eight directions r (p,d);
[0097] (2) Get the aggregation cost C of pixel p agg (p,d);
[0098] (3) If the upper limit of the number of iterations is reached, go to S3.3, otherwise continue iterating;
[0099]
[0100] Where C1(p,d) is the cost of pixel p when the parallax is d, the second term is the smoothing term, C r (pr,d) refers to the aggregation cost of a pixel along the aggregation direction, C r (pr,d±1) refers to the aggregation cost value when the disparity value along the aggregation direction differs by less than 1 pixel. It refers to the minimum value of all cost values when the disparity value differs by more than 1 pixel. The third term is to ensure that the new path cost value does not exceed a certain value, that is, C r (p,d)≤C max +P2. Finally, the aggregation cost of pixel p when the disparity is d is:
[0101]
[0102] S3.3: The winner-takes-all (WTA) algorithm is used to select the disparity value corresponding to the minimum cost value for each pixel as the initial disparity, and the left and right disparity maps are obtained, whose size is consistent with the input original image, such as Figure 7 shown.
[0103] S3.4: Obtain the disparity value D for the pixel point p in the left disparity map p , then the disparity of the corresponding same-name point in the right disparity map is D pd , according to formula (27), the left and right consistency of the initial disparity map is detected:
[0104]
[0105] When the disparity value between the same-name point pairs exceeds 1 pixel, the pixel is marked as an invalid pixel and removed. Sub-pixel optimization technology is then used to further improve the disparity accuracy, such as Figure 8 As shown, according to formula (28), the disparity optimization result is obtained by the quadratic curve interpolation method, and the final disparity map is output.
[0106]
[0107] Among them, D p is the disparity value of pixel p, C agg (p,d+1) and C agg (p, d+1) are the aggregation costs of point p when the disparity is d+1 and d-1 respectively.
[0108] S4: Calculate the three-dimensional coordinate value of the water surface image according to formula (29):
[0109]
[0110] Where B = 0.120m is the baseline length of the binocular camera, f is the focal length of the binocular camera, and (x, y) is the coordinate of point p in the image coordinate system.
[0111] S5: Use the RANSAC method to construct the water surface plane equation, including the following steps:
[0112] S5.1: Randomly select three non-collinear points from the water surface three-dimensional point cloud coordinate data set S to determine a preliminary plane model Ax+By+Cz+D=0, where A, B, C, and D are coefficients of the model;
[0113] S5.2: Each other data point s j ∈S is the distance h from this plane, and a threshold τ is set. If h≤τ, then s j The number of inliers is denoted as M. i :
[0114]
[0115] S5.3: If the number of internal points in the current model is M i 'Exceeded the previous maximum number of internal points M i , then update the optimal model parameters;
[0116] S5.4: Repeat the above steps until the preset number of iterations N=100 is reached;
[0117] S5.5: Finally, the model with the largest number of internal points is selected as the final result, and the plane equation 1.00y-0.01z+1.06=0 is obtained, which corresponds to the first measured elevation value in Table 1. The schematic diagram is shown in Fig.10 shown.
[0118] S6: Calculate the distance from the optical center of the left camera to the water surface according to formula (31) to obtain the elevation value H. Calculate the water level value according to the camera position relationship, such as Fig.11 Finally, the measurement result is compared with the true value of the water level by formula (32). The test result with a difference less than 5% is marked as valid, that is, the test result is considered reliable. Otherwise, the test result is considered invalid, and the test result can be corrected later based on this result.
[0119]
[0120]
[0121] Among them, H real This is the distance from the camera to the water surface.
[0122] In order to verify the effectiveness of the method for water level detection, a scene with a water level of 1-5m was selected for testing. The test used the average of three elevation values measured by a laser rangefinder as the reference true value. The measurement results are shown in Table 2. The relative error is controlled within 3%. The visualization results of the fitted horizontal plane are shown in Fig.12 shown.
[0123] Table 2 Relative error of measurement results within 1-5m
[0124]
Claims
1. A water level measurement method based on binocular stereo vision, characterized in that: The steps include: Step 1: Select the binocular camera according to the actual measurement scene; Step 2: Set up the binocular camera horizontally on the river bank, adjust the pitch angle so that the left and right views can cover the water surface area under the full range of water level, and use the binocular camera to synchronously obtain the water surface images of the left and right views; Step 3, using the iteratively optimized semi-global SGM stereo matching method, first calculate the SAD and Census initial cost values of the water surface image pixel by pixel, make full use of the neighborhood information of the pixel points to reduce the abnormal brightness of the single pixel point caused by the water surface reflection; then, use the iterative scan line optimization algorithm to aggregate and optimize the initial cost value, extrapolate the cost value of the weak texture area from the rich texture area based on the smoothness and continuity of the water surface, and obtain the optimized cost value of the left and right water surface images, which improves the matching accuracy of the weak texture area, and selects the disparity value corresponding to the minimum optimized cost value for each pixel to obtain the initial disparity map; finally, based on the disparity consistency constraint, use the consistency detection and sub-pixel optimization method to optimize the initial disparity value, and output the final disparity map; Step 4: Based on the known calibration results of the binocular camera, the three-dimensional point cloud coordinate value corresponding to each pixel of the water surface image is obtained by using the conversion relationship between parallax and depth; Step 5: Based on the RANSAC method, the three-dimensional point cloud is processed by plane fitting to generate a horizontal plane equation; Step 6: Calculate the distance from the optical center of the left camera to the horizontal plane to obtain the elevation value of the water surface relative to the binocular camera.
2. The water level measurement method based on binocular stereo vision as claimed in claim 1, characterized in that: In step 1, the binocular stereo vision system is selected according to the actual measurement scene. When the depth measurement distance Z is the minimum measurement distance, in order to ensure that the common field of view of the binocular camera occupies at least r of the left or right field of view, the influence of the binocular camera focal length f and the field of view angle α on the baseline length B is analyzed according to formula (1). Formula (2) is obtained from the principle of binocular vision. For Z, the independent variable is d, and the partial derivative of d is obtained to obtain formula (3): Where d is the parallax, which is multiplied by the parallax accuracy s according to formula (3) d It is concluded that when the parallax accuracy is one pixel, the focal length f, baseline length B and measurement distance Z have an influence on the depth measurement accuracy s z In actual measurement scenarios, the range of baseline B is obtained based on the sounding accuracy being less than η.
3. The water level measurement method based on binocular stereo vision as claimed in claim 1, characterized in that: In step 2, the water surface images of the left and right views are synchronously acquired using a binocular camera. First, the binocular camera needs to be connected, the measurement time needs to be set, and then the left and right image sequences are synchronously captured to obtain the water surface images of the left and right views after epipolar correction.
4. The water level measurement method based on binocular stereo vision as claimed in claim 3, characterized in that: Water surface images include those with different lighting, water flow, and floating objects to verify the generalization and scene adaptability of the method.
5. The water level measurement method based on binocular stereo vision as claimed in claim 1, characterized in that: In step 3, the improved semi-global SGM stereo matching method includes the following steps: Step 31: Calculate the initial SAD cost value C of the water surface image pixel by pixel according to formula (5): SAD (p,d): Where d is the disparity, and I is the gray value of the pixel to be measured; According to formula (6), the Census transformation value C of the pixel point is obtained s (p): Where I is the gray value at pixel p; Indicates bitwise connection; N p represents the neighborhood of pixel p; the function ξ(I(p),I(q)) is defined by formula (7): The Hamming distance between two bit strings is used to represent the Census cost of pixel p: C Census (p,d)=Hamming(C ls (p),C rs (p-d)),d∈[d min ,d max ] (8) The initial cost value of pixel p is calculated according to formula (9): C(p,d)=ρ(C Census (p,d),λ Census )+ρ(C SAD (p,d),λ SAD ),d∈[d min ,d max ] (9) in, is the normalized cost value of pixel p, c is the SAD and Census cost value, and λ is the control parameter; Step 32: After obtaining the initial cost value, perform cost value optimization processing, adopt the semi-global SGM algorithm idea, combine the optimization method of the global energy function, use the dynamic programming strategy to aggregate the 8-path costs, and perform multiple iterations; Step 33: Use the winner-takes-all WTA algorithm to select the disparity value corresponding to the minimum cost value for each pixel as the initial disparity, and obtain the left and right disparity maps, whose sizes are consistent with the input original image; Step 34: Obtain the disparity value D for the pixel point p in the left disparity map p , then the disparity of the corresponding same-name point in the right disparity map is D pd , according to formula (12), the left and right consistency of the initial disparity map is detected: When the disparity value between the same-name point pairs differs by more than 1 pixel, the pixel is marked as an invalid pixel and removed. Then, the sub-pixel optimization technology is used to further improve the disparity accuracy. The disparity optimization result is obtained by the quadratic curve interpolation method according to formula (13), and the final disparity map is output; Among them, D p is the disparity value of pixel p, C agg (p,d+1) and C agg (p, d-1) are the aggregation costs of point p when the disparity is d+1 and d-1 respectively.
6. The water level measurement method based on binocular stereo vision as claimed in claim 5, characterized in that: In step 32, the 8-path cost aggregation is performed using a dynamic programming strategy, and multiple iterations are performed, specifically including the following steps: Step 321: Calculate the aggregation cost C for each of the eight directions. r (p,d); Step 322: Get the aggregation cost C of pixel p agg (p,d); Step 323: If the upper limit of the number of iterations is reached, go to step 33; otherwise, continue iterating; Where C1(p,d) is the cost of pixel p when the parallax is d, the second term is the smoothing term, C r (pr,d) refers to the aggregation cost of a pixel along the aggregation direction, C r (pr,d±1) refers to the aggregation cost value when the disparity value along the aggregation direction differs by less than 1 pixel. It refers to the minimum value of all cost values when the disparity value differs by more than 1 pixel. The third term is to ensure that the new path cost value does not exceed a certain value, that is, C r (p,d)≤C max +P2, finally, the aggregation cost of pixel p when the disparity is d is:
7. The water level measurement method based on binocular stereo vision as claimed in claim 1, characterized in that: In step 4, the three-dimensional coordinate values of the water surface image are calculated according to formula (14): Where B is the baseline length of the binocular camera, f is the focal length of the binocular camera, and (x, y) is the coordinate of point p in the image coordinate system.
8. The water level measurement method based on binocular stereo vision as claimed in claim 1, characterized in that: In step 5, the RANSAC method is used to construct the water surface plane equation, which includes the following steps: Step 51: randomly select three non-collinear points from the water surface three-dimensional point cloud coordinate data set S to determine a preliminary plane model Ax+By+Cz+D=0, where A, B, C, and D are coefficients of the model; Step 52: Calculate each other data point s according to formula (15): j ∈S is the distance h from this plane, and a threshold τ is set. If h≤τ, then s j Recorded as interior points, the number of interior points is recorded as M i : Where I is the indicator function. When the condition s j The value is 1 when ≤τ holds, otherwise it is 0, and n is the total number of data in the data set S; Step 53: According to formula (16), if the number of internal points of the current model is M i 'Exceeded the previous maximum number of internal points M i , then the updated optimal model parameters are A'x+B'y+C'z+D'=0; Step 54, repeat the above steps until the preset number of iterations N is reached; Step 55. Finally, the model with the largest number of inliers is selected as the final result.
9. The water level measurement method based on binocular stereo vision as claimed in claim 1, characterized in that: In step 6, the distance from the optical center of the left camera to the water surface is calculated according to formula (17) to obtain the elevation value:
Citation Information
Patent Citations
Underwater point cloud acquisition method based on binocular camera
CN111563921A
Binocular camera-based ship height measurement system and method
CN113223075A
Method for measuring height and propagation speed of Yantang river eagle based on unmanned aerial vehicle
CN114396921A
Three-dimensional reconstruction method based on binocular stereo matching
CN116245928A
Ore crushing method based on binocular stereoscopic visual perception
CN117876491A
Cited By
Water depth detection method and device, electronic equipment and storage medium
CN120388276A
Wave field reconstruction method based on optical perception
US20250191284A1