Water level photography monitoring method and device for eliminating water surface inverted image interference

By performing distortion correction and grayscale brightness classification on the water ruler image, combining adaptive cue points and SAM image segmentation model, the water level monitoring error caused by water surface reflection interference is solved, and high-precision and stable water level monitoring is achieved, which is suitable for water level observation in complex environments.

CN120259648APending Publication Date: 2025-07-04SUN YAT SEN UNIV
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510241621.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing water level photography monitoring methods lack accuracy and stability when dealing with water surface reflection interference. Especially in complex environments, traditional methods are difficult to effectively distinguish the water surface line from the reflection boundary, resulting in large errors in water level observation values, limiting the universality and the number of available observation samples.

Method used

By performing distortion correction and grayscale brightness classification on the water ruler image, the initial water surface line is identified, and the adaptive cue point and SAM image segmentation model based on the cross attention mechanism are used to segment the water ruler mask to establish a water body water level recognition model to realize real-time monitoring of water level.

Benefits of technology

It effectively overcomes the interference of water surface reflection, improves the accuracy of water level monitoring and the number of observed samples, ensures stability and reliability in complex environments, and is suitable for water level monitoring under different river sections and terrain conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259648A_ABST
    Figure CN120259648A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of hydrological survey, in particular to a water level photography monitoring method and device for eliminating water surface inverted image interference, and the method comprises the steps: carrying out the distortion correction of an original water gauge image, and obtaining a distortion correction image; classifying the distortion correction images to obtain day and night classification images; performing water surface line detection on the day and night classification images, identifying an initial water surface line, and correcting the initial water surface line to obtain a corrected water surface line; adaptively positioning a water gauge foreground prompt point and a non-water gauge background prompt point based on the corrected water surface line; inputting the day and night classification image, the water gauge foreground prompt point and the non-water gauge background prompt point into an SAM image segmentation model based on a cross attention mechanism to obtain a water gauge mask segmentation result; and obtaining the water level of the water body according to the water gauge mask segmentation result and the water level identification model. Real-time monitoring of the water level of the water body is achieved through the technologies of the self-adaptive prompt points, the image segmentation model and the like, and interference of water surface reflection on water level measurement is effectively overcome.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hydrological measurement, and particularly to a water level photography monitoring method and device for eliminating the interference of water surface reflection. Background Art

[0002] In the fields of hydrology and environmental monitoring, non-contact water level photogrammetry methods are mainly divided into two categories: feature recognition and pixel intensity analysis. However, both of these two methods face the problem of water surface reflection interference in practical applications. Among them, the feature recognition method identifies the digital or symbolic features on the water level scale through deep learning and template matching models to obtain the water level value. Although this method improves the automation degree of water level measurement to a certain extent, its water level resolution is often limited by the symbols on the scale. More importantly, due to the differences in the specifications and designs of different water gauges, the established recognition models are often difficult to be directly migrated and applied to water gauges of different specifications, which greatly limits its generality and practicality.

[0003] On the other hand, the pixel intensity analysis method locates the water surface line by analyzing the pixel intensity difference between the water body and the water gauge background in the image, and then converts the water surface line coordinates into the water level observation value in the real-world coordinate system. However, in actual complex scenarios, there is often strong reflection interference near the water surface line. Since the pixel intensity distributions of the water gauge body and the reflection area are highly similar, traditional edge detection algorithms are difficult to effectively distinguish the real water surface line from the reflection boundary, resulting in an underestimation or overestimation of the water level observation value. Especially in complex and changeable natural environments, the interference of water surface reflection is often more significant, posing a great challenge to water level photography monitoring. Therefore, the traditional pixel intensity analysis method performs poorly in dealing with such scenarios, not only affecting the accuracy of water level measurement, but also limiting the number of available observation samples.

[0004] Therefore, how to effectively eliminate the interference of water surface reflection and improve the accuracy and stability of water level photography monitoring has become an urgent problem to be solved currently. Summary of the Invention

[0005] To solve the above technical problems, the present invention provides a water level photography monitoring method and device for eliminating the interference of water surface reflection.

[0006] In the first aspect, the present invention provides a water level photography monitoring method for eliminating the interference of water surface reflection, and the method includes the following steps:

[0007] Obtain the original water gauge image, and perform distortion correction on the original water gauge image to obtain a distortion-corrected image;

[0008] Calculate the grayscale spatial average brightness value of the distortion-corrected image, and classify the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image; the day-night classification image includes a night distortion-corrected image and a day distortion-corrected image;

[0009] Perform water surface line detection on the day-night classification image respectively, identify the corresponding initial water surface line, and correct the initial water surface line based on the water level continuous change feature of multiple consecutive frames of day-night classification images within the period to be observed to obtain a corrected water surface line;

[0010] Based on the corrected water surface line, adaptively locate the water gauge foreground prompt point and the non-water gauge background prompt point in the day-night classification image;

[0011] Construct a SAM image segmentation model based on the cross-attention mechanism, and input the day-night classification image, the water gauge foreground prompt point, and the non-water gauge background prompt point into the SAM image segmentation model to obtain a water gauge mask segmentation result;

[0012] Obtain the water body water level according to the water gauge mask segmentation result and the pre-established water body water level recognition model.

[0013] In a further embodiment, the step of performing distortion correction on the original water gauge image to obtain a distortion-corrected image includes:

[0014] According to the four corner coordinates of the water gauge boundary in the original water gauge image, map the original water gauge image to the standard space coordinate system; wherein, the water gauge edge in the standard space coordinate system is parallel or perpendicular to the actual wall vertical reference line;

[0015] According to the target four corner coordinates of the original water gauge image in the standard space coordinate system, calculate the perspective transformation matrix through the perspective transformation algorithm;

[0016] Use the perspective transformation matrix to resample the original water gauge image to obtain a distortion-corrected image.

[0017] In a further embodiment, the step of calculating the grayscale spatial average brightness value of the distortion-corrected image and classifying the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image includes:

[0018] Obtain the RGB image data of the distortion-corrected image, and convert the RGB image data of the distortion-corrected image into grayscale image data;

[0019] Calculate the intensity mean value of all pixels in the grayscale image data to obtain the grayscale spatial average brightness value;

[0020] Compare the average luminance value of the grayscale space with a preset luminance threshold, and classify the distortion-corrected image according to the comparison result to obtain a day-night classification image.

[0021] In a further embodiment, the step of classifying the distortion-corrected image according to the comparison result to obtain a day-night classification image includes:

[0022] When the average luminance value of the grayscale space is lower than the preset luminance threshold, determine the distortion-corrected image as a night distortion-corrected image;

[0023] When the average luminance value of the grayscale space is not lower than the preset luminance threshold, determine the distortion-corrected image as a day distortion-corrected image.

[0024] In a further embodiment, when the day-night classification image is a night distortion-corrected image, the step of respectively performing water line detection on the day-night classification image to identify the corresponding initial water line includes:

[0025] Generate a night image region of interest in the region covering the position where the water gauge is located according to the grayscale image data of the night distortion-corrected image;

[0026] Perform Canny edge detection on the night image region of interest to identify strong edge pixel points, weak edge pixel points, and non-edge pixel points;

[0027] Use the hysteresis threshold method to perform edge connection along the gradient direction starting from the strong edge pixel points, mark the weak edge pixel points connected to the strong edge pixel points as edges, and remove isolated weak edge pixel points at the same time;

[0028] Sum the edge intensity values of each row of pixels in the night image region of interest to obtain a night row intensity value;

[0029] Based on the change trend of the night row intensity value, use the row position where the night row intensity value steadily decreases to zero as the initial water line of the night distortion-corrected image.

[0030] In a further embodiment, when the day-night classification image is a day distortion-corrected image, the step of respectively performing water line detection on the day-night classification image to identify the corresponding initial water line includes:

[0031] Determine a day image region of interest according to the grayscale image data of the day distortion-corrected image; wherein, the day image region of interest is set on the wall where the water gauge is installed, and the upper boundary and the lower boundary of the day image region of interest are respectively located on the wall and on the water surface;

[0032] Calculate the sum of pixel intensities of each row within the region of interest of the daytime image to obtain the intensity values of each row in the daytime, and perform a first-order difference operation on the intensity values of each row in the daytime to obtain the pixel intensity change amount;

[0033] Use the row with the maximum pixel intensity change amount within the region of interest of the daytime image as the initial water surface line of the daytime distortion correction image.

[0034] In a further embodiment, the step of correcting the initial water surface line based on the continuous water level change characteristics of consecutive multiple frames of day-night classification images within the observation period to obtain a corrected water surface line includes:

[0035] Extract the ordinate of the initial water surface line at the same reference position in each frame of the day-night classification image from the consecutive multiple frames of day-night classification images within the observation period, and calculate the water level change amount between two adjacent frames of day-night classification images according to the ordinate of the initial water surface line;

[0036] Compare the water level change amount with a preset false water surface line detection threshold. If the water level change amount between two adjacent frames of day-night classification images is greater than the false water surface line detection threshold, correct the initial water surface line of the current frame of day-night classification image according to the average value of the ordinates of the initial water surface lines of the previous two frames of day-night classification images to obtain a corrected water surface line.

[0037] In a further embodiment, the step of adaptively locating the water gauge foreground prompt point and the non-water gauge background prompt point in the day-night classification image based on the corrected water surface line includes:

[0038] Set at least two fixed water gauge foreground prompt points at the top of the water gauge according to the water gauge top feature of the day-night classification image;

[0039] Dynamically locate the adaptive water gauge foreground prompt point and the adaptive non-water gauge background prompt point respectively in the vertical direction of the ordinate of the corrected water surface line; wherein, the adaptive water gauge foreground prompt point and the adaptive non-water gauge background prompt point are respectively located in the water gauge area and the water surface reflection area close to the water surface line.

[0040] In a further embodiment, the water body water level recognition model is specifically:

[0041] S = α * M + β

[0042] In the formula, S is the water body water level; α and β are regression coefficients; M is the water gauge mask pixel area in the water gauge mask segmentation result.

[0043] In a second aspect, the present invention provides a water level photography monitoring device for eliminating the interference of water surface reflection, and the device includes:

[0044] A distortion correction module, configured to obtain an original water gauge image and perform distortion correction on the original water gauge image to obtain a distortion-corrected image;

[0045] An image classification module, configured to calculate the grayscale spatial average brightness value of the distortion-corrected image and classify the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image; the day-night classification image includes a night distortion-corrected image and a day distortion-corrected image;

[0046] A water surface line detection module, configured to perform water surface line detection on the day-night classification image respectively, identify the corresponding initial water surface line, and correct the initial water surface line based on the water level continuous change characteristics of multiple consecutive frames of day-night classification images within the period to be observed to obtain a corrected water surface line;

[0047] A prompt point positioning module, configured to adaptively position a water gauge foreground prompt point and a non-water gauge background prompt point in the day-night classification image based on the corrected water surface line;

[0048] A water gauge segmentation module, configured to build a SAM image segmentation model based on a cross-attention mechanism, and input the day-night classification image, the water gauge foreground prompt point and the non-water gauge background prompt point into the SAM image segmentation model to obtain a water gauge mask segmentation result;

[0049] A water level recognition module, configured to obtain the water body level according to the water gauge mask segmentation result and a pre-established water body level recognition model.

[0050] The present invention provides a water level photography monitoring method and device for eliminating the interference of water surface reflection. The method performs distortion correction on the original water gauge image to obtain a distortion-corrected image; calculates the grayscale spatial average brightness value of the distortion-corrected image, and classifies the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image; performs water surface line detection on the day-night classification image respectively, identifies the corresponding initial water surface line, and corrects the initial water surface line based on the water level continuous change characteristics of multiple consecutive frames of day-night classification images within the period to be observed to obtain a corrected water surface line; adaptively positions a water gauge foreground prompt point and a non-water gauge background prompt point in the day-night classification image based on the corrected water surface line; builds a SAM image segmentation model based on a cross-attention mechanism, and inputs the day-night classification image, the water gauge foreground prompt point and the non-water gauge background prompt point into the SAM image segmentation model to obtain a water gauge mask segmentation result; obtains the water body level according to the water gauge mask segmentation result and a pre-established water body level recognition model. Compared with the prior art, this method realizes the real-time monitoring of the water body level through technologies such as adaptive prompt points and image segmentation models, effectively overcomes the interference of water surface reflection on water level measurement, and significantly improves the water level monitoring accuracy and the number of observation samples under complex reflection interference. Description of the Drawings

[0051] Figure 1 It is a schematic flowchart of the water level photography monitoring method for eliminating the interference of water surface reflection provided by the embodiments of the present invention;

[0052] Figure 2 It is a schematic layout diagram of the water level photography monitoring architecture provided by the embodiments of the present invention;

[0053] Figure 3 It is a schematic diagram of the initial water surface line recognition result of the day-night classified image provided by the embodiments of the present invention;

[0054] Figure 4 It is a schematic comparison diagram of the water gauge mask segmentation results under complex reflection interference provided by the embodiments of the present invention;

[0055] Figure 5 It is a block diagram of the water level photography monitoring device for eliminating the interference of water surface reflection provided by the embodiments of the present invention. Detailed implementation manners

[0056] The following specifically clarifies the implementation manners of the present invention in conjunction with the accompanying drawings. The given embodiments are only for illustrative purposes and should not be construed as limiting the present invention. The included drawings are only for reference and illustration and do not constitute a limitation on the scope of patent protection of the present invention, because many changes can be made to the present invention without departing from the spirit and scope of the present invention.

[0057] Refer to Figure 1 and the embodiments of the present invention provide a water level photography monitoring method for eliminating the interference of water surface reflection. As Figure 1 shown, the method includes the following steps:

[0058] S1. Obtain the original water gauge image and perform distortion correction on the original water gauge image to obtain a distortion-corrected image.

[0059] In order to effectively monitor the water level change in the water area, in this embodiment, appropriate points are first selected in the monitoring water area to arrange the water gauge. Specifically, as Figure 2As shown in the figure, an upright pole is erected in the direction directly facing the water gauge, and a time-lapse camera, as well as corresponding solar power supply facilities, data storage and transmission equipment, are installed on it. In this embodiment, by adjusting the shooting angle of the camera, it is ensured that the entire water gauge is located at the center of the shooting screen. In actual operation, this embodiment is illustrated by taking a certain university campus as an example. An upright pole with a height of 2 meters is fixed on the east bank of the lake. The upright pole is vertically installed on the expansion screws embedded in the ground through a stainless steel flange base, and the erection direction of the upright pole is directly aligned with the water gauge. In this embodiment, a commercial time-lapse camera can be used. Its camera is installed on the cross-arm bracket of the upright pole through a duckbill head bracket, and the lens is aimed at the water gauge installed on the outer wall of the sightseeing platform on the shore. The commercial time-lapse camera used has 8 million pixels (resolution 3840×2160), the focal length is fixed at 16 millimeters, and the interval time can be set from 5 seconds to 14000 seconds for automatic capture as needed. At the same time, in order to ensure that the camera can continue to work for more than 150 hours in rainy weather, this embodiment is equipped with a 100-watt monocrystalline solar panel and a 60 ampere-hour lithium battery for it. In addition, the camera is built-in with a 4G communication module, which can transmit image data to the FTP remote server platform in real time through the network system, and the background monitoring host is responsible for retrieving the image data from the server for analysis and processing.

[0060] At the same time, in order to eliminate the image geometric distortion caused by the shooting angle, this embodiment corrects the distortion of the original water gauge image to obtain a distortion-corrected image. The specific steps include:

[0061] According to the four corner coordinates of the water gauge boundary in the original water gauge image, the original water gauge image is mapped to the standard space coordinate system; among them, the water gauge edge in the standard space coordinate system is parallel or perpendicular to the actual wall vertical reference line;

[0062] According to the target four corner coordinates of the original water gauge image in the standard space coordinate system, a perspective transformation matrix is calculated through the perspective transformation algorithm;

[0063] The original water gauge image is resampled by using the perspective transformation matrix to obtain a distortion-corrected image.

[0064] In this embodiment, the four corners of the water gauge boundary in the original water gauge image are used as control points, and the original water gauge image is converted to the standard space coordinate system through the perspective correction algorithm. This process ensures that the water gauge edge in the original water gauge image is parallel or perpendicular to the actual wall vertical reference line, so as to obtain a water gauge image with a positive view angle and eliminate the geometric distortion caused by the shooting angle. The size of the corrected image is 500×1200 pixels and contains RGB three-channel color information.

[0065] S2. Calculate the grayscale spatial average luminance value of the distortion-corrected image, and classify the distortion-corrected image based on the grayscale spatial average luminance value to obtain a day-night classification image; the day-night classification image includes a night distortion-corrected image and a day distortion-corrected image.

[0066] In some embodiments, the steps of calculating the grayscale spatial average luminance value of the distortion-corrected image and classifying the distortion-corrected image based on the grayscale spatial average luminance value to obtain a day-night classification image include:

[0067] Obtain the RGB image data of the distortion-corrected image, and convert the RGB image data of the distortion-corrected image into grayscale image data;

[0068] Calculate the intensity mean value of all pixels in the grayscale image data to obtain the grayscale spatial average luminance value;

[0069] Compare the grayscale spatial average luminance value with a preset luminance threshold, and classify the distortion-corrected image according to the comparison result to obtain a day-night classification image.

[0070] Specifically, in this embodiment, the RGB image data of the distortion-corrected image is obtained, and the RGB image data of the distortion-corrected image is converted into grayscale image data. All pixels of the grayscale image data are traversed, and the mean value of all pixel values of the grayscale image is obtained to obtain the grayscale spatial average luminance value of the distortion-corrected image. At the same time, in this embodiment, the luminance threshold for distinguishing day-night images can be set according to actual application requirements. The calculated grayscale spatial average luminance value is compared with the preset luminance threshold. When the grayscale spatial average luminance value is lower than the preset luminance threshold, the distortion-corrected image is determined to be a night distortion-corrected image; when the grayscale spatial average luminance value is not lower than the preset luminance threshold, the distortion-corrected image is determined to be a day distortion-corrected image. For example, in this embodiment, the luminance threshold can be set to 0.35, and the distortion-corrected images with a grayscale spatial average luminance value lower than 0.35 are classified as night distortion-corrected images, and other images are classified as day distortion-corrected images.

[0071] S3. Perform water line detection on the day-night classification images respectively, identify the corresponding initial water lines, and correct the initial water lines based on the water level continuous change characteristics of multiple consecutive frames of day-night classification images within the observation period to obtain corrected water lines.

[0072] To meet the requirements of water surface line recognition under different lighting conditions and in view of the different characteristics of night images and day images, this embodiment respectively adopts two different strategies, namely the Canny edge detection and pixel intensity analysis methods, to identify the initial water surface lines of night distortion-corrected images and day distortion-corrected images. For night distortion-corrected images, this embodiment uses the Canny edge detection algorithm to accurately locate the water surface line and automatically correct the initial water surface line by analyzing the water level change characteristics in consecutive frames of images, thereby improving the positioning accuracy. In some embodiments, when the day-night classification image is a night distortion-corrected image, the step of respectively performing water surface line detection on the day-night classification image and identifying the corresponding initial water surface line includes:

[0073] Generate a region of interest (ROI) for the night image in the region covering the position where the water gauge is located according to the grayscale image data of the night distortion-corrected image;

[0074] Perform Canny edge detection on the ROI of the night image to identify strong edge pixel points, weak edge pixel points, and non-edge pixel points;

[0075] Use the hysteresis threshold method to start edge connection along the gradient direction from the strong edge pixel points, mark the weak edge pixel points connected to the strong edge pixel points as edges, and at the same time remove isolated weak edge pixel points;

[0076] Sum the edge intensity values of each row of pixels in the ROI of the night image to obtain the night row intensity value;

[0077] Based on the change trend of the night row intensity value, take the row position where the night row intensity value steadily decreases to zero as the initial water surface line of the night distortion-corrected image.

[0078] In a specific embodiment, for the night-time distorted corrected image, this embodiment uses the Canny edge detection algorithm to identify the edge contour of the water gauge, while filtering the environmental noise within the region of interest (ROI). The Canny edge detection algorithm adopts a dual-threshold strategy. By setting a high threshold and a low threshold, the pixels in the night-time distorted corrected image are classified into three categories: strong edge pixel points, weak edge pixel points, and non-edge pixel points. Specifically, in this embodiment, the pixels with pixel values higher than the high threshold are identified as strong edge pixel points, the pixels with pixel values lower than the low threshold are identified as non-edge pixel points, and the pixels with pixel values between the high threshold and the low threshold are identified as weak edge pixel points. To further enhance the coherence of the edges and reduce noise interference, this embodiment uses the hysteresis threshold method for edge connection. During the edge connection process, this embodiment starts tracking from the strong edge pixel points, marks the weak edge pixel points connected to the strong edge pixel points as edges, and the isolated weak edge pixel points are removed. For example, this embodiment can set the high threshold and the low threshold to 0.75 and 0.40 respectively, and at the same time remove the image noise by adding a 3×3 Gaussian filter (standard deviation is 1). This embodiment generates a night-time image region of interest based on the grayscale image data of the night-time distorted corrected image, and the four vertex coordinates of the region are (150, 390), (280, 390), (150, 1155), and (280, 1155) respectively. Finally, this embodiment sums the edge intensities row by row within the night-time image region of interest ROI and finds the position where the intensity value steadily drops to zero. This position is regarded as the initial water surface line, so as to effectively identify the initial water surface line in the night-time distorted corrected image, so that the subsequent prompt points can be adaptively and accurately located in the water gauge and reflection region near the water surface line, providing more accurate and robust prompt information for subsequent water gauge segmentation.

[0079] In some other embodiments, when the day-night classification image is a day-time distorted corrected image, the step of respectively performing water surface line detection on the day-night classification image and identifying the corresponding initial water surface line includes:

[0080] According to the grayscale image data of the day-time distorted corrected image, determine the day-time image region of interest; wherein, the day-time image region of interest is set on the wall where the water gauge is installed, and the upper boundary and the lower boundary of the day-time image region of interest are respectively located on the wall and the water surface;

[0081] Calculate the sum of the pixel intensities of each row within the day-time image region of interest to obtain the intensity values of each day-time row, and perform a first-order difference operation on the intensity values of each day-time row to obtain the pixel intensity change amount;

[0082] Take the row with the largest pixel intensity change amount within the day-time image region of interest as the initial water surface line of the day-time distorted corrected image.

[0083] In a specific embodiment, due to strong water surface reflection and complex wave textures in daytime images, edge detection techniques often have difficulty accurately distinguishing the water surface from the water gauge edge. Therefore, this embodiment uses a pixel intensity analysis method to identify the initial water surface line in the daytime distortion-corrected image. Specifically, when processing daytime images, since the pixel intensity difference between the water gauge reflection and the real water gauge on the water surface is small and it is difficult to directly distinguish the water surface line, this embodiment selects the region of interest (ROI) of the daytime image on the wall where the water gauge is installed, where the pixel intensity difference between the wall and the water surface is large, facilitating the identification of the water surface line. At the same time, this embodiment ensures that the upper and lower parts of the ROI of the daytime image are located on the wall and the water surface respectively to accurately capture the boundary between the water surface and the wall. For example, this embodiment can set the four vertex coordinates of the ROI of the daytime image as (50, 390), (100, 390), (50, 1155), and (100, 1155). Then, this embodiment converts the RGB image data of the ROI of the daytime image into grayscale image data and uses the grayscale value to represent the pixel intensity. This embodiment sums the pixel intensities of each row within the ROI of the daytime image and calculates the change in pixel intensity between adjacent rows through first-order differences. This process helps to capture the sudden change in pixel intensity at the boundary between the water surface and the wall, and finally identifies the row with the largest pixel intensity change within the ROI of the daytime image as the initial water surface line. Figure 3 It is a schematic diagram of the recognition result of the initial water surface line for the day-night classification image. This method effectively utilizes the pixel intensity difference between the wall and the water surface in the daytime distortion-corrected image by selecting the wall area where the water gauge is installed with a large difference as the ROI of the daytime image, and can effectively avoid the interference of water surface reflection and wave textures, thus achieving accurate recognition of the initial water surface line.

[0084] During the image water level monitoring process, if the model detects a sharp change in the water level within a very short period of time, this situation is usually regarded as noise caused by incorrect water surface line detection. To correct this misidentified initial water surface line, this embodiment realizes the automatic correction of the misidentified initial water surface line by analyzing the continuous change characteristics of the water level in a series of consecutive frames of images within a period of time. In some embodiments, the step of correcting the initial water surface line based on the continuous change characteristics of the water level in a series of consecutive day-night classification images within the period to be observed to obtain the corrected water surface line includes:

[0085] Extract the ordinate of the initial water surface line at the same reference position in each frame of the day-night classification image from a series of consecutive day-night classification images within the period to be observed, and calculate the water level change amount between two adjacent frames of day-night classification images according to the ordinate of the initial water surface line;

[0086] Compare the water level change amount with a preset error water surface line detection threshold. If the water level change amount between two adjacent frames of day-night classification images is greater than the error water surface line detection threshold, correct the initial water surface line of the current frame of day-night classification image according to the average value of the initial water surface line vertical coordinates of the previous two frames of day-night classification images to obtain a corrected water surface line.

[0087] In a specific embodiment, if the absolute value of the difference between the y coordinate of the initial water surface line detected at the current time point t and the y coordinate of the initial water surface line detected at the previous time point (t - 1) is greater than the preset error water surface line detection threshold T, it is determined that the water surface line recognition at the current time point is incorrect. At this time, correct the current water surface line position to the average value of the water surface line positions of the previous two time points; if the absolute value of the difference between the y coordinate of the initial water surface line detected at the current time point t and the y coordinate of the initial water surface line detected at the previous time point (t - 1) is not greater than the preset error water surface line detection threshold T, it is determined that the water surface line recognition at the current time point is correct, and the original position remains unchanged. The specific correction formula for the water surface line is expressed as:

[0088]

[0089] Y t =Y t if|Y t -Y t-1 |≤T

[0090] In the formula, Y t is the y coordinate of the initial water surface line detected at the current time point t; Y t-1 is the y coordinate of the initial water surface line detected at the previous time point (t - 1); Y t-2 is the y coordinate of the initial water surface line detected at the previous two time points (t - 2); T is the error water surface line detection threshold, which is related to factors such as image resolution, water gauge distance, and water level fluctuation range. In this embodiment, T is set to 100.

[0091] Through the above automatic correction process, this embodiment can effectively filter out the noise caused by detection errors, thereby identifying and correcting the errors in the water surface line recognition process, improving the accuracy and reliability of water level monitoring, and providing more reliable data support for subsequent water gauge segmentation and water level monitoring.

[0092] S4. Based on the corrected water surface line, adaptively locate the water gauge foreground prompt points and non-water gauge background prompt points in the day-night classification image.

[0093] In some embodiments, the step of adaptively locating the water gauge foreground prompt points and non-water gauge background prompt points in the day-night classification image based on the corrected water surface line includes:

[0094] According to the characteristics of the top of the water gauge in the day-night classification image, at least two fixed foreground cue points of the water gauge are set at the top of the water gauge;

[0095] Dynamically locate an adaptive foreground cue point of the water gauge and an adaptive non-water-gauge background cue point respectively in the vertical direction of the ordinate of the calibrated water surface line; among them, the adaptive foreground cue point of the water gauge and the adaptive non-water-gauge background cue point are located in the water gauge area and the water surface reflection area close to the water surface line respectively.

[0096] In a specific embodiment, in order to effectively segment the water gauge area, this embodiment sets two fixed foreground cue points and two adaptive cue points for all images. Among them, the two fixed foreground cue points are set at the top of the water gauge, and they respectively mark the red area and the white area on the water gauge. In this embodiment, the two fixed foreground cue points are set at positions (200, 430) and (255, 492) respectively. These coordinate positions are selected according to the actual position of the water gauge and the image characteristics to ensure the accuracy of the cue points; at the same time, the adaptive cue points include an adaptive foreground cue point of the water gauge and an adaptive non-water-gauge background cue point. Among them, the positions of the adaptive foreground cue point of the water gauge and the adaptive non-water-gauge background cue point are set near the calibrated water surface line and are dynamically adjusted according to the position of the calibrated water surface line in each image. In this embodiment, the y coordinates of the adaptive foreground cue point of the water gauge and the adaptive non-water-gauge background cue point are set as (Y - N) and (Y + N) respectively, where Y represents the y coordinate of the calibrated water surface line, and N is the offset distance, which is used to ensure that the adaptive cue points can be accurately located in the key area close to the water surface line. For example, in this embodiment, the value of N is set to 100 to ensure that the adaptive cue points maintain an appropriate distance from the water surface line and can have a good representation of the water surface reflection and the water gauge at the same time; specifically, the adaptive foreground cue point of the water gauge is located in the water gauge area close to the water surface line, and the adaptive non-water-gauge background cue point is located in the water surface reflection area close to the water surface line. This setting helps the image segmentation model to more effectively distinguish the water gauge and the reflection, thereby reducing the sensitivity of the model to the water surface reflection and ensuring the integrity and accuracy of the water gauge mask segmentation.

[0097] S5. Construct a SAM image segmentation model based on the cross-attention mechanism, and input the day-night classification image, the foreground cue points of the water gauge, and the background cue points of the non-water gauge into the SAM image segmentation model to obtain the water gauge mask segmentation result.

[0098] S6. Obtain the water level of the water body according to the water gauge mask segmentation result and the pre-established water body water level recognition model.

[0099] In a specific embodiment, in order to accurately identify and segment the water gauge range in the image and achieve precise water level monitoring, this embodiment uses water gauge foreground prompt points and non-water gauge background prompt points to drive the Segment Anything Model (SAM) image segmentation model, so that it can effectively identify the target water gauge range above the water surface line in the day-night classification image and segment it into a water gauge mask. During this process, the input foreground prompt points will guide the SAM model to strengthen the attention to the water gauge features, while the background prompt points will make the model weaken the recognition of the reflection features. As Figure 4 shown, in this way, even under the interference of complex reflections, the SAM model can accurately identify and segment the lower boundary of the water gauge from the image. Figure 4 The left side of Figure 4 is the misrecognition result of the image segmentation model affected by the water surface reflection of the water gauge. Figure 4 The right side of Figure 4 is the recognition result of the adaptive prompt method provided in this embodiment. Figure 4 The dark area of Figure 4 is the segmentation mask; after the water gauge mask segmentation is completed, this embodiment calculates the accurate water level value by establishing the relationship between the pixel area of the water gauge mask and the water level. During the observation period, as the initial water surface line continuously changes, the positions of the adaptive prompt points will also be automatically updated to ensure that the adaptive prompt points can continuously and effectively guide the SAM model to complete accurate segmentation, so that the water level observation value provided under the interference of reflections is much better than other traditional methods.

[0100] In this embodiment, the SAM model identifies whether each feature in the image is associated with the set water gauge prompt point information based on the cross-attention mechanism. Through this mechanism, the model can accurately segment the pixel area into two parts: the water gauge (foreground) and the non-water gauge (background) mask. After the distortion correction of the water gauge image, most of the perspective distortions have been effectively eliminated, and there is a significant positive correlation between the pixel length in the image coordinates and the length in the real world. Based on this positive correlation, this embodiment can establish a linear model between the water gauge mask area and the water level to realize the real-time monitoring of the water body level. The water body level recognition model can be expressed as:

[0101] S = α * M + β

[0102] In the formula, S is the water body level; α and β are regression coefficients; M is the pixel area of the water gauge mask in the water gauge mask segmentation result. For example, in this embodiment, 170 picture samples under different water conditions are randomly selected, and the least squares method is used to determine the regression parameters, and the following linear relationship is obtained:

[0103] S = -0.0023 * M + 212.27

[0104] Therefore, this water body level recognition model has a high goodness of fit (R 2= 0.97), which can ensure the real-time and accuracy of water level monitoring.

[0105] In summary, the water level photography monitoring method for eliminating the interference of water surface reflection in this embodiment arranges a water gauge in the monitoring water area, and installs a time-lapse camera at a position directly facing the water gauge to capture the image of the water gauge. The captured image is corrected for distortion to eliminate perspective distortion in the image. Secondly, according to the image brightness information, the images are classified into two categories: night and day. For night images, the Canny edge detection algorithm is used in this embodiment to identify the initial water surface line; for day images, the pixel intensity analysis method is used in this embodiment for identification. Then, by analyzing the continuous change characteristics of the water level in multiple frames of images during the period to be observed, the initial water surface line is automatically corrected to eliminate detection errors, and foreground and background hint points are set in the image, and the positions of these adaptive hint points are dynamically adjusted according to the corrected initial water surface line to make them have good representativeness for the water surface reflection and the water gauge. Finally, the foreground and background hint point information is used to drive the SegmentAnything Model (SAM) image segmentation model to identify the target water gauge range above the water surface line in the image, and it is segmented into a water gauge mask, and the water level value of the water body is calculated through the relationship between the mask pixel area and the real water level. This method effectively solves the problem of similar pixel interference caused by water surface reflection through technologies such as adaptive hint points and the SAM model, improves the accuracy of water level monitoring, and increases the number of available observation data.

[0106] Compared with the existing water level photography monitoring technology, the water level photography monitoring method for eliminating the interference of water surface reflection proposed in this embodiment can not only independently set the capture time interval to achieve rapid measurement within seconds, thus having a high time resolution and being particularly suitable for capturing the violent processes of extreme water level changes such as rainstorms, floods, and storm surges, but also has a low installation and maintenance cost. After simple debugging, it can be flexibly applied to water level monitoring under different river sections and terrain conditions. The equipped infrared night vision function time-lapse camera does not depend on external light conditions and has strong anti-weather interference ability. In addition, the water level measurement algorithm in this embodiment is optimized and designed. The adaptive hint point technology is used to effectively overcome the similar pixel interference caused by water surface reflection, improve the accuracy of water level monitoring, and increase the number of available observation samples, ensuring stability and reliability in complex environments.

[0107] An embodiment of the present invention provides a water level photography monitoring method for eliminating the interference of water surface reflections. The method includes performing distortion correction on the original water gauge image to obtain a distortion-corrected image; calculating the gray-scale spatial average brightness value of the distortion-corrected image, and classifying the distortion-corrected image based on the gray-scale spatial average brightness value to obtain a day-night classification image; performing water surface line detection on the day-night classification image respectively, identifying the corresponding initial water surface line, and correcting the initial water surface line based on the water level continuous change characteristics of consecutive multiple frames of day-night classification images within the observation period to obtain a corrected water surface line; based on the corrected water surface line, adaptively locating the water gauge foreground prompt points and non-water gauge background prompt points in the day-night classification image; constructing a SAM image segmentation model based on the cross-attention mechanism, and inputting the day-night classification image, the water gauge foreground prompt points, and the non-water gauge background prompt points into the SAM image segmentation model to obtain a water gauge mask segmentation result; and obtaining the water body level according to the water gauge mask segmentation result and the water body level recognition model. Compared with the prior art, this method realizes the real-time monitoring of the water body level through technologies such as adaptive prompt points and image segmentation models, effectively overcomes the interference of water surface reflections on water level measurement, and significantly improves the water level monitoring accuracy and the number of observation samples under complex reflection interference.

[0108] It should be noted that the magnitudes of the serial numbers of the above processes do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0109] In one embodiment, as Figure 5 shown, an embodiment of the present invention provides a water level photography monitoring device for eliminating the interference of water surface reflections. The device includes:

[0110] A distortion correction module 101, configured to obtain the original water gauge image and perform distortion correction on the original water gauge image to obtain a distortion-corrected image;

[0111] An image classification module 102, configured to calculate the gray-scale spatial average brightness value of the distortion-corrected image, and classify the distortion-corrected image based on the gray-scale spatial average brightness value to obtain a day-night classification image; the day-night classification image includes a night distortion-corrected image and a day distortion-corrected image;

[0112] A water surface line detection module 103, configured to perform water surface line detection on the day-night classification image respectively, identify the corresponding initial water surface line, and correct the initial water surface line based on the water level continuous change characteristics of consecutive multiple frames of day-night classification images within the observation period to obtain a corrected water surface line;

[0113] A prompt point positioning module 104, configured to adaptively locate the water gauge foreground prompt points and non-water gauge background prompt points in the day-night classification image based on the corrected water surface line;

[0114] The water gauge segmentation module 105 is used to construct a SAM image segmentation model based on the cross-attention mechanism, and input the day-night classification image, the water gauge foreground prompt points, and the non-water gauge background prompt points into the SAM image segmentation model to obtain the water gauge mask segmentation result;

[0115] The water level recognition module 106 is used to obtain the water body level according to the water gauge mask segmentation result and the pre-established water body level recognition model.

[0116] For the specific limitations of a water level photographic monitoring device for eliminating the interference of water surface reflections, reference can be made to the above limitations on a water level photographic monitoring method for eliminating the interference of water surface reflections, which will not be elaborated here. Those of ordinary skill in the art can realize that, in combination with the various modules and steps described in the embodiments disclosed in the present application, they can be implemented in hardware, software, or a combination of both. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0117] The embodiment of the present invention provides a water level photographic monitoring device for eliminating the interference of water surface reflections. The device performs distortion correction on the original water gauge image through a distortion correction module to obtain a distortion-corrected image; the image classification module calculates the gray space average brightness value of the distortion-corrected image, and classifies the distortion-corrected image based on the gray space average brightness value to obtain a day-night classification image; the water surface line detection module performs water surface line detection on the day-night classification image respectively, identifies the corresponding initial water surface line, and corrects the initial water surface line based on the water level continuous change characteristics of consecutive multiple frames of day-night classification images within the period to be observed to obtain a corrected water surface line; the prompt point positioning module adaptively locates the water gauge foreground prompt points and non-water gauge background prompt points in the day-night classification image based on the corrected water surface line; the water gauge segmentation module constructs a SAM image segmentation model based on the cross-attention mechanism, and inputs the day-night classification image, the water gauge foreground prompt points, and the non-water gauge background prompt points into the SAM image segmentation model to obtain the water gauge mask segmentation result; the water level recognition module obtains the water body level according to the water gauge mask segmentation result and the water body level recognition model. Compared with the prior art, the device realizes the real-time monitoring of the water body level through technologies such as adaptive prompt points and image segmentation models, effectively overcomes the interference of water surface reflections on water level measurement, and significantly improves the water level monitoring accuracy and the number of observation samples under complex reflection interference.

[0118] The above-described embodiments merely represent several preferred embodiments of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the technical principle of the present invention, several improvements and substitutions can be made, and these improvements and substitutions should also be regarded as the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the protection scope of the claims described above.

Claims

1. A water level photography monitoring method for eliminating the interference of water surface reflection, characterized in that, It includes the following steps: Obtain the original water gauge image, and perform distortion correction on the original water gauge image to obtain a distortion-corrected image; Calculate the grayscale spatial average brightness value of the distortion-corrected image, and classify the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image; the day-night classification image includes a night distortion-corrected image and a day distortion-corrected image; Perform water surface line detection on the day-night classification image respectively, identify the corresponding initial water surface line, and correct the initial water surface line based on the water level continuous change feature of consecutive multiple frames of day-night classification images within the period to be observed to obtain a corrected water surface line; Based on the corrected water surface line, adaptively locate the water gauge foreground hint points and non-water gauge background hint points in the day-night classification image; Construct a SAM image segmentation model based on the cross-attention mechanism, and input the day-night classification image, the water gauge foreground hint points, and the non-water gauge background hint points into the SAM image segmentation model to obtain a water gauge mask segmentation result; According to the water gauge mask segmentation result and the pre-established water body water level recognition model, obtain the water body water level.

2. The water level photography monitoring method for eliminating the interference of water surface reflection as claimed in claim 1, wherein, The step of performing distortion correction on the original water gauge image to obtain a distortion-corrected image includes: According to the four corner coordinates of the water gauge boundary in the original water gauge image, map the original water gauge image to the standard space coordinate system; wherein, the water gauge edge in the standard space coordinate system is parallel or perpendicular to the actual wall vertical reference line; According to the target four corner coordinates of the original water gauge image in the standard space coordinate system, calculate the perspective transformation matrix through the perspective transformation algorithm; Use the perspective transformation matrix to resample the original water gauge image to obtain a distortion-corrected image.

3. A water level photography monitoring method for eliminating interference of water surface reflection, characterized in that The step of calculating the grayscale spatial average brightness value of the distortion-corrected image and classifying the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image includes: Obtain the RGB image data of the distortion-corrected image, and convert the RGB image data of the distortion-corrected image into grayscale image data; Calculate the intensity mean value of all pixels in the grayscale image data to obtain the grayscale spatial average brightness value; Compare the grayscale spatial average brightness value with a preset brightness threshold, and classify the distortion-corrected image according to the comparison result to obtain a day-night classification image.

4. The water level photography monitoring method for eliminating the interference of water surface reflection as claimed in claim 3, wherein, The step of classifying the distortion-corrected image according to the comparison result to obtain a day-night classification image includes: When the grayscale spatial average brightness value is lower than the preset brightness threshold, determine the distortion-corrected image as a night distortion-corrected image; When the grayscale spatial average brightness value is not lower than the preset brightness threshold, determine the distortion-corrected image as a day distortion-corrected image.

5. The water level photography monitoring method for eliminating the interference of water surface reflection as claimed in claim 1, wherein When the day-night classification image is a night distortion-corrected image, the step of performing water surface line detection on the day-night classification image respectively and identifying the corresponding initial water surface line includes: According to the grayscale image data of the night distortion-corrected image, generate a night image region of interest covering the position where the water gauge is located; Perform Canny edge detection on the region of interest of the night image to identify strong edge pixel points, weak edge pixel points, and non-edge pixel points; Use the hysteresis threshold method to connect edges along the gradient direction starting from the strong edge pixel points, mark the weak edge pixel points connected to the strong edge pixel points as edges, and remove isolated weak edge pixel points at the same time; Sum the edge intensity values of each row of pixels in the region of interest of the night image to obtain the night row intensity value; Based on the change trend of the night row intensity value, take the row position where the night row intensity value steadily decreases to zero as the initial water surface line of the night distortion correction image.

6. The water level photography monitoring method for eliminating interference of water surface reflection as described in claim 1, wherein, When the day-night classification image is a day distortion correction image, the steps of performing water surface line detection on the day-night classification image respectively to identify the corresponding initial water surface line include: Determine the region of interest of the day image according to the gray image data of the day distortion correction image; wherein, the region of interest of the day image is set on the wall where the water gauge is installed, and the upper boundary and the lower boundary of the region of interest of the day image are respectively located on the wall and the water surface; Calculate the sum of the intensities of each row of pixels in the region of interest of the day image to obtain the day row intensity values of each row, and perform a first-order difference operation on the day row intensity values to obtain the pixel intensity change amount; Take the row with the largest pixel intensity change amount in the region of interest of the day image as the initial water surface line of the day distortion correction image.

7. The water level photography monitoring method for eliminating the interference of water surface reflection as described in claim 1, characterized in that, The steps of correcting the initial water surface line based on the continuous water level change characteristics of consecutive multiple frames of day-night classification images within the observation period to obtain a corrected water surface line include: Extract the vertical coordinates of the initial water surface line at the same reference position in each frame of the day-night classification image from the consecutive multiple frames of day-night classification images within the observation period, and calculate the water level change amount between two adjacent frames of day-night classification images according to the vertical coordinates of the initial water surface line; Compare the water level change amount with a preset false water surface line detection threshold. If the water level change amount between two adjacent frames of day-night classification images is greater than the false water surface line detection threshold, correct the initial water surface line of the current frame of day-night classification image according to the average value of the vertical coordinates of the initial water surface lines of the previous two frames of day-night classification images to obtain a corrected water surface line.

8. The water level photography monitoring method for eliminating the interference of water surface reflection as claimed in claim 1, wherein, The steps of adaptively locating the water gauge foreground prompt points and non-water gauge background prompt points in the day-night classification image based on the corrected water surface line include: Set at least two fixed water gauge foreground prompt points at the top of the water gauge according to the water gauge top characteristics of the day-night classification image; Dynamically locate the adaptive water gauge foreground prompt point and the adaptive non-water gauge background prompt point respectively in the vertical direction of the vertical coordinate of the corrected water surface line; wherein, the adaptive water gauge foreground prompt point and the adaptive non-water gauge background prompt point are respectively located in the water gauge area and the water surface reflection area close to the water surface line.

9. A water level photography monitoring method for eliminating interference of water surface reflection, characterized in that, The specific water body water level recognition model is: S = α * M + β In the formula, S is the water body water level; α and β are regression coefficients; M is the water gauge mask pixel area in the water gauge mask segmentation result.

10. A water level photography monitoring device for eliminating interference of water surface reflection, characterized in that, The device includes: A distortion correction module for acquiring the original water gauge image and performing distortion correction on the original water gauge image to obtain a distortion correction image; An image classification module, which is used to calculate the grayscale spatial average brightness value of the distortion-corrected image, and classify the distortion-corrected image based on the grayscale spatial average brightness value to obtain a day-night classification image; the day-night classification image includes a night distortion-corrected image and a day distortion-corrected image; A water level line detection module, which is used to perform water level line detection on the day-night classification image respectively, identify the corresponding initial water level line, and correct the initial water level line based on the water level continuous change characteristics of multiple consecutive frames of day-night classification images within the period to be observed to obtain a corrected water level line; A prompt point positioning module, which is used to adaptively position the water gauge foreground prompt point and the non-water gauge background prompt point in the day-night classification image based on the corrected water level line; A water gauge segmentation module, which is used to construct a SAM image segmentation model based on a cross-attention mechanism, and input the day-night classification image, the water gauge foreground prompt point and the non-water gauge background prompt point into the SAM image segmentation model to obtain a water gauge mask segmentation result; A water level recognition module, which is used to obtain the water level of the water body according to the water gauge mask segmentation result and a pre-established water body water level recognition model.

Citation Information

Cited By

  • Water gauge reading double-path visual measurement method, system and device in industrial scene and storage medium

    CN120913193A

  • A water level gauge reading dual-path visual measurement method, system, device and storage medium in an industrial scene

    CN120913193B

  • Water gauge water level monitoring method and monitoring system

    CN122217424A

  • Water level monitoring method and monitoring system

    CN122217424B