Virtual water gauge display method, equipment and medium
Through calculating homography matrix and perspective transformation technology, the problem of unstable display of virtual water rulers in traditional water level monitoring is solved, and the accurate display and real-time monitoring of virtual water rulers are achieved.
Patent Information
- Application Number
- CN202510305856.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-07-04
AI Technical Summary
Traditional water level monitoring relies on physical water rulers, is susceptible to environmental influences, is difficult to maintain and cannot be monitored remotely in real time. When the virtual water ruler is directly superimposed, the display content is distorted and misaligned due to changes in the camera's viewing angle.
By acquiring the video frame images, calculating the homographic matrix of the reference coordinate system and the image coordinate system, generating a virtual canvas and performing perspective transformation, drawing the virtual water ruler reading information, and realizing the display of the virtual water ruler.
It realizes the accurate superposition of virtual water ruler reading information, adapts to camera shooting at different angles and positions, avoids distortion or misalignment of display content, and ensures the accuracy and reliability of monitoring results.
Smart Images

Figure CN120259489A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of water level detection, and particularly relates to a method, device, and medium for virtual water gauge display. Background Art
[0002] Traditional water level monitoring mainly relies on physical water gauges. It is necessary to fixedly install physical water gauges at the monitoring points, which are easily affected by environmental factors such as floods and corrosion, difficult to maintain in the long term, and require on-site personnel to read data, making it impossible to perform real-time remote monitoring. Therefore, a method for virtual water gauge reading recognition has been proposed. By virtually creating a water gauge in a video image, a digital representation of the water level is achieved. After identifying and reading the virtual water gauge, it is necessary to display the virtual water gauge scale, the current reading scale mark, the reading value, and other relevant information on the video frame for intuitive display of the reading result and relevant information. However, when directly superimposing the digital water gauge on the video image, due to ignoring the change in the camera's perspective, the displayed content often becomes distorted and misaligned with the scene, resulting in a rigid visual effect. Summary of the Invention
[0003] To solve the above problems, this application proposes a method for virtual water gauge display, including: Obtain a video frame image corresponding to the water surface to be detected; Calculate a first homography matrix for converting the reference coordinate system to the image coordinate system according to the reference coordinates of the preset marker points in the reference coordinate system and the image coordinates in the video frame image; wherein, the marker points are located on the riverbank; Determine the reference point of the water surface to be detected in the reference coordinate system, and determine the image coordinates corresponding to the information display panel according to the relative position relationship between the reference point and the preset information display panel and the first homography matrix; Generate a virtual canvas corresponding to the information display panel, and superimpose the perspective-transformed virtual canvas on the video frame image according to the second homography matrix between the virtual canvas coordinates of the virtual canvas and the image coordinates; Based on the virtual canvas, draw the virtual water gauge reading information corresponding to the water surface to be detected, so as to realize the display of the virtual water gauge through the virtual water gauge reading information.
[0004] In an implementation manner of this application, determining the reference point of the water surface to be detected in the reference coordinate system specifically includes: Determine the abscissa boundary value of the water surface line segment in the reference coordinate system according to the water surface line segment presented by the water surface to be detected in the video frame image; Calculate the mean value between the abscissa boundary values, use the mean value as the abscissa, and use the virtual water gauge reading corresponding to the water surface to be detected as the ordinate to locate the reference point of the water surface to be detected in the reference coordinate system.
[0005] In an implementation manner of the present application, according to the relative position relationship between the reference point and a preset information display panel and the first homography matrix, determine the image coordinates corresponding to the information display panel, specifically including: Determine the corner points corresponding to the preset information display panel; According to the relative position relationship between the reference point and a specified corner point among the corner points, determine the corner point reference coordinates of each corner point in the reference coordinate system; According to the first homography matrix, convert the corner point reference coordinates into the image coordinates in the image coordinate system corresponding to the video frame image, so as to obtain the image coordinates corresponding to each corner point in the information display panel.
[0006] In an implementation manner of the present application, according to the relative position relationship between the reference point and a specified corner point among the corner points, determine the corner point reference coordinates of each corner point in the reference coordinate system, specifically including: According to the relative position relationship between the reference point and a specified corner point among the corner points, determine the coordinate offset between the reference point and the specified corner point, and according to the coordinate offset, calculate the corner point reference coordinates corresponding to the specified corner point among the corner points; Determine the size information corresponding to the information display panel, and according to the size information and the corner point reference coordinates corresponding to the specified corner point, determine the corner point reference coordinates corresponding to other corner points except the specified corner point among the corner points.
[0007] In an implementation manner of the present application, generate a virtual canvas corresponding to the information display panel, specifically including: Determine the canvas size information of the virtual canvas corresponding to the information display panel; wherein, the size ratio corresponding to the canvas size information is the same as the size ratio corresponding to the size information; Establish the corresponding relationship between the canvas corner points in the virtual canvas and each corner point in the information display panel, and based on the corresponding relationship, determine the canvas reference coordinates corresponding to the canvas corner points according to the canvas size information; Generate a virtual canvas corresponding to the information display panel according to the canvas reference coordinates.
[0008] In an implementation manner of the present application, based on the virtual canvas, draw the virtual water gauge reading information corresponding to the water surface to be detected, specifically including: Determine the reading elements required for the virtual water gauge and the reference coordinates of the reading elements in the reference coordinate system; wherein, the reading elements include water gauge graduations, graduation labels, and water level marks; Based on the virtual canvas, according to the first homography matrix, convert the reference coordinates corresponding to the reading elements into image coordinates in the image coordinate system, so as to draw the virtual water gauge reading information corresponding to the water surface to be detected.
[0009] In an implementation manner of the present application, before calculating the first homography matrix for converting the reference coordinate system to the image coordinate system according to the reference coordinates of the preset marking points in the reference coordinate system and the image coordinates in the video frame image of the water surface to be detected, the method further includes: Based on the reference surface corresponding to the water surface to be detected, determine the origin of the reference coordinate system; wherein, the reference surface includes a wall and a shore slope; Use the axis of the water surface line passing through the origin and parallel to the water surface to be detected as the horizontal axis, and use the axis perpendicular to the horizontal axis as the vertical axis to construct the reference coordinate system.
[0010] In an implementation manner of the present application, before superimposing the virtual canvas onto the video frame image, the method further includes: Based on the virtual canvas, generate the reading features required for reading the virtual water gauge by means of anti-aliasing; The display of the virtual water gauge is realized through the virtual water gauge reading information, which specifically includes: According to the virtual water gauge reading information, determine the feature values corresponding to the reading features, and display the feature values on the virtual canvas to realize the display of the virtual water gauge.
[0011] An embodiment of the present application provides a virtual water gauge display device, and the device includes: At least one processor; And a memory communicatively connected to the at least one processor; Wherein, 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 virtual water gauge display method as described in any one of the above.
[0012] An embodiment of the present application provides a non-volatile computer storage medium, storing computer-executable instructions, and the computer-executable instructions are set as: A virtual water gauge display method as described in any one of the above.
[0013] The virtual water gauge display method proposed by the present application can bring the following beneficial effects: Use the homography matrix for coordinate transformation to accurately overlay the virtual water gauge reading information onto the video image through the virtual canvas, enabling the virtual canvas to move with the water gauge reading and adapt to camera shooting at different angles and positions, avoiding distortion or misalignment of the displayed content, and ensuring the accuracy and reliability of the monitoring results. Description of the Drawings
[0014] The drawings described herein are used to provide a further understanding of the present application and form 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 of the present application. In the drawings: Figure 1 It is a schematic flowchart of a virtual water gauge display method provided by an embodiment of the present application; Figure 2 It is a schematic diagram of a virtual water gauge provided by an embodiment of the present application; Figure 3 It is a schematic diagram of the actual use of a virtual water gauge provided by an embodiment of the present application; Figure 4 It is a schematic structural diagram of a virtual water gauge display device provided by an embodiment of the present application. Detailed Description of the Embodiments
[0015] To make the objectives, technical solutions, and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0016] The following will detail the technical solutions provided by each embodiment of the present application in conjunction with the drawings.
[0017] As Figure 1 shown, a virtual water gauge display method provided by an embodiment of the present application includes: S101: Obtain the video frame image corresponding to the water surface to be detected.
[0018] The virtual water gauge technology obtains the video frame image of the water surface to be detected in real time through a camera, analyzes the water level line in the video frame image, and thereby reads the water level data. After the virtual water gauge recognizes the reading, it is necessary to display the specific virtual water gauge reading information in the video frame for the user to read more intuitively.
[0019] When displaying the virtual water gauge in the video frame image, if the virtual water gauge reading information is directly displayed in the video frame, this static content overlay cannot adapt to the perspective changes of the camera. Once the camera moves and causes changes to the wall surface in the video, the reading information will be distorted, resulting in misalignment with the actual detection scenario and causing perspective distortion.
[0020] S102: Calculate a first homography matrix for converting the reference coordinate system to the image coordinate system based on the reference coordinates of the preset marker points in the reference coordinate system and the image coordinates in the video frame image; wherein, the marker points are located on the riverbank.
[0021] When implementing the virtual water gauge, two coordinate systems need to be used. One is the image coordinate system where the video frame is located, and the other is the coordinate system aligned with the physical world. If we want to achieve the adaptation of the virtual water gauge reading to the actual physical world, we need to clarify the actual positions or shapes of different objects in the physical space, and then through the conversion relationship between the two coordinate systems, map the objects to the image coordinate system, thereby realizing perspective distortion compensation, adapting the virtual water gauge reading information to the current scene, and eliminating the perspective distortion of the camera.
[0022] Based on the reference plane corresponding to the water surface to be detected, determine the origin of the reference coordinate system. Here, the reference plane includes the wall and the bank slope. Select any point on the reference plane as the origin, take the axis of the water surface line passing through the origin and parallel to the water surface to be detected as the horizontal axis, and take the axis perpendicular to the horizontal axis as the vertical axis to construct the reference coordinate system.
[0023] Set marker points on the riverbank for placing corresponding markers. When setting the marker points, at least 4 non-collinear marker points need to be arranged. The marker points should cover the main range of the monitoring area to ensure that the homography matrix covers the effective area. After setting the marker points, measure the reference coordinates of the marker points in the reference coordinate system, and photograph the marker points through the camera to record the image coordinates of the marker points in the video frame image. Solve the first homography matrix between the two through the conversion relationship between the reference coordinates and the image coordinates. The first homography matrix can map the objects in the reference coordinate system to the image coordinate system to achieve perspective distortion compensation.
[0024] S103: Determine the reference point of the water surface to be detected in the reference coordinate system, and determine the image coordinates corresponding to the information display panel based on the relative position relationship between the reference point and the preset information display panel and the first homography matrix.
[0025] When the virtual water gauge displays the reading information, it needs to be realized through the information display panel. The information display panel also needs to be perspective-transformed into the image coordinate system so that the panel can follow the change of the camera's perspective and paste the corresponding virtual water gauge reading information onto the shore or wall surface in the video frame image for display, thus achieving the effect of augmented reality. The information display panel mentioned here is virtually defined and does not actually exist in the physical world, and is used to represent the physical size and position of the virtual water gauge in the physical world.
[0026] When determining the panel coordinates corresponding to the information display panel, it needs to be based on the reference point in the reference coordinate system. After determining the reference point of the water surface to be detected in the reference coordinate system, according to the relative position relationship between the reference point and the preset information display panel and the first homography matrix, the coordinates of each corner point in the information display panel are transformed into image coordinates, so as to determine the position of the information display panel in the video frame image. As Figure 2 shown, the reference point is located in the lower left part of the information display panel. As a fixed reference point determined according to the water surface to be detected, the reference point can provide a spatial alignment reference for the homography matrix projection, and can also be associated with the actual water level height, directly establishing a mapping with the virtual water gauge reading to realize the water level detection of the water surface to be detected.
[0027] In one embodiment, the reference point is the positioning anchor point of the panel in the reference coordinate system, and its position should remain fixed during the water level detection process to ensure the reliability of the detection result. In the embodiment of the present application, the reference point is represented as the midpoint of the water surface boundary. When determining the reference point, it can be determined according to the position information of the water surface to be detected. The water surface to be detected appears as a horizontal line segment in the video frame image. Use the edge detection or line segment extraction algorithm to identify the boundary points of the water surface in the image and obtain its abscissa boundary values. The abscissa boundary values refer to the maximum abscissa and the minimum abscissa of the water surface line segment in the reference coordinate system. Take the middle position of the left and right boundaries, that is, the mean value of the abscissa boundary values as the abscissa of the reference point, and take the virtual water gauge reading of the water surface to be detected, that is, the water level height as the ordinate of the reference point. At this time, according to the abscissa and ordinate, the center of the water surface in the water surface to be detected can be located, and this point is the reference point of the water surface to be detected in the reference coordinate system.
[0028] In one embodiment, after determining the reference point, it is necessary to position the position of the pre-defined information display panel in the reference coordinate system based on this reference point. The information display panel is usually rectangular and has four corner points. Since the reference point is located in the lower left part of the information display panel, when positioning the information display panel, the lower left corner point is used as the positioning reference to sequentially determine the corner reference coordinates of each corner point.
[0029] Specifically, according to the relative positional relationship between the reference point and the specified corner point (i.e., the bottom left corner point) among the corner points, the corner reference coordinates of each corner point in the reference coordinate system are determined. Then, according to the first homography matrix, the corner reference coordinates are transformed into the image coordinates in the corresponding image coordinate system of the video frame image, so as to obtain the image coordinates corresponding to each corner point in the information display panel.
[0030] It should be noted that when determining the corner reference coordinates corresponding to each corner point, first, the coordinate offset between the reference point and the specified corner point needs to be determined according to the relative positional relationship between the reference point and the specified corner point among all the corner points. Then, according to the coordinate offset, the corner reference coordinates corresponding to the specified corner point among the corner points are calculated. Specifically, it is expressed as: , where the corner reference coordinates of the specified corner point are , is the reference point coordinate, respectively represent the coordinate offsets of the specified corner point and the reference point on the x-axis and y-axis.
[0031] The other corner points refer to the corner points except the specified corner point among the corner points, including the upper left corner point, the lower right corner point, and the upper right corner point. The corner reference coordinates of these corner points are successively expressed as: 、 、 .
[0032] The corner reference coordinates of the other corner points can be specifically obtained through the following method:
[0033]
[0034]
[0035] After obtaining the corner reference coordinates corresponding to each corner point, according to the first homography matrix, its coordinate transformation is performed to obtain the image coordinates corresponding to the corner point.
[0036] The image coordinates of each corner point are expressed as: Bottom left corner point ; Upper left corner point ; Lower right corner point ; Upper right corner point .
[0037] S104: Generate a virtual canvas corresponding to the information display panel, and according to the second homography matrix between the virtual canvas coordinates and the image coordinates of the virtual canvas, perform perspective transformation on the virtual canvas and superimpose it on the video frame image.
[0038] After determining the coordinate information corresponding to the information display panel, if the information display panel is directly drawn on the video frame image, when the camera's perspective is tilted, the panel needs to be displayed as a trapezoid to fit the wall surface. Direct drawing requires pixel-by-pixel calculation of the deformation, with a complex algorithm and a large amount of calculation. Therefore, a virtual canvas is used as an independent buffer to pre-draw the content of the information panel, such as scales, text, arrows, etc. The corresponding canvas size is decoupled from the physical size of the information display panel, enabling adaptation to devices with different resolutions. Then, based on the second homography matrix between the virtual canvas coordinates and the image coordinates of the virtual canvas, the perspective transformation of the entire canvas can be completed at once without pixel-by-pixel calculation. In this way, the deformed panel will automatically match the shape of the wall surface, efficiently adapting to the real water surface detection scenario.
[0039] Therefore, it is necessary to generate a virtual canvas based on the coordinate information of the information display panel. At this time, the generated virtual canvas is still in the reference coordinate system. It is also necessary to superimpose the perspective-transformed virtual canvas onto the video frame image based on the second homography matrix between the virtual canvas coordinates and the image coordinates of the virtual canvas. In this way, when the shape of the wall surface in the video changes due to the movement of the camera, the second homography matrix will recalculate the coordinates of the virtual canvas according to the new perspective. By superimposing the virtual canvas and the video frame image, dynamic perspective adaptation of the virtual water gauge can be achieved, enabling the information display panel to naturally deform with the camera's perspective and closely fit the physical surface.
[0040] In one embodiment, when generating the virtual canvas, first, it is necessary to determine the canvas size information of the virtual canvas corresponding to the information display panel. The canvas size information includes the canvas length and the canvas width , and the size ratio corresponding to the canvas size information is the same as the size ratio corresponding to the size information, that is, . After clarifying the size ratio of the virtual canvas, it is also necessary to establish the correspondence between the canvas corner points in the virtual canvas and the corner points in the information display panel, that is, the upper left corner point corresponds to the upper left canvas corner point, and the upper right corner point corresponds to the upper right canvas corner point. In this way, based on the above correspondence, the canvas reference coordinates corresponding to the canvas corner points can be determined according to the canvas size information, and then the virtual canvas corresponding to the information display panel can be generated according to the canvas reference coordinates.
[0041] Among them, the canvas reference coordinate corresponds to the lower left corner point , corresponds to the lower right corner point , corresponds to the upper right corner point , corresponds to the upper left corner point .
[0042] In addition, before superimposing the virtual canvas on the video frame image, it is also necessary to generate reading features required for reading the virtual water gauge based on the virtual canvas, such as Figure 2 As shown, the reading features include the water gauge reading, the reading unit, the number of features, the current reading time, etc. When generating the reading features, for example, anti-aliasing methods are used when generating lines and text to enhance the drawing effect.
[0043] S105: Based on the virtual canvas, draw the virtual water gauge reading information corresponding to the water surface to be detected, so as to realize the display of the virtual water gauge through the virtual water gauge reading information.
[0044] After superimposing the virtual canvas on the video frame image, an information display panel capable of realizing virtual water gauge reading is obtained. The background color of the information display panel is semi-transparent gray, and the rest is opaque. When reading through the virtual water gauge, the virtual water gauge reading information corresponding to the water surface to be detected can be drawn through the virtual canvas superimposed on the video frame image. In this way, through the virtual water gauge reading information and the previously generated reading features, the display of the virtual water gauge can be realized. During the display process, the virtual water gauge will be close to the wall or the shore, and can undergo real-time perspective deformation as the wall and other objects change, and move with the water gauge reading, making the display effect more intuitive.
[0045] When drawing the virtual water gauge reading information, it is first necessary to determine the reading elements required for the virtual water gauge and the reference coordinates of the reading elements in the reference coordinate system. The reading elements include the water gauge scale, the scale label, and the water level mark. The abscissa of the scale head of the water gauge scale is the abscissa of the reference point, and the abscissa of the scale tail is , is the length of the scale line. The scale ordinate can be based on the ordinate of the reference point and take integer values at equal scale intervals upward and downward. Every 10 scales determine a marked scale. The method for determining the position of the water level mark is similar to that of the water gauge scale. In the embodiment of the present application, the water level mark uses an arrow mark, and the reference coordinates of its arrow are the reference point coordinates, and the arrow tail coordinates are , represents the arrow length.
[0046] After clarifying the reference coordinates of each reading element, based on the virtual canvas, according to the first homography matrix, the reference coordinates corresponding to the reading elements are converted into image coordinates in the image coordinate system, so as to draw the virtual water gauge reading information corresponding to the water surface to be detected. So far, as Figure 4 shown, the virtual water gauge reading information is pasted on the shore or the wall surface in the video frame image. No matter how the camera perspective moves, the virtual water gauge reading information can convert the deviation of the actual physical position into the position change in the image through the coordinate transformation relationship established by the homography matrix, achieving the effect that the water gauge reading moves with the picture.
[0047] Of course, when the virtual water gauge is displayed, it will also determine the characteristic value corresponding to the reading characteristic according to the actual virtual water gauge reading information, that is, the water gauge scale. In this way, by displaying the characteristic value on the virtual canvas in real time, the water surface detection result can be more intuitively presented to the user. As Figure 2 shown, the reading characteristics include water gauge reading, reading unit, number of characteristics, reading time, etc. After the water level is determined according to the virtual water gauge reading information (water gauge scale and water level mark), the corresponding numerical value is displayed on the virtual canvas in the form of a characteristic value. Other reading characteristics except the water level value can be displayed by calling the background data.
[0048] The above is the method embodiment proposed by this application. Based on the same idea, some embodiments of this application also provide the device and non-volatile computer storage medium corresponding to the above method.
[0049] Figure 4 FIG. is a schematic structural diagram of a virtual water gauge display device provided by an embodiment of this application. As Figure 4 shown, it includes: At least one processor; and, A memory communicatively connected to at least one processor; wherein, The memory stores instructions executable by at least one processor, and the instructions are executed by at least one processor so that at least one processor can execute a virtual water gauge display method as described in any one of the above.
[0050] An embodiment of this application provides a non-volatile computer storage medium, storing computer-executable instructions, and the computer-executable instructions are set as: A virtual water gauge display method as described in any one of the above.
[0051] The various embodiments in this application are all described in a progressive manner. For the same or similar parts among the various embodiments, reference can be made to each other. 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 for the relevant parts, reference can be made to the partial description of the method embodiments.
[0052] The device and medium provided by the embodiments of this application correspond one-to-one with the method. Therefore, the device and medium also have beneficial technical effects similar to those of the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the device and medium will not be elaborated here.
[0053] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0054] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0055] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0056] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0057] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0058] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0059] A computer-readable medium includes permanent and non-permanent, removable and non-removable media that can implement information storage by any method or technology. The 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 technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0060] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "including one..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0061] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A virtual water gauge display method, characterized in that, The method includes: Obtaining a video frame image corresponding to the water surface to be detected; Calculating a first homography matrix for converting the reference coordinate system to the image coordinate system according to the reference coordinates of preset marker points in the reference coordinate system and the image coordinates in the video frame image; wherein, the marker points are located on the river bank; Determining a reference point of the water surface to be detected in the reference coordinate system, and determining the image coordinates corresponding to the information display panel according to the relative position relationship between the reference point and the preset information display panel and the first homography matrix; Generating a virtual canvas corresponding to the information display panel, and performing perspective transformation on the virtual canvas and superimposing it on the video frame image according to a second homography matrix between the virtual canvas coordinates of the virtual canvas and the image coordinates; Based on the virtual canvas, drawing virtual water gauge reading information corresponding to the water surface to be detected, so as to realize the display of the virtual water gauge through the virtual water gauge reading information.
2. The virtual water gauge display method according to claim 1, wherein Determining a reference point of the water surface to be detected in the reference coordinate system specifically includes: Determining the abscissa boundary values of the water surface line segment in the reference coordinate system according to the water surface line segment presented by the water surface to be detected in the video frame image; Calculating the mean value between the abscissa boundary values, taking the mean value as the abscissa, and taking the virtual water gauge reading corresponding to the water surface to be detected as the ordinate to locate the reference point of the water surface to be detected in the reference coordinate system.
3. A virtual water gauge display method according to claim 1, characterized in that Determining the image coordinates corresponding to the information display panel according to the relative position relationship between the reference point and the preset information display panel and the first homography matrix specifically includes: Determining the corner points corresponding to the preset information display panel; Determining the corner point reference coordinates of each corner point in the reference coordinate system according to the relative position relationship between the reference point and a specified corner point among the corner points; Converting the corner point reference coordinates into the image coordinates in the image coordinate system corresponding to the video frame image according to the first homography matrix to obtain the image coordinates corresponding to each corner point in the information display panel.
4. A virtual water gauge display method according to claim 3, characterized in that, Determining the corner point reference coordinates of each corner point in the reference coordinate system according to the relative position relationship between the reference point and a specified corner point among the corner points specifically includes: Determining the coordinate offset between the reference point and the specified corner point according to the relative position relationship between the reference point and the specified corner point among the corner points, and calculating the corner point reference coordinates corresponding to the specified corner point among the corner points according to the coordinate offset; Determining the size information corresponding to the information display panel, and determining the corner point reference coordinates corresponding to the other corner points except the specified corner point among the corner points according to the size information and the corner point reference coordinates corresponding to the specified corner point.
5. A virtual water gauge display method according to claim 4, characterized in that, Generating a virtual canvas corresponding to the information display panel specifically includes: Determining the canvas size information of the virtual canvas corresponding to the information display panel; wherein, the size ratio corresponding to the canvas size information is the same as the size ratio corresponding to the size information; Establish the correspondence between the canvas corner points in the virtual canvas and the corner points in the information display panel. Based on this correspondence and according to the canvas size information, determine the canvas reference coordinates corresponding to the canvas corner points; Generate the virtual canvas corresponding to the information display panel according to the canvas reference coordinates.
6. A virtual water gauge display method according to claim 1, characterized in that Based on the virtual canvas, draw the virtual water gauge reading information corresponding to the water surface to be detected, specifically including: Determine the reading elements required for the virtual water gauge and their reference coordinates in the reference coordinate system; among them, the reading elements include water gauge scales, scale labels, and water level marks; Based on the virtual canvas, according to the first homography matrix, convert the reference coordinates corresponding to the reading elements into image coordinates in the image coordinate system, so as to draw the virtual water gauge reading information corresponding to the water surface to be detected.
7. A virtual water gauge display method according to claim 1, characterized in that, Before calculating the first homography matrix for converting the reference coordinate system to the image coordinate system according to the reference coordinates of the preset marker points in the reference coordinate system and the image coordinates in the video frame image of the water surface to be detected, the method further includes: Based on the reference surface corresponding to the water surface to be detected, determine the origin of the reference coordinate system; among them, the reference surface includes a wall and a shore slope; Take the axis of the water surface line passing through the origin and parallel to the water surface to be detected as the horizontal axis, and take the axis perpendicular to the horizontal axis as the vertical axis to construct the reference coordinate system.
8. A virtual water gauge display method according to claim 1, characterized in that, Before superimposing the virtual canvas onto the video frame image, the method further includes: Based on the virtual canvas, generate the reading features required for reading the virtual water gauge by an anti-aliasing method; Realize the display of the virtual water gauge through the virtual water gauge reading information, specifically including: According to the virtual water gauge reading information, determine the feature values corresponding to the reading features, and display the feature values on the virtual canvas to realize the display of the virtual water gauge.
9. A virtual water gauge display device, characterized in that, The device includes: At least one processor; And a memory communicatively connected to the at least one processor; Wherein, 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 virtual water gauge display method according to any one of claims 1-8.
10. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are set as: A virtual water gauge display method according to any one of claims 1-8.