Water level vision measurement method based on dynamic monitoring

Through a water level measurement system based on spatio-temporal feature coupling, the camera is used to collect water gauge images and perform feature extraction and processing, which solves the problems of low automation and susceptibility to environmental interference in the existing technology, and achieves efficient and accurate water level monitoring, which is suitable for Monitoring of various waters.

CN118548955APending Publication Date: 2024-08-27CHANGJIANG SPATIAL INFORMATION TECH ENG CO LTD (WUHAN)
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410313166.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-19
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

Existing water level monitoring methods have problems such as low automation, poor real-time performance, high equipment cost, and measurement accuracy that is easily affected by the environment. In particular, image method measurement is easily affected by illumination, reflection, blur, and water transparency.

Method used

A water level measurement system based on spatiotemporal feature coupling is used to collect water gauge images through a camera, using grayscale differences and time features to obtain water level readings. Homography matrix solution, histogram equalization, OSTU automatic threshold segmentation and pixel gradient second-order are used. The guidance method overcomes interferences such as illumination, reflection, blur, etc., and realizes automatic water level recognition.

Benefits of technology

It improves the automation of water level monitoring, overcomes the effects of illumination, reflection, transparency and other unfavorable environments, and achieves efficient and accurate water level measurement. It is suitable for monitoring various waters and has broad engineering application prospects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118548955A
    Figure CN118548955A
Patent Text Reader

Abstract

The invention relates to a water gauge water line vision measurement method and system, and the method is characterized in that a fixed camera is installed near a water area, continuous video frames of a water gauge area are obtained, and the corresponding pixel value of a water level in a video is calculated by using the inherent characteristics of imaging of a water surface boundary in time and space. Then, by means of perspective transformation, an imaging plane of the water gauge in the picture is mapped to an actual physical plane through perspective transformation, the relation between pixel coordinates and actual physical coordinates is obtained, and then the water level pixel coordinates are converted into actual water level values.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a water level visual measurement method based on dynamic monitoring, and belongs to the field of water level monitoring. Background Art

[0002] Water level is one of the basic elements of hydrological observation. Water level monitoring is an important means of flood control and water conservancy project safety scheduling, and is a prerequisite for waterway services and maintenance management. Therefore, continuous and reliable monitoring of water level values ​​is of great significance to the management and comprehensive governance of water resources. Manual direct reading of water gauges is the most direct and simple water level monitoring method. However, this method requires manual regular observation, has a low degree of automation, poor real-time performance, and is easily affected by subjective factors of technicians. Other non-manual observation methods include contact measurements such as pressure sensors and non-contact measurements such as ultrasonic, radar, and satellite remote sensing. However, these measurements generally have the disadvantages of high equipment and installation costs, measurement accuracy is easily affected by ambient temperature, sediment content, and on-site control structures, and requires regular maintenance by staff.

[0003] In recent years, with the development of network technology and visual technology, the image method has provided a basis for measuring water level. The image method for measuring water level has no temperature drift and water quality requirements, and has the advantages of low installation and maintenance costs, efficient measurement methods, and easy verification. However, it also faces some difficulties inherent in the image method, such as being easily affected by lighting, reflections, blur, and water transparency.

[0004] Therefore, in order to overcome the shortcomings of existing image method technology, a water level visual measurement method based on the coupling of temporal and spatial features was developed. Summary of the invention

[0005] In order to overcome the shortcomings of existing image method technology, the embodiment of the present application provides a water level measurement system based on the coupling of time and space features. A specific water gauge area is segmented, and the water level line reading of the water gauge is obtained by using the grayscale difference of the graphics above and below the water level boundary (spatial feature) and the characteristic that the grayscale value below the water level boundary remains unchanged within a certain time range (3 seconds) (temporal feature).

[0006] The algorithm has good robustness and can overcome the influence of adverse environments such as lighting, reflection, blur, and water transparency, and has high practical value. The technical solution is as follows:

[0007] Arrange the camera and water level gauge, ensure that the camera is fixed and the water level gauge image can be clearly seen after focusing, and build a measurement system.

[0008] Continuously collect multiple frames of water gauge images and select 4 feature points in the water gauge area. Based on these 4 points, find the final 4 key points.

[0009] According to the previous step, the pixel coordinates of the four feature points are obtained; the four points of the front view are known (that is, the four corner points of the matrix), and each point has the following transformation relationship:

[0010]

[0011] The matrix [H] in the above formula is the homography matrix. After expanding the formula, we can get the following two equations:

[0012] x2(H 31 x1+H 32 y1+H 33 )=H 11 x1+H 12 y1+H 13

[0013] y2(H 31 x1+H 32 y1+H 33 )=H 21 x1+H 22 y1+H 23

[0014] The homogeneous coordinate system is used here, so H 33 = 1, so there are 8 unknowns in total. Two equations can be constructed for each point, and 8 equations can be constructed for 4 points, which means that the homography matrix [H] with a unique solution can be obtained.

[0015] The corrected image is grayed out and then stored in memory. The size of the image is W×H, where the width is W and the height is H.

[0016] Histogram equalization is used to enhance the contrast of graphics.

[0017] The OSTU automatic threshold segmentation algorithm is used to binarize the grayscale image.

[0018] In each column of the statistical graph, the ratio of the number of elements with a pixel value of 255 to the number of elements in the entire column is:

[0019] W is the width of the image, H is the height of the image, and P(i, c) represents the pixel value of the i-th row and c-th column of the image.

[0020] The 3σ method is used to remove outliers in Ratio. Uniformity is defined as the variance of Ratio.

[0021] If the uniformity is less than the threshold, the threshold found by OSTU is considered reasonable and the subsequent operations can be performed; otherwise, OSTU processing needs to be performed again.

[0022] For the graphics that meet step

[0017] , the pixel values ​​corresponding to the water level are calculated using the equal pixel block grayscale mean difference method, the unequal pixel block grayscale mean difference method, and the pixel gradient second-order derivative method.

[0023] The specific process of equal pixel block grayscale mean difference method is as follows:

[0024] Roughly find the waterline position. Define the width of the pixel block as W (the same width as the graph) and the height as h. The pixel block covers the [1, h] row of the graph for the first time, the [h+1, 2h] row of the graph for the second time, and the [(n-1)h+1, nh] row of the graph for the nth time. Any two covers do not overlap, and so on.

[0025] By calculating the mean of the pixels in the coverage area each time, we can get a mean sequence

[0026]

[0027] Subtract the two values ​​before and after the mean sequence and take the absolute value to get a mean difference sequence Dif corse .

[0028] Find Dif corse The position corresponding to the maximum value Pos h , the rough positioning water level position is: Id h =Pos h ×h

[0029] The value range of pixel block height h is [5, 10], and a sequence ID of length 6 can be obtained. corse =[Id5, Id6, Id7, Id8, Id9, Id 10 ], calculate the sequence ID corse The maximum value of and the corresponding value of h corse .

[0030] Find the water level position in detail. Similarly, set the pixel block with a width of W and a height of h1. The pixel block covers the figure for the first time. Row, the second time to cover the graphics Row, the last time the graphics are covered row, any two overlaps cover h1-1 rows, and so on.

[0031] By calculating the mean of pixels in each coverage area, we can get a mean sequence M fine =[m f1 , m f2 , ..., m fN′ ], fN′=2h1.

[0032]

[0033] Subtract the two values ​​before and after the mean sequence and take the absolute value to get a mean difference sequence Dif fine .

[0034] Find Dif fine The position corresponding to the maximum value The precise positioning water level position is:

[0035]

[0036] The value range of pixel block height h1 is [h corse , 20], we can get a length of 21-h corse Water level series Calculate Sequence ID fine The maximum value of That is the water level pixel value w calculated by this method 1s .

[0037]

[0038] On the corrected image, select N n Control points (N n ≥4).

[0039] Find the image on N n The control points correspond to the physical coordinates of the actual water gauge.

[0040] Solve the projection perspective equation and get the transformation matrix.

[0041] Using the transformation matrix, the water level pixel coordinates WL P , converted into the actual corresponding water level WL.

[0042] Compared with the prior art, the advantages of the present invention are: the method has a high degree of automation, can automatically identify the water level after simple calibration, can overcome the influence of adverse environments such as lighting, reflections, transparency, etc., is suitable for water level monitoring in various waters, and has broad engineering application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 Flow chart of the water level visual measurement method for dynamic monitoring in an embodiment of the present invention;

[0044] Figure 2 This is a real-life shot of a water gauge on site in an embodiment of the present invention;

[0045] Figure 3a This is the image before water ruler correction; Figure 3b To select feature points in the water gauge area, feature point selection diagram; Figure 3c This is the image after water gauge correction;

[0046] Figure 4a is the water gauge grayscale image; Figure 4b It is the image after water ruler binarization;

[0047] Figure 5 The pixel value of the water level is obtained by using the equal pixel block grayscale mean difference method based on the spatial characteristics of the water level line in the image.

[0048] Figure 6 To select control points, pixel coordinates are converted to actual water level values. DETAILED DESCRIPTION

[0049] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0050] Step 1: Capture the water gauge portion of the captured image

[0051] like Figure 3b As shown, in Figure 2 Four feature points are selected near the water gauge area: P a , P b , P1, P2. To make P a , P b The line connecting the two points is parallel to the water level line, the line connecting the two points P1 and P2 is parallel to the long side of the water gauge, and the two points P1 and P2 are as close to the upper and lower endpoints of the water gauge as possible. a , P b The slope of the line connecting the two points is K. A ray with a slope of K is drawn through points P1 and P2, intersecting the right contours P3 and P4 of the water gauge. The final four feature points can be obtained: P1, P2, P3, and P4.

[0052] Figure 3a That is, through the above 4 feature points, from Figure 2 Step 2: Correct the water gauge image

[0053] The pixel coordinates of the four feature points are known, and the four points of the front view are also known (that is, the four corner points of the matrix). Each point has the following mapping relationship:

[0054]

[0055] Among them, x1 and y1 are the pixel coordinates of point P1, and x′1 and y′1 are the coordinates of the upper left corner of the front view (0,0).

[0056] The matrix [H] in the above formula is the homography matrix. After expanding the formula, we can get the following two equations:

[0057] x′1(H 31 x1+H32 y1+H 33 )=H 11 x1+H 12 y1+H 13

[0058] y′1(H 31 x1+H 32 y1+H 33 )=H 21 x1+H 22 y1+H 23

[0059] The homogeneous coordinate system is used here, so H 33 = 1, so there are 8 unknowns in total. Two equations can be constructed for each point, and 8 equations can be constructed for 4 points, which means that the homography matrix [H] with a unique solution can be obtained.

[0060] After obtaining the homography matrix, Figure 3a By transforming each pixel on the plane, we can get Figure 3c The front view of the water gauge shown (corrected view).

[0061] Step 3: Image grayscale and image enhancement

[0062] The corrected image is grayed out and then Gaussian filtered to remove some environmental noise. In order to highlight the characteristics of the water level boundary, the filtered image is histogram equalized. Figure 4a This is the result after equalization.

[0063] Step 4: Image binarization.

[0064] The OSTU automatic threshold segmentation algorithm is used to binarize the graphics.

[0065] Calculate the uniformity of a binary image:

[0066] Statistical graph for each column, the ratio of the number of elements with a pixel value of 255 to the number of elements in the entire column:

[0067]

[0068] Where W is the width of the image, H is the height of the image, and P(i, c) represents the pixel value of the i-th row and c-th column of the image. The 3σ method is used to remove abnormal values ​​in Ratio.

[0069] Define uniformity = variance of Ratio;

[0070] If the uniformity is less than the threshold, the threshold found by OSTU is considered reasonable and the subsequent operations can be performed; otherwise, OSTU processing needs to be performed again.

[0071] Figure 4b This is the result after binarization.

[0072] Step 5: Calculate the water level pixel value based on the spatial characteristics of the water level line in the image.

[0073] Among them, the specific implementation plan of the equal pixel block grayscale mean difference method is:

[0074] Roughly find the waterline position. Define the width of the pixel block as W (the same width as the graph) and the height as h. The pixel block covers the [1, h] row of the graph for the first time, the [h+1, 2h] row of the graph for the second time, and the [(n-1)h+1, nh] row of the graph for the nth time. Any two covers do not overlap, and so on.

[0075] By calculating the mean of the pixels in the coverage area each time, we can get a mean sequence

[0076]

[0077] Subtract the two values ​​before and after the mean sequence and take the absolute value to get a mean difference sequence Dif corse .

[0078] Find Dif corse The position corresponding to the maximum value Pos h , the rough positioning water level position is:

[0079] Id h =Pos h ×h

[0080] The value range of pixel block height h is [5,10], and a sequence ID of length 6 can be obtained. corse =[Id5, Id6, Id7, Id8, Id9, Id 10 ], calculate the sequence ID corse The maximum value of and the corresponding value of h corse .

[0081] Find the water level position in detail. Similarly, set the pixel block with a width of W and a height of h1. The pixel block covers the figure for the first time. Row, the second time to cover the graphics Row, the last time the graphics are covered row, any two overlaps cover h1-1 rows, and so on.

[0082] By calculating the mean of pixels in each coverage area, we can get a mean sequence M fine =[m f1 , m f2 ,......,mfN′ ], fN′=2h1.

[0083]

[0084] Subtract the two values ​​before and after the mean sequence and take the absolute value to get a mean difference sequence Dif fine .

[0085] Find Dif fine The position corresponding to the maximum value The precise positioning water level position is:

[0086]

[0087] The value range of pixel block height h1 is [h corse , 20], we can get a length of 21-h corse Water level series Calculate Sequence ID fine The maximum value of That is the water level pixel value w calculated by the first method 1s .

[0088]

[0089] Step 6: Select control points and calculate the projection perspective matrix between the water level pixel plane and the water level physical plane. P Converted to actual water level value WL.

[0090] like Figure 6 As shown in Figure 2, select a control point (u, v) from the rectified image and find the point (X w ,Y w ,Z w ). The more control points there are, the higher the accuracy.

[0091] In the present invention, let the captured bridge deck be X w -Y w Plane, vertical bridge surface upward is Z w The positive direction of the axis. The following transformation relationship can be constructed based on the basic principles of photogrammetry:

[0092]

[0093] Among them, (u i , v i ) is the coordinate of the ith control point, (X wi , Y wi ,Z wi ) is the coordinate of the i-th control point in the template coordinate system. wi , eliminating the unknown parameter Zci , simplified to:

[0094] X wi m 11 +Y mi m 12 +m 14 -X wi m 31 u i -Y wi m 32 u i =m 34 u i

[0095] X wi m 21 +Y wi m 22 +m 24 -X wi m 31 υ i -Y wi m 32 υ i =m 34 υ i

[0096] The above formula can be transformed into:

[0097]

[0098]

[0099] Among them, M is the transformation matrix between the correction graphics coordinate system and the template coordinate system, it can be seen that:

[0100]

[0101] For one feature point, the above two equations can be established. For the selected n feature points, 2n equations can be established. To solve the 8 unknown parameters in the matrix M, at least 4 feature points are required. Considering the actual accuracy, it is usually appropriate to select more than 6 feature points.

[0102] By solving the matrix M, we can get the mapping relationship between pixel coordinates and template coordinates, thereby completing the conversion of water level pixel coordinates into actual water level values.

Claims

1. A visual water level measurement method for dynamic monitoring, It is characterized in that The following steps are involved: Step S1: Arrange the camera and the water gauge, ensure that the camera is fixed and the water gauge image can be clearly seen after focusing, and build a measurement system. Step S2: continuously collect multiple frames of water gauge images and correct the tilted water gauge images. Step S3: grayscale the corrected image and store the grayscale image. Step S4: Perform Gaussian filtering and image enhancement processing on the grayscale image. Step S5: Binarize the image and calculate the uniformity of the binary image. If the uniformity is satisfied, start the process of step S6, otherwise continue the binarization process. Step S6: Calculate the pixel value corresponding to the water level using the spatial characteristics of the water level interface. Step S7: Cluster the results obtained in step S6 to eliminate some deviations. Step S8: Calculate the pixel value corresponding to the water level by using the characteristics of the water level interface in the time series. Step S9: Couple the results of temporal features and spatial features to calculate the final water level pixel value. Step S10: Calculate the projection perspective matrix between the water gauge pixel plane and the water gauge physical plane, and convert the pixel water level into the actual water level value.

2. According to the water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that The step S2 specifically includes the following sub-steps: Step S21: dividing the video into continuous image frames; Step S22: When selecting four feature points, ensure that two of them P a , P b The connecting line is parallel to the water level line, and the other two points P 1 , P 2 The connecting line is parallel to the long side of the water ruler, and the two points are close to the upper and lower endpoints of the water ruler; according to the water ruler pixel width w ab and P a , P b The slope of the two points gives P 3 , P 4 ; Step S23: correcting the tilted water gauge image; According to the previous step, the pixel coordinates of the four feature points are obtained; the four points of the front view are known, that is, the four corner points of the matrix, and each point has the following transformation relationship: The matrix [H] in the above formula is the homography matrix. After expanding the formula, we get the following two equations: x 2 (H 31 x 1 +H 32 y 1 +H 33 )=H 11 x 1 +H 12 y 1 +H 13 y 2 (H 31 x 1 +H 32 y 1 +H 33 )=H 21 x 1 +H 22 y 1 +H 23 The homogeneous coordinate system is used, let H 33 =1, so there are 8 unknowns in total; construct 2 equations for each point, and 8 equations for 4 points, and get the homography matrix [H] of the unique solution.

3. The water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that The step S3 is to grayscale the corrected image and then store it in the memory.

4. The water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that The step S4 adopts histogram equalization to enhance the contrast of the graphics.

5. The water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that The step S5 is specifically as follows: Step S51: using the OSTU automatic threshold segmentation algorithm to binarize the grayscale image; Step S52: Calculate uniformity; In each column of the statistical graph, the ratio of the number of elements with a pixel value of 255 to the number of elements in the entire column is: Where W is the width of the image, H is the height of the image, and P(i, c) represents the pixel value of the i-th row and c-th column of the image. The 3σ method is used to eliminate outliers in Ratio; Define uniformity = variance of Ratio; If the uniformity is less than the threshold, the threshold found by OSTU is considered reasonable and the subsequent operations can be performed; otherwise, OSTU processing needs to be performed again.

6. The water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that In step S6, three methods are used to extract the spatial characteristics of the water level interface, specifically: S61: grayscale average difference of equal pixel blocks. Roughly find the waterline position. Define the width of the pixel block as W (the same width as the graph) and the height as h. The pixel block covers the [1, h] row of the graph for the first time, the [h+1, 2h] row of the graph for the second time, and the [(n-1)h+1, nh] row of the graph for the nth time. Any two covers do not overlap, and so on. By calculating the mean of pixels in each coverage area, we can get a mean sequence M corse =[m c1 , m c2 ,......,m cN′ ], Subtract the two values ​​before and after the mean sequence and take the absolute value to get a mean difference sequence Dif corse . Find Dif corse The position corresponding to the maximum value Pos h , the rough positioning water level position is: Id h =Pos h ×h The value range of pixel block height h is [5,10], and a sequence ID of length 6 can be obtained. corse =[Id 5 、Id 6 、Id 7 、Id 8 、Id 9 、Id 10 ], calculate the sequence ID corse The maximum value of and the corresponding value of h corse . Find the water level position in detail. Similarly, set the pixel block with width W and height h 1 The pixel block covers the graphic for the first time. Row, the second time to cover the graphics Row, the last time the graphics are covered Rows, any two covers overlap h 1 -1 row, and so on. By calculating the mean of pixels in each coverage area, we can get a mean sequence M fine =[m f1 , m f2 ,......,m fN′ ], fN′=2h 1 . Subtract the two values ​​before and after the mean sequence and take the absolute value to get a mean difference sequence Dif fine . Find Dif fine The position corresponding to the maximum value The precise positioning water level position is: Pixel block height h 1 The value range is [h corse ,20], we can get a length of 21-h corse Water level series Calculate Sequence ID fine The maximum value of That is the water level pixel value ω calculated by the first method 1s .

7. The water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that The clustering in step S7 is specifically as follows: S71: Select the number of cluster centers to be 2; S72: After clustering, the data is divided into two categories, A and B. The average value of the category with more samples is selected as the final output value of the sequence; S73: If the number of samples in two categories is the same, the category with the larger mean is selected as the output.

8. The water level visual measurement method based on dynamic monitoring according to claim 1, It is characterized in that Convert pixel coordinates to actual water level values. Specifically: S81: Select N control points (N≥4) on the image corrected in step S2. S82: Find the N control points in step S81, corresponding to the physical coordinates of the actual water gauge. S83: Solve the projection perspective equation to obtain the transformation matrix. S84: Using the transformation matrix, convert the water level pixel coordinates of the water gauge into the actual corresponding water level.

Citation Information

Patent Citations

  • Video object tracking cutting method using Snake profile model

    CN102129691A

  • Intelligent camera embedded with liquid level real-time detection function

    CN109660709A

  • Water gauge waterline visual detection method suitable for complex illumination conditions

    CN109764930A

  • Static obstacle grounding contour line multi-frame fusion method and device and medium

    CN115512316A

  • Method for detecting stream water surface using temporal changing features of grayscale intensities of spatio-temporal images

    KR101500267B1