A method, device and medium for realizing riverbank virtual water gauge
By determining the plane of markers on the river bank and identifying the water level line using cameras and image processing technology, the error problem of AI water level measurement in complex environments is solved, and efficient and accurate water level monitoring is achieved.
Patent Information
- Application Number
- CN202410682308.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-05-29
AI Technical Summary
When the prior art uses AI to measure water level, due to the complexity of the riparian environment, there are large errors in the measurement results.
By determining the river bank plane composed of several markers on the river bank, and using the camera to obtain video frame images within the range of water level line variation, combining image processing technology and holographic matrix conversion, the water level line is accurately identified and the river bank water level value is calculated.
It improves the efficiency and accuracy of water level monitoring, can conduct continuous and stable all-weather water level monitoring in complex environments, reduces labor costs and safety risks, and is suitable for straight and curved river banks.
Smart Images

Figure CN118537776B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of water level measurement technology, and in particular to a method, device and medium for realizing a river bank virtual water gauge. Background Art
[0002] At present, with the advancement of science and technology and the development of society, water level measurement is of vital importance in many fields such as water conservancy projects, environmental monitoring, and disaster warning. Although traditional water level measurement methods, such as manual observation and water gauge reading, are simple and easy to use, they are time-consuming and labor-intensive, have large reading errors, and are significantly affected by environmental factors. In recent years, with the rise of artificial intelligence technology, water level measurement methods based on AI have gradually become a research hotspot.
[0003] However, the current AI technical solution still has certain technical bottlenecks in the process of video virtual water gauge reading. In the existing technical solutions, the AI-based water level measurement method mainly relies on image recognition and processing technology. However, due to the complexity of the riverbank environment, such as lighting changes, water surface fluctuations, reflection interference and other factors, the AI algorithm often has difficulty in accurately identifying the water level line when performing water level recognition, resulting in large errors in the measurement results. This not only affects the accuracy of water level measurement, but also limits the widespread application of AI technology in the field of water level measurement. Summary of the invention
[0004] The embodiments of the present application provide a method, device and medium for realizing a riverbank virtual water gauge, so as to solve the technical problem that when the prior art performs water level measurement based on AI, the measurement results have large errors due to the complexity of the riverbank environment.
[0005] On the one hand, an embodiment of the present application provides a method for implementing a riverbank virtual water gauge, including:
[0006] Determine a river bank plane formed by a plurality of markers on the river bank, and determine actual coordinates corresponding to the plurality of markers on the river bank plane;
[0007] Acquire the video frame image to be identified within the range of the river bank water level change through the camera to determine the image coordinates of the plurality of markers, and determine the homography matrix from the river bank plane to the imaging plane of the camera;
[0008] The water level line is identified based on the video frame image to be identified, the image coordinates corresponding to the water level line are determined, and based on the homography matrix, the image coordinates of the water level line are converted into actual coordinates to obtain the corresponding river bank water level value.
[0009] In one implementation of the present application, the determining of a river bank plane formed by a plurality of markers on the river bank, and determining actual coordinates corresponding to the plurality of markers on the river bank plane, specifically includes:
[0010] Determine a river bank having a virtual water gauge requirement, and determine a plurality of markers at non-collinear points on the river bank based on the virtual water gauge requirement;
[0011] Determine a river bank plane formed by the plurality of markers, and determine elevation base points in the river bank plane;
[0012] A coordinate origin is determined based on the elevation base point, so as to construct an actual coordinate system on the river bank plane based on the coordinate origin, and the actual coordinates corresponding to the plurality of markers are determined in the actual coordinate system of the river bank plane.
[0013] In one implementation of the present application, the step of obtaining a video frame image to be identified within a range of riverbank water level changes through a camera specifically includes:
[0014] Acquire a historical water level line on the river bank plane, and a river bank water level value corresponding to the historical water level line, so as to determine a change range of the river bank water level line corresponding to the river bank plane according to the historical water level line and the river bank water level value;
[0015] Determine the installation position of the camera according to the change range of the river bank water level line, and determine the camera to be set at the installation position;
[0016] The camera is used to obtain a riverbank video within the range of the riverbank water level change, and based on the virtual water gauge requirement, a video frame image to be identified in the riverbank video is determined.
[0017] In one implementation of the present application, determining the image coordinates of the plurality of markers specifically includes:
[0018] Taking the lower left corner of the video frame image to be identified as the origin, the lower boundary of the video frame image to be identified as the X-axis, and the left boundary of the video frame image to be identified as the Y-axis, constructing an image coordinate system corresponding to the video frame image to be identified;
[0019] The plurality of markers are found in the to-be-identified video frame image, and image coordinates corresponding to the plurality of markers are determined based on an image coordinate system corresponding to the to-be-identified video frame image.
[0020] In one implementation of the present application, determining the homography matrix from the river bank plane to the imaging plane of the camera specifically includes:
[0021] For each of the plurality of markers, determining the actual coordinates and the image coordinates corresponding to the marker, and calculating a coordinate transformation relationship from the actual coordinates to the image coordinates;
[0022] Based on the coordinate transformation relationship, a plane transformation relationship from the river bank plane to the imaging plane of the camera is determined, and a homography matrix corresponding to the plane transformation relationship is obtained.
[0023] In one implementation of the present application, before performing water level recognition based on the video frame image to be recognized, the method further includes:
[0024] The video frame image to be identified is blurred by median filtering, and at least one edge line is extracted from the blurred video frame image to be identified based on an edge detection operator;
[0025] Performing a scaling operation on at least one edge line extracted, and taking an absolute value operation on the edge line after the scaling operation;
[0026] The edge lines after scaling and taking the absolute value are converted into unsigned 8-bit numbers to filter the edge lines, and the edge lines of the straight line segments are determined in the filtered edge lines by the Hough line detection method.
[0027] In one implementation of the present application, the water level line recognition based on the video frame image to be recognized and the determination of the image coordinates corresponding to the water level line specifically include:
[0028] Based on the horizontal characteristics of the water level under the action of gravity, the edge line of the straight line segment is projected into the actual coordinate system to determine the actual coordinates corresponding to the edge line of the straight line segment;
[0029] Calculating the slope of the edge line of the straight line segment according to the actual coordinates to determine the magnitude relationship between the slope and a preset threshold;
[0030] When the slope is less than the preset threshold, the edge line of the straight line segment is determined to be a water level line to be selected, and the image coordinates of the straight line segment corresponding to the water level line to be selected are determined.
[0031] In one implementation of the present application, based on the homography matrix, converting the image coordinates of the water level line into actual coordinates to obtain the corresponding riverbank water level value specifically includes:
[0032] Based on the homography matrix, the image coordinates of the straight line segment corresponding to the selected water level line are converted into actual coordinates, and based on the actual coordinates, the maximum vertical coordinate and the minimum vertical coordinate of the selected water level line are determined;
[0033] The candidate water level line corresponding to the maximum ordinate and the candidate water level line corresponding to the minimum ordinate are removed to determine the corresponding target water level line, and the riverbank water level value corresponding to the target water level line is determined.
[0034] On the other hand, the embodiment of the present application further provides a river bank virtual water gauge implementation device, the device comprising:
[0035] at least one processor;
[0036] and, a memory communicatively coupled to the at least one processor;
[0037] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method for implementing a riverbank virtual water gauge.
[0038] On the other hand, an embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, which, when executed, implement a method for implementing a riverbank virtual water gauge as described above.
[0039] The present application provides a method, device and medium for implementing a riverbank virtual water gauge, which at least has the following beneficial effects:
[0040] The camera automatically captures the changes in the water level line, and uses image processing technology to identify the water level, which greatly improves the efficiency and accuracy of water level monitoring. Since the river bank virtual water gauge is based on image processing technology, it can carry out continuous and stable all-weather water level monitoring under complex environmental conditions such as day and night, rainy days, etc., without the need for manual on-site supervision, reducing labor costs and safety risks. By determining the actual coordinates and image coordinates of several markers on the river bank plane, and calculating the homography matrix from the river bank plane to the camera imaging plane, the image coordinates of the water level line can be accurately converted into actual coordinates, and it has strong adaptability to the complexity of the river bank environment. Whether it is a straight river bank or a curved river bank, accurate water level monitoring can be achieved by reasonably arranging markers. The camera and image processing technology are used to realize the automatic identification and recording of the water level. Through the combination with network technology, real-time transmission, remote monitoring and early warning of water level data can also be realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0042] Figure 1 A schematic diagram of a flow chart of a method for implementing a riverbank virtual water gauge provided in an embodiment of the present application;
[0043] Figure 2 A schematic diagram of the relationship between the river bank plane and the horizontal plane provided in the embodiment of the present application;
[0044] Figure 3 A schematic diagram of the effect of virtual water gauge recognition on a slope provided in an embodiment of the present application;
[0045] Figure 4 A schematic diagram of the effect of virtual water gauge recognition on a vertical wall provided in an embodiment of the present application;
[0046] Figure 5 A schematic diagram of the internal structure of a riverbank virtual water gauge implementation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0048] The embodiments of the present application provide a method, device and medium for realizing a riverbank virtual water gauge, which solves the technical problem that when the prior art performs water level measurement based on AI, the measurement results have large errors due to the complexity of the riverbank environment.
[0049] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0050] Figure 1 A flow chart of a method for implementing a riverbank virtual water gauge provided in an embodiment of the present application.
[0051] The analysis method involved in the embodiments of the present application can be implemented by a terminal device or a server, and the present application does not impose any special restrictions on this. For the convenience of understanding and description, the following embodiments are described in detail by taking a server as an example.
[0052] It should be noted that the server may be a single device or a system consisting of multiple devices, that is, a distributed server, and this application does not make any specific limitation on this.
[0053] like Figure 1 As shown, a method for implementing a riverbank virtual water gauge provided in an embodiment of the present application includes:
[0054] 101. Determine the river bank plane formed by a number of markers on the river bank, and determine the actual coordinates corresponding to the several markers on the river bank plane.
[0055] Specifically, in one embodiment of the present application, the server determines a river bank with a virtual water level requirement, and determines a number of markers at non-collinear points on the river bank based on the virtual water level requirement; determines a river bank plane composed of the number of markers, and determines the elevation base point in the river bank plane; determines the coordinate origin based on the elevation base point, and constructs an actual coordinate system on the river bank plane based on the coordinate origin, and determines the actual coordinates corresponding to the number of markers in the actual coordinate system of the river bank plane.
[0056] Figure 2 The schematic diagram of the relationship between the river bank plane and the horizontal plane provided in the embodiment of the present application. Figure 2 As shown, plane P is the river bank plane, plane Q is the horizontal plane, the slope angle between the river bank plane and the horizontal plane is θ, point O is a point on the river bank plane P, and the elevation is the reference elevation at this point. A coordinate system is established on the river bank plane P with point O as the origin. Points p1, p2, p3, and p4 are marked points with known coordinates in the Oxy coordinate system, and points p1, p2, p3, and p4 are not collinear points.
[0057] In one embodiment, in a water conservancy project, the water level of a river needs to be accurately monitored. Due to the complex geographical environment of the river, the traditional water level measurement method is difficult to implement, so it is decided to use the virtual water gauge method in this technical solution to measure the water level.
[0058] First, the project team identified the riverbanks that required a virtual water gauge. A straight section of the river was selected, where the riverbank was clear and easy to install markers and cameras. Then, based on the needs of the virtual water gauge, the project team identified four non-collinear markers on the riverbank, which could form a stable riverbank plane. The markers were designed in eye-catching colors and shapes to facilitate camera capture and identification.
[0059] The project team then determined the riverbank plane formed by the four markers and selected an elevation base point on this plane. The elevation base point was selected at a location with a known altitude to ensure the accuracy of the subsequent coordinate system. Based on this elevation base point, the project team determined the coordinate origin and constructed an actual coordinate system on the riverbank plane with this origin. In this coordinate system, the project team measured and determined the actual coordinates corresponding to the four markers.
[0060] After completing these steps, the project team successfully established a river bank plane and actual coordinate system that can be used for virtual water gauge measurement. Then, the camera will be used to obtain video frame images within the range of river bank water level changes, and the method in this technical solution will be used to measure the water level.
[0061] 102. Obtain the video frame image to be identified within the range of the river bank water level change through the camera to determine the image coordinates of several markers and determine the homography matrix from the river bank plane to the imaging plane of the camera.
[0062] Place a camera on the river bank or gate, and the camera image includes the range of water level changes. The river bank is an artificially constructed slope that is approximately flat. If it is a gate, you can shoot a vertical and flat wall with water level changes. The photographed part of the bank (wall) can be considered as a plane, that is, the river bank plane; the water level has obvious features on the river bank plane. If the water level can be identified by the edge detection method, it is considered that the water level is on the river bank plane; through the transformation relationship between the river bank plane and the imaging plane of the camera, the image coordinates of the water level can be converted to the actual coordinates of the water level, thereby obtaining the river bank water level value and realizing the function of the virtual water gauge.
[0063] Specifically, the server obtains the historical water level line on the river bank plane, and the river bank water level value corresponding to the historical water level line, so as to determine the change range of the river bank water level line corresponding to the river bank plane according to the historical water level line and the river bank water level value; according to the change range of the river bank water level line, the installation position of the camera is determined, and the camera set at the installation position is determined; through the camera, the river bank video within the change range of the river bank water level line is obtained, and based on the virtual water gauge requirements, the video frame image to be identified in the river bank video is determined.
[0064] In one embodiment, beside a river in a city, in order to continuously and accurately monitor the water level of the river, the relevant departments decided to use the virtual water gauge system of this technical solution. First, the staff collected historical water level line data on the river bank plane, which included water level line records under different conditions such as flood peaks and droughts in recent years. At the same time, the river bank water level values corresponding to these historical water levels were also obtained, which were obtained through traditional manual measurement or other reliable measurement methods.
[0065] With these historical data, the staff conducted a detailed analysis of the data and found that in the past few years, the changes in the water level of the river bank were mainly concentrated in a specific area, which is the range of water level changes that need to be paid special attention to.
[0066] Next, based on the range of the river bank water level, the staff began to look for a suitable location to install the camera. A location was selected that could clearly capture the entire range of the water level and ensure that the camera would not be blocked by trees, buildings, etc. After determining the installation location, a high-resolution, waterproof, and continuously stable camera was selected and installed at the selected location.
[0067] After the camera was installed, the staff began to use the camera to obtain riverbank videos within the range of riverbank water level changes, and transmitted the captured videos to the data center for processing in real time. In the data center, according to the needs of the virtual water gauge, the video frame images to be identified are screened from the captured videos, and these images will be used for subsequent water level recognition and water level value calculation.
[0068] In one embodiment of the present application, the server constructs an image coordinate system corresponding to the video frame image to be identified with the lower left corner of the video frame image to be identified as the origin, the lower boundary of the video frame image to be identified as the X-axis, and the left boundary of the video frame image to be identified as the Y-axis; finds a number of markers in the video frame image to be identified, and determines the image coordinates corresponding to the number of markers based on the image coordinate system corresponding to the video frame image to be identified.
[0069] In one embodiment, in a specific river bank water level monitoring project, the virtual water gauge system of the present technical solution is used. In the image processing link of the system, it is necessary to construct a coordinate system and locate markers for the video frame image to be identified captured by the camera.
[0070] First, a video frame to be recognized is obtained. In order to establish a coordinate system on this image, the lower left corner of the image is selected as the origin of the coordinate system. This choice is based on the conventional practice of image processing and can simplify the subsequent calculation process. Then, a two-dimensional image coordinate system is established with the lower boundary of the image as the X-axis and the left boundary as the Y-axis. In this coordinate system, each pixel can be represented by a specific (x, y) coordinate.
[0071] Then, the previously set markers are searched in the video frame image to be identified. These markers appear as obvious and easy-to-identify feature points in the image. Through the image processing algorithm, the positions of these markers are successfully located. Finally, based on the established image coordinate system, the specific coordinates of these markers in the image are determined, and these coordinates will be used in the subsequent water level recognition and water level value calculation process.
[0072] In one embodiment of the present application, the server determines the actual coordinates and image coordinates corresponding to each marker among a number of markers, and calculates the coordinate transformation relationship from the actual coordinates to the image coordinates; based on the coordinate transformation relationship, determines the plane transformation relationship from the river bank plane to the imaging plane of the camera, and obtains the homography matrix corresponding to the plane transformation relationship.
[0073] In one embodiment, in a river bank monitoring project, in order to realize the coordinate transformation from the river bank plane to the camera imaging plane, the following steps are used to determine the homography matrix. First, four non-collinear markers are selected on the river bank plane, and the actual coordinates of the four markers in the actual coordinate system of the river bank plane have been determined by measurement. These markers are also clearly visible in the image captured by the camera, so these markers can be found in the image and the image coordinates of the markers in the image coordinate system are recorded.
[0074] Next, for each marker, the transformation relationship from its real coordinates to the image coordinates is calculated. This transformation relationship reflects the mapping from the three-dimensional riverbank plane to the two-dimensional image plane. Specifically, this transformation relationship is found by solving a set of linear equations that describe the positional relationship between the markers in the real coordinate system and the image coordinate system.
[0075] After obtaining the coordinate transformation relationship of each marker, these relationships are used to determine the overall transformation relationship from the river bank plane to the camera imaging plane. This overall transformation relationship can be regarded as a homography matrix, which describes the position of any point on the river bank plane on the camera imaging plane.
[0076] In order to obtain this homography matrix, the homography estimation technology in the field of computer vision is used. Specifically, the parameters of the homography matrix are estimated through an optimization algorithm using the known actual coordinates of the markers and the image coordinates as input data. This process can be completed by minimizing the reprojection error and other criteria to ensure that the estimated homography matrix can accurately reflect the transformation relationship from the river bank plane to the camera imaging plane.
[0077] Finally, the homography matrix describing the transformation relationship between the river bank plane and the camera imaging plane was successfully obtained. This matrix will be used in the subsequent water level line recognition and river bank water level value calculation process to achieve more accurate water level monitoring.
[0078] 103. Perform water level recognition based on the video frame image to be recognized, determine the image coordinates corresponding to the water level, and convert the image coordinates of the water level into actual coordinates based on the homography matrix to obtain the corresponding river bank water level value.
[0079] In one embodiment of the present application, before performing water level line recognition based on the video frame image to be recognized, the server blurs the video frame image to be recognized through median filtering, and extracts at least one edge line from the blurred video frame image to be recognized based on an edge detection operator; performs a scaling operation on the at least one extracted edge line, and takes an absolute value operation on the edge line after the scaling operation; converts the edge line after scaling and taking the absolute value into an unsigned 8-bit number to filter the edge line, and determines the edge line of the straight line segment in the filtered edge line through the Hough line detection method.
[0080] In one embodiment, in a water level monitoring project in a certain city, in order to accurately identify the river bank water level line, the technical solution is used to process the video frame image to be identified captured by the camera. First, the video frame image to be identified is subjected to median filtering. Median filtering is a nonlinear filtering method that can effectively remove noise in the image while maintaining good edge information. Through median filtering, the video frame image to be identified is successfully blurred, reducing the noise interference in the image.
[0081] Next, based on the edge detection operator, the edge information in the image can be highlighted, and the edge lines in the image can be extracted by performing a convolution operation on the blurred image. Then, the extracted edge lines are scaled so that the values of the edge lines can be adjusted to a suitable range for subsequent processing. After the scaling operation, the edge lines are taken to their absolute values to ensure that the values of the edge lines are non-negative.
[0082] Next, the edge lines after scaling and taking the absolute value are converted into unsigned 8-bit numbers to filter the edge lines and remove those edge lines with too small values, thereby reducing the complexity of subsequent processing. At the same time, converting the edge lines into unsigned 8-bit numbers is also convenient for storage and transmission. Finally, the edge lines of straight line segments can be accurately identified in the filtered edge lines through the Hough line detection method, thereby successfully determining the position of the riverbank water level line.
[0083] Specifically, based on the horizontal characteristics of the water level line under the action of gravity, the server projects the edge line of the straight line segment into the actual coordinate system to determine the actual coordinates corresponding to the edge line of the straight line segment; according to the actual coordinates, the slope corresponding to the edge line of the straight line segment is calculated to determine the relationship between the slope and a preset threshold; when the slope is less than the preset threshold, the edge line of the straight line segment is determined to be the water level line to be selected, and the image coordinates of the straight line segment corresponding to the water level line to be selected are determined.
[0084] In one embodiment, in a specific riverbank water level monitoring application, the technical solution is used to determine the water level line to be selected. First, based on the characteristic that the water level line always remains horizontal under the action of gravity, the edge lines of the extracted straight line segments are projected from the image coordinate system to the actual coordinate system of the riverbank plane using the previously determined homography matrix. In this way, the corresponding positions of these edge lines in the actual coordinate system are obtained.
[0085] Next, the slopes of the edge lines of these projected straight line segments are calculated. The slope is a measure of the degree of inclination of a straight line. For a horizontal straight line, its slope should be close to zero. According to the coordinates of these edge lines in the actual coordinate system, their slopes are calculated using the slope formula. Then, a preset threshold is set to determine whether the calculated slope is small enough to meet the horizontal characteristics of the water level. The calculated slope is compared with this preset threshold. If the slope is less than the preset threshold, it is considered that this edge line may be a water level line.
[0086] During this comparison process, it was found that the slopes of several edge lines were significantly less than the preset threshold, and these edge lines were horizontal or approximately horizontal in the actual coordinate system. Therefore, these edge lines were determined as candidate water level lines. Finally, the coordinates of these candidate water level lines in the image coordinate system were determined. These coordinates will be used for subsequent water level value calculation and water level change analysis.
[0087] In one embodiment of the present application, the server converts the image coordinates of the straight line segments corresponding to the selected water level line into actual coordinates based on the homography matrix, and determines the maximum vertical coordinate and the minimum vertical coordinate of the selected water level line based on the actual coordinates; removes the selected water level line corresponding to the maximum vertical coordinate and the selected water level line corresponding to the minimum vertical coordinate to determine the corresponding target water level line, and determines the riverbank water level value corresponding to the target water level line.
[0088] Since the river bank has a slope, the vertical coordinate of the actual coordinate multiplied by the sine value of the slope angle is the height difference to the base point of the slope plane. Adding the base elevation value can give the true elevation. Figure 3 This is a schematic diagram of the effect of virtual water gauge recognition on a slope provided in an embodiment of the present application. Figure 3 As shown, since the river bank plane is a slope, the virtual water gauge is displayed on the slope, and the water gauge reading of the virtual water gauge can be intuitively obtained on the slope.
[0089] For the gate wall, since the wall is vertical, the slope angle can be ignored. In addition, the water surface elevation value obtained has a slight jump. In order to eliminate the noise jump of the data, a low-pass filter is used to smooth the data. Figure 4 This is a schematic diagram of the effect of virtual water gauge recognition on a vertical wall provided by an embodiment of the present application. Figure 4As shown, it can be seen that the actual effect of the virtual water ruler reading the water ruler on the vertical wall, and the virtual water ruler is also displayed on the vertical wall.
[0090] In one embodiment, in a certain example of river bank water level monitoring, a series of candidate water level lines and their corresponding image coordinates have been determined through the previous steps. Next, the final target water level line needs to be screened out from these candidate water level lines and its corresponding river bank water level value needs to be determined.
[0091] First, the image coordinates of the straight line segments corresponding to the selected water level are converted to actual coordinates on the riverbank plane using the homography matrix calculated previously. This step is to map the pixel positions in the image to specific positions in the real world, so as to more accurately understand the actual situation of the water level.
[0092] After the conversion is completed, a set of candidate water level lines with actual coordinates is obtained. Next, the ordinates of these water level lines are analyzed to find the maximum and minimum values. These two values represent the highest and lowest positions of the candidate water level lines on the river bank plane, respectively. Then, the candidate water level lines corresponding to these two extreme values are removed. This is because in actual applications, the highest and lowest water level lines may be abnormal due to various factors (such as waves, debris, etc.) and do not represent the actual water level situation. By removing these two abnormal values, the accuracy of water level monitoring can be improved.
[0093] After removing the outliers, the final target water level is determined based on the actual coordinates of the remaining candidate water levels through certain algorithms (such as averaging, median, etc.), so as to reflect the actual situation of the riverbank water level. Finally, the corresponding riverbank water level is calculated based on the actual coordinates of the target water level and the elevation information of the riverbank plane. This water level will be used in subsequent hydrological analysis, flood warning and other work.
[0094] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, the embodiment of this application also provides a river bank virtual water gauge implementation device, whose structure is as follows: Figure 5 shown.
[0095] Figure 5 The internal structure diagram of a river bank virtual water gauge implementation device provided in the embodiment of the present application. Figure 5 As shown, the device includes:
[0096] at least one processor;
[0097] and, a memory communicatively coupled to the at least one processor;
[0098] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to:
[0099] Determine a river bank plane formed by a number of markers on the river bank, and determine actual coordinates corresponding to the number of markers on the river bank plane;
[0100] The video frame images to be identified within the range of the river bank water level change are obtained through the camera to determine the image coordinates of several markers and determine the homography matrix from the river bank plane to the imaging plane of the camera;
[0101] The water level line is identified based on the video frame image to be identified, the image coordinates corresponding to the water level line are determined, and based on the homography matrix, the image coordinates of the water level line are converted into actual coordinates to obtain the corresponding river bank water level value.
[0102] The present application also provides a non-volatile computer storage medium storing computer executable instructions. When the computer executable instructions are executed, they can:
[0103] Determine a river bank plane formed by a number of markers on the river bank, and determine actual coordinates corresponding to the number of markers on the river bank plane;
[0104] The video frame images to be identified within the range of the river bank water level change are obtained through the camera to determine the image coordinates of several markers and determine the homography matrix from the river bank plane to the imaging plane of the camera;
[0105] The water level line is identified based on the video frame image to be identified, the image coordinates corresponding to the water level line are determined, and based on the homography matrix, the image coordinates of the water level line are converted into actual coordinates to obtain the corresponding river bank water level value.
[0106] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0107] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0108] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0110] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0111] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0113] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0114] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0115] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0116] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0117] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for realizing a river bank virtual water gauge, characterized in that: The method comprises: Determine a river bank plane formed by a plurality of markers on the river bank, and determine actual coordinates corresponding to the plurality of markers on the river bank plane; Acquire the video frame image to be identified within the range of the river bank water level change through the camera to determine the image coordinates of the plurality of markers, and determine the homography matrix from the river bank plane to the imaging plane of the camera; Perform water level recognition based on the video frame image to be recognized, determine the image coordinates corresponding to the water level, and convert the image coordinates of the water level into actual coordinates based on the homography matrix to obtain the corresponding riverbank water level value; Before performing water level recognition based on the video frame image to be recognized, the method further includes: The video frame image to be identified is blurred by median filtering, and at least one edge line is extracted from the blurred video frame image to be identified based on an edge detection operator; Performing a scaling operation on at least one edge line extracted, and taking an absolute value operation on the edge line after the scaling operation; The edge lines after scaling and taking the absolute value are converted into unsigned 8-bit numbers to filter the edge lines, and the edge lines of the straight line segments are determined in the filtered edge lines by using the Hough line detection method; The step of identifying a water level line based on the video frame image to be identified and determining the image coordinates corresponding to the water level line specifically includes: Based on the horizontal characteristics of the water level under the action of gravity, the edge line of the straight line segment is projected into the actual coordinate system to determine the actual coordinates corresponding to the edge line of the straight line segment; Calculating the slope of the edge line of the straight line segment according to the actual coordinates to determine the magnitude relationship between the slope and a preset threshold; In the case where the slope is less than the preset threshold, determining the edge line of the straight line segment as a water level line to be selected, and determining the image coordinates of the straight line segment corresponding to the water level line to be selected; The step of converting the image coordinates of the water level line into actual coordinates based on the homography matrix to obtain the corresponding riverbank water level value specifically includes: Based on the homography matrix, the image coordinates of the straight line segment corresponding to the selected water level line are converted into actual coordinates, and based on the actual coordinates, the maximum vertical coordinate and the minimum vertical coordinate of the selected water level line are determined; Remove the candidate water level line corresponding to the maximum ordinate and the candidate water level line corresponding to the minimum ordinate to determine the corresponding target water level line, and determine the riverbank water level value corresponding to the target water level line; The determining of the image coordinates of the plurality of markers specifically includes: Taking the lower left corner of the video frame image to be identified as the origin, the lower boundary of the video frame image to be identified as the X-axis, and the left boundary of the video frame image to be identified as the Y-axis, constructing an image coordinate system corresponding to the video frame image to be identified; Finding the plurality of markers in the to-be-identified video frame image, and determining image coordinates corresponding to the plurality of markers based on an image coordinate system corresponding to the to-be-identified video frame image; The determining of the homography matrix from the river bank plane to the imaging plane of the camera specifically includes: For each of the plurality of markers, determining the actual coordinates and the image coordinates corresponding to the marker, and calculating a coordinate transformation relationship from the actual coordinates to the image coordinates; Based on the coordinate transformation relationship, a plane transformation relationship from the river bank plane to the imaging plane of the camera is determined, and a homography matrix corresponding to the plane transformation relationship is obtained.
2. A method for realizing a riverbank virtual water gauge according to claim 1, characterized in that: The determining of a river bank plane formed by a plurality of markers on the river bank, and determining actual coordinates corresponding to the plurality of markers on the river bank plane, specifically includes: Determine a river bank having a virtual water gauge requirement, and determine a plurality of markers at non-collinear points on the river bank based on the virtual water gauge requirement; Determine a river bank plane formed by the plurality of markers, and determine elevation base points in the river bank plane; A coordinate origin is determined based on the elevation base point, so as to construct an actual coordinate system on the river bank plane based on the coordinate origin, and actual coordinates corresponding to the plurality of markers are determined in the actual coordinate system of the river bank plane.
3. A method for realizing a riverbank virtual water gauge according to claim 1, characterized in that: The step of obtaining the video frame image to be identified within the range of the river bank water level change through the camera specifically includes: Acquire a historical water level line on the river bank plane, and a river bank water level value corresponding to the historical water level line, so as to determine a change range of the river bank water level line corresponding to the river bank plane according to the historical water level line and the river bank water level value; Determine the installation position of the camera according to the change range of the river bank water level line, and determine the camera to be set at the installation position; The camera is used to obtain a riverbank video within the range of the riverbank water level change, and based on the virtual water gauge requirement, a video frame image to be identified in the riverbank video is determined.
4. A river bank virtual water gauge implementation device, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method for implementing a riverbank virtual water gauge as described in any one of claims 1-3.
5. A non-volatile computer storage medium storing computer executable instructions, characterized in that: When the computer executable instructions are executed, a method for realizing a riverbank virtual water gauge as described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Variable-length water gauge water level detection method and device based on water gauge color information and storage medium
CN112907506A
Water gauge-free water level reading method and device and computer readable storage medium
CN116863128A