A water level gauge image analysis method and device, a storage medium and an electronic device
By acquiring the marked values and scale counts from the water level gauge image and performing mathematical calculations based on the tilt angle, the problem of inconvenient water level gauge readings was solved, enabling rapid and accurate readings even in adverse weather conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NORTHWEST INST OF ECO ENVIRONMENT & RESOURCES CAS
- Filing Date
- 2023-09-18
- Publication Date
- 2026-04-24
AI Technical Summary
In existing technologies, water level gauges are inconvenient to read and difficult to read quickly in adverse weather conditions, especially when they are installed on bridge supports in the middle of a river.
By acquiring the target image, identifying the marking values, scale counts, and tilt angles on the water level gauge, and combining mathematical calculations to obtain the water level value, the water level gauge image is analyzed using digital image processing technology and convolutional neural networks.
It enables rapid and accurate acquisition of water level values under adverse weather conditions, avoiding the difficulties of manual reading and improving the convenience and accuracy of reading.
Smart Images

Figure CN117011849B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image recognition, and more specifically, to a method, apparatus, storage medium, and electronic device for analyzing water level gauge images. Background Technology
[0002] Water level is a crucial indicator reflecting the rise and fall of water bodies such as rivers and reservoirs. Understanding water level changes is essential for effective planning, construction, and management of water-related projects, flood control and drought relief, and the evacuation of people to safer areas. A water level gauge is a device used to measure the elevation of the water surface at designated locations in rivers, lakes, or other water bodies. It is made of metal or non-metal materials and is marked with graduations, typically with an accuracy measured in centimeters. In hydraulics, a 1-meter interval is generally used.
[0003] Water level gauges are commonly installed in reservoirs and irrigation areas to record real-time water levels. Water level readings are typically done manually. However, since some water level gauges are located on bridge supports in the middle of rivers, manual reading is inconvenient, especially in adverse weather conditions. Therefore, how to conveniently and quickly read water level gauge data has become a concern for those skilled in the art. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, storage medium, and electronic device for analyzing water level gauge images, so as to at least partially improve the above-mentioned problems.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0006] In a first aspect, embodiments of this application provide a method for analyzing water level gauge images, the method comprising:
[0007] Acquire a target image, the target image including image information of the target area where the target water level gauge is located;
[0008] Based on the target image, obtain the identification value, the scale line count value, and the water level gauge tilt angle;
[0009] Wherein, the marked value is the first value of the target water level gauge on the water level line, the scale line count value is the number of scale lines between the marked value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired.
[0010] The water level value corresponding to the water level line is obtained based on the identification value, the scale line count value, and the tilt angle of the water level gauge.
[0011] Secondly, embodiments of this application provide a water level gauge image analysis device, the device comprising:
[0012] An information acquisition unit is used to acquire a target image, the target image including image information of the target area where the target water level gauge is located;
[0013] The processing unit is used to obtain the identification value, scale line count value, and water level gauge tilt angle based on the target image;
[0014] Wherein, the marked value is the first value of the target water level gauge on the water level line, the scale line count value is the number of scale lines between the marked value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired.
[0015] The processing unit is also used to obtain the water level value corresponding to the water level line based on the identification value, the scale line count value and the tilt angle of the water level gauge.
[0016] Thirdly, embodiments of this application provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described method.
[0017] Fourthly, embodiments of this application provide an electronic device, the electronic device comprising: a processor and a memory, the memory being used to store one or more programs; when the one or more programs are executed by the processor, the above-described method is implemented.
[0018] Compared to existing technologies, this application provides a water level gauge image analysis method, apparatus, storage medium, and electronic device, comprising: acquiring a target image, the target image including image information of the target area where the target water level gauge is located; acquiring a marker value, a scale count value, and a water level gauge tilt angle based on the target image; wherein, the marker value is the first value of the target water level gauge on the water level line, the scale count value is the number of scale lines between the marker value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired; and acquiring the water level value corresponding to the water level line based on the marker value, the scale count value, and the water level gauge tilt angle. By separately identifying the marker value and the scale count value, mutual interference is avoided, ensuring the accuracy of the identification results. Mathematical operations are then performed on the water level gauge tilt angle and the acquired marker value and scale count value to obtain the true and accurate water level value corresponding to the water level line.
[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0022] Figure 2 An overview diagram of the front-end data acquisition system provided in this application embodiment;
[0023] Figure 3 This is a flowchart illustrating a water level gauge image analysis method provided in an embodiment of this application.
[0024] Figure 4 This is a schematic diagram of the deviation under tilted conditions provided in an embodiment of this application;
[0025] Figure 5 This is a schematic diagram of a water level gauge image analysis device provided in an embodiment of this application.
[0026] In the diagram: 10-Processor; 11-Memory; 12-Bus; 13-Communication Interface; 201-Information Acquisition Unit; 202-Processing Unit. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0028] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0029] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0030] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0031] In the description of this application, it should be noted that the terms "upper", "lower", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship that the product of this application is usually placed in when in use. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0032] In the description of this application, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set" and "connection" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0033] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0034] This application provides an electronic device, which may be a mobile phone, computer, server, or other terminal device with computing capabilities. Please refer to... Figure 1 A schematic diagram of the structure of an electronic device. The electronic device includes a processor 10, a memory 11, and a bus 12. The processor 10 and the memory 11 are connected via the bus 12. The processor 10 is used to execute executable modules, such as computer programs, stored in the memory 11.
[0035] Processor 10 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the water level gauge image analysis method can be completed through integrated logic circuits in the hardware or software instructions within processor 10. The aforementioned processor 10 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0036] The memory 11 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0037] Bus 12 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. Figure 1 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus 12 or one type of bus 12.
[0038] The memory 11 is used to store programs, such as the program corresponding to the water level gauge image analysis device. The water level gauge image analysis device includes at least one software functional module that can be stored in the memory 11 in the form of software or firmware or embedded in the operating system (OS) of the electronic device. After receiving an execution instruction, the processor 10 executes the program to implement the water level gauge image analysis method.
[0039] The electronic device provided in this application embodiment may also include a communication interface 13. The communication interface 13 is connected to the processor 10 via a bus.
[0040] Optionally, the electronic device can communicate with the image acquisition unit in the front-end data acquisition system via communication interface 13. The front-end data acquisition system includes the image acquisition unit and the target water level gauge arranged at the water level monitoring point.
[0041] Optionally, the image acquisition unit is positioned at a preset distance directly opposite the target water level gauge. The image acquisition unit may be, but is not limited to, a camera. It may be, but is not limited to, being powered by a solar-powered battery. The image acquisition unit can continuously acquire target images at preset time intervals; these images include image information of the target area where the target water level gauge is located. After acquiring the target images, the image acquisition unit can store them on a Secure Digital Memory Card (SD card). The target images stored on the SD card can be copied to the electronic device manually. The image acquisition unit can also transmit the acquired target images to the electronic device via a Data Transfer Unit (DTU).
[0042] Please refer to Figure 2 , Figure 2 This is an overview diagram of the front-end data acquisition system provided in the embodiments of this application. Figure 2 The example uses a camera as the image acquisition unit and a remote server (PC) as the electronic device, but this is not intended to limit the scope of the example.
[0043] It should be understood that, Figure 1 The structure shown is only a partial schematic diagram of the electronic device; the electronic device may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0044] The water level gauge image analysis method provided in this application embodiment can be applied to, but is not limited to, [various applications]. Figure 1 For the specific process of the electronic devices shown, please refer to [link / reference]. Figure 3 The water level gauge image analysis methods include S101, S102, and S103, which are described in detail below.
[0045] S101, acquire the target image.
[0046] The target image includes image information of the target area where the target water level gauge is located. The target image is the image acquired by the image acquisition unit mentioned above.
[0047] S102, based on the target image, obtain the identification value, scale line count value and water level gauge tilt angle.
[0048] Among them, the label value is the first value of the target water level gauge on the water level line, the scale line count value is the number of scale lines between the label value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired.
[0049] S103, obtains the water level value corresponding to the water level line based on the marked value, the scale line count value and the tilt angle of the water level gauge.
[0050] Optionally, the water level value corresponding to the water level line satisfies the following formula:
[0051]
[0052] Where WL is the water level value (unit: meters), M is the marked value, N is the scale count value, and θ is the tilt angle of the water level gauge.
[0053] In this application, the identification value and the scale line count value are identified separately to avoid mutual interference and ensure the accuracy of the identification results. Then, the water level gauge tilt angle and the obtained identification value and scale line count value are combined for mathematical processing to obtain the true and accurate water level value corresponding to the water level line.
[0054] Optionally, after obtaining the water level value corresponding to the water level line, the water level value corresponding to the water level line can be sent to the corresponding client, and / or the water level value corresponding to the water level line and the corresponding target image can be stored in the database, and a corresponding mapping relationship between the two can be established.
[0055] exist Figure 3 Based on the above, regarding the content in S102, this application embodiment also provides an optional implementation method, please refer to the following: S102, obtaining the identification value, scale line count value and water level gauge tilt angle based on the target image, including: S102-1, S102-2, S102-5, S102-6 and S102-7, which are specifically described below.
[0056] S102-1, Based on the pre-obtained position coordinates, obtain the first sub-image corresponding to the target region from the target image.
[0057] Regarding how to obtain the location coordinates, this application also provides an optional implementation method, which is detailed below.
[0058] The target image is preprocessed to detect the position coordinates of the target area where the target water level gauge is located in the target image, and the first sub-image corresponding to the target area is extracted based on the position coordinates.
[0059] The preprocessing includes any one or more of the following: grayscale processing, binarization processing, edge detection processing, morphological filtering processing, and contour detection processing.
[0060] Regarding how to obtain the location coordinates, this application also provides another optional implementation method, which is detailed below.
[0061] Sample images are determined from all images acquired by the image acquisition unit. These sample images can be taken during the day in good lighting conditions to make the image information clearer. Furthermore, the water level detected by the target water level gauge in the sample image is relatively low, for example, below the first water level threshold, so that the position coordinates determined based on the sample image can cover as many numerical characters and scale lines as possible, which is beneficial for the determination of extreme water levels.
[0062] The sample images are preprocessed to detect the location coordinates of the target area containing the target water level gauge. These location coordinates are stored as a standard template. When processing and parsing target images from the same batch as the sample images, the pre-stored location coordinates of the target area in the sample images can be directly called for batch cropping. This avoids requiring full preprocessing of the target images each time, reducing operational complexity and improving overall processing efficiency.
[0063] It should be noted that these location coordinates refer to the coordinates of the target area in the image coordinate system of the target image.
[0064] S102-2, perform line detection based on the first sub-image, and obtain the tilt angle of the line corresponding to the target water level gauge when the target image is acquired, as the tilt angle of the water level gauge.
[0065] Optionally, the Hough transform is used to detect straight lines in the target water level gauge in the first sub-image, and the tilt angle of the straight line corresponding to the target water level gauge when the target image is acquired is obtained as the tilt angle of the water level gauge.
[0066] S102-5, Perform image segmentation on the first sub-image to obtain the second and third sub-images.
[0067] The second sub-image is a digital character ruler image located above the water level line, and the third sub-image is a scale line ruler image located above the water level line.
[0068] In one optional implementation, the target water level gauge has corresponding numerical characters engraved on one side and corresponding scale lines engraved on the other side. The first sub-image can be segmented, for example, into left and right parts, to obtain a second and a third sub-image.
[0069] Regarding the content in S102-5, this application also provides an optional implementation method, please refer to the following.
[0070] Based on the sample image mentioned above, S102-1 is executed to obtain the first sample sub-image corresponding to the sample image. Image segmentation is performed on the first sample sub-image to obtain the second and third sample sub-images, and the image segmentation parameters of the first sample sub-image are recorded. These parameters represent the coordinate information of the segmentation points within the first sample sub-image. When processing the first sub-image corresponding to the target image in the same batch as the sample image, these image segmentation parameters can be directly called to perform image segmentation on the first sub-image to obtain the second and third sub-images. This avoids the need to individually identify the segmentation points each time, enabling batch segmentation and improving processing efficiency.
[0071] S102-6, Obtain the identifier value based on the second sub-image.
[0072] Regarding the content in S102-6, this application also provides an optional implementation method, please refer to the following: S102-6, obtaining the identifier value based on the second sub-image, including: S102-6A and S102-6B, which are described in detail below.
[0073] S102-6A, the second sub-image is segmented to obtain the identifying numerical character, wherein the identifying numerical character is the first numerical character of the target water level gauge located on the water level line.
[0074] Optionally, the second sub-image is a binary image. The second sub-image is projected horizontally using a projection method. The number of black dots of pixels perpendicular to the straight line (axis) on the second sub-image is counted and added together as the position value (coordinate) on the axis. The position value (coordinate) is then used to crop out the digital character image from the second sub-image, which includes the identifier digital character.
[0075] The straight line (axis) here is the vertical axis of the image. After binarizing the image, it is projected horizontally to the left (i.e., perpendicular to the vertical axis), and the distribution of black dots is counted. The number of black dots projected onto the vertical axis from the region containing the numeric character is greater than 0. When the number of black dots becomes 0, the retrieval of this numeric character region ends. At this point, the coordinates of this numeric character with 0 black dots are the boundary coordinates of the numeric character.
[0076] In one optional implementation, the second sample sub-image can be processed as described above to obtain the sample position value (sample coordinates) corresponding to the second sample sub-image. When processing the second sub-image corresponding to the target image in the same batch as the sample image, the sample position value (sample coordinates) can be directly called to crop out the numeric character image from the second sub-image, which includes the identifier numeric character, thus improving processing efficiency.
[0077] S102-6B identifies the identifier numeric characters to obtain the identifier value.
[0078] Optionally, based on a publicly available dataset of digital characters, a convolutional neural network is designed and trained. The model with better performance is selected from the training results to recognize the digital character images and obtain the numerical values of the characters.
[0079] In this application, the convolutional neural network can recognize only the identified digits, or it can recognize all the digit characters obtained in S102-6A.
[0080] Optionally, a printed digit character dataset from the University of Surrey, UK, containing printed Arabic numerals 0-9, is selected. The dataset is divided according to a certain ratio, and the input size is standardized and data augmented. A convolutional neural network (CNN) model is designed, consisting of one normalization layer, three convolutional layers, three pooling layers, one flattening layer, and two fully connected layers, with a Dropout layer added to prevent overfitting. Parameters such as the learning rate, stride, and number of training epochs are set, a suitable activation function is selected, and the model is trained. The model is compiled, and its accuracy and loss rate are evaluated. Finally, the high-performing CNN model is saved for recognizing digit characters on a watermark.
[0081] S102-7, Obtain the scale line count value based on the third sub-image.
[0082] Regarding the content in S102-7, this application also provides an optional implementation method, please refer to the following: S102-7, obtaining the scale line count value based on the third sub-image, including: S102-7A, S102-7B, S102-7C and S102-7D, which are described in detail below.
[0083] S102-7A, set the initial value of the counter to 0.
[0084] S102-7B: Starting from the identifier coordinates of the third sub-image, traverse downwards to count the pixel values of the third sub-image.
[0085] The identifier coordinates are the coordinates of the identifier value (i.e., the identifier numeric character) on the third sub-image.
[0086] S102-7C: When the pixel value changes, the counter value is incremented by 1.
[0087] S102-7D determines the value of the counter after traversal as the scale count value.
[0088] Optionally, the third sub-image is a binary image. When the third sub-image is not a binary image, it can be preprocessed using methods such as grayscale conversion, binarization, erosion and dilation, and opening / closing operations to convert it into a binary image. Then, a scale counter with an initial value of 0 is set. Based on the coordinates of the identified numerical characters on the scale ruler, pixels are traversed downwards from the same height position on the binary scale ruler image (third sub-image), and the counter value is increased according to the pixel value change pattern. After traversing the binary image of the scale ruler using this method, the counter value is the number of scale lines, i.e., the scale line count value.
[0089] exist Figure 3 Based on the above, regarding the content of S102, this application embodiment also provides an optional implementation method, please refer to the following: S102, obtaining the identification value, scale line count value and water level gauge tilt angle based on the target image, including: S102-1, S102-2, S102-3, S102-4, S102-5, S102-6 and S102-7, wherein S102-1, S102-2, S102-5, S102-6 and S102-7 are consistent with the above description, and will not be repeated here. Regarding S102-3 and S102-4, they are specifically described as follows.
[0090] S102-3, the first sub-image is tilted based on the tilt angle of the water level gauge to obtain the tilt-corrected first sub-image.
[0091] Optionally, after obtaining the tilt angle of the water level gauge in S102-2, S102-3 can be executed to perform tilt correction on the first sub-image to obtain the tilt-corrected first sub-image for subsequent processing.
[0092] In an optional implementation, in step S102-2, straight line detection is performed on the first sample sub-image to obtain the tilt angle of the straight line corresponding to the target water level gauge during sample image acquisition, which is used as the tilt angle of the sample water level gauge. When processing target images in the same batch as the sample images, it is not necessary to repeatedly obtain the water level gauge tilt angle of the target images; the tilt angle of the sample water level gauge can be directly used, including but not limited to tilt correction of the first sub-image based on the tilt angle of the sample water level gauge. This improves processing efficiency.
[0093] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the deviation under the tilted state provided in an embodiment of this application. Wherein, θ is the tilt angle of the water level gauge, the displayed value represents the measured value corresponding to the water level at the current tilt angle, and the true value represents the true value corresponding to the water level.
[0094] Optionally, before performing image segmentation on the first sub-image to obtain the second and third sub-images in S102-5, S102-4 can also be performed.
[0095] S102-4, Perform the first type of preprocessing on the first sub-image to calibrate the portion of the target water level gauge located above the water level line in the first sub-image.
[0096] The first type of preprocessing includes any one or more of grayscale processing, binarization processing, and morphological processing.
[0097] By calibrating the portion of the target water level gauge above the water level line in the first sub-image, it is easier to segment it subsequently to obtain accurate second and third sub-images.
[0098] Optionally, preprocessing is required to facilitate accurate identification of water level values. Regarding the specific implementation of preprocessing, this application also provides an optional implementation method, please refer to the following.
[0099] (1) Grayscale processing method: Analyze the color principle of color images and RGB and HSV color spaces, and compare the grayscale effects of the maximum value method, the average value method and the weighted average method on the water level gauge photo. Select the method with the best effect to perform grayscale processing on the water level gauge photo.
[0100] (2) Binarization method: Since the Otsu's method based on global thresholding has the advantages of being simple, fast and accurate, it is suitable for image binarization in most scenarios. Therefore, the principle of the Otsu's algorithm was analyzed in the image binarization stage, and this method was used to binarize the grayscale water level image.
[0101] (3) Morphological processing methods: Morphological filtering can perform specific shape filtering and enhancement operations on images. Therefore, morphological processing such as erosion and dilation, opening and closing operations are performed on the binary image of the water level gauge to achieve the purposes of noise reduction, filling small holes, and separating connected regions.
[0102] (4) Contour detection and edge detection methods: The principles and effects of edge detection operators such as the Robert operator, Sobel operator, Prewitt operator, and Canny operator are compared and analyzed. Appropriate operators are selected for edge detection based on different needs during preprocessing. The contour detection method in OpenCV (Howse et al., 2015) is used to detect and calibrate the contour of the water gauge, extracting regions of interest, such as the first sub-image.
[0103] The water level gauge image analysis method provided in this application has the following features: ① The front-end data acquisition system only requires a camera to collect water level gauge photos, and the instrument is inexpensive, easy to install, and easy to maintain; ② The back-end image analysis uses a combination of digital image processing technology and convolutional neural networks to perform target localization, tilt correction, and identification of numbers and scale lines on the water level gauge. Finally, the water level value is calculated based on the relationship between the values of the digital characters on the water level gauge and the scale lines. This allows the preprocessing and scale line detection methods of the back-end system to not only have the advantages of fast and accurate image processing technology with low requirements for computer resources, but also to avoid the need for a large amount of raw data, complex neural network structures, and long-term model training in the image recognition stage. Only a simple convolutional neural network model can be designed and trained on a publicly available digital character dataset for a short time to complete the recognition of digital characters.
[0104] Please see Figure 5 , Figure 5 The water level gauge image analysis device provided in this application embodiment may optionally be applied to the electronic device described above.
[0105] The water level gauge image analysis device includes: an information acquisition unit 201 and a processing unit 202.
[0106] Information acquisition unit 201 is used to acquire target image, which includes image information of the target area where the target water level gauge is located;
[0107] Processing unit 202 is used to obtain the label value, scale line count value and water level gauge tilt angle based on the target image;
[0108] Among them, the label value is the first value of the target water level gauge on the water level line, the scale line count value is the number of scale lines between the label value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired.
[0109] The processing unit 202 is also used to obtain the water level value corresponding to the water level line based on the identification value, the scale line count value and the tilt angle of the water level gauge.
[0110] It should be noted that the water level gauge image analysis device provided in this embodiment can execute the method flow shown in the above-described method flow embodiment to achieve the corresponding technical effects. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above-described embodiments.
[0111] This application also provides a storage medium storing computer instructions and programs, which, when read and executed, perform the water level gauge image analysis method described above. The storage medium may include memory, flash memory, registers, or a combination thereof.
[0112] The following provides an electronic device, which may be a mobile phone, computer, server, or other terminal device with computing capabilities. This electronic device, such as... Figure 1 As shown, the above-described water level gauge image analysis method can be implemented. Specifically, the electronic device includes: a processor 10, a memory 11, and a bus 12. The processor 10 may be a CPU. The memory 11 is used to store one or more programs, which, when executed by the processor 10, execute the water level gauge image analysis method of the above embodiment.
[0113] In summary, this application provides a method, apparatus, storage medium, and electronic device for analyzing water level gauge images, including: acquiring a target image, the target image including image information of the target area where the target water level gauge is located; acquiring a marker value, a scale count value, and a water level gauge tilt angle based on the target image; wherein, the marker value is the first value of the target water level gauge on the water level line, the scale count value is the number of scale lines between the marker value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired; and acquiring the water level value corresponding to the water level line based on the marker value, the scale count value, and the water level gauge tilt angle. By separately identifying the marker value and the scale count value, mutual interference is avoided, ensuring the accuracy of the identification result. Mathematical operations are then performed on the water level gauge tilt angle and the acquired marker value and scale count value to obtain the true and accurate water level value corresponding to the water level line.
[0114] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0115] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within this application. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A method for analyzing water level gauge images, characterized in that, The method includes: Acquire a target image, the target image including image information of the target area where the target water level gauge is located; Based on the target image, obtain the identification value, the scale line count value, and the water level gauge tilt angle; Wherein, the marked value is the first value of the target water level gauge on the water level line, the scale line count value is the number of scale lines between the marked value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired. The water level value corresponding to the water level line is obtained based on the identification value, the scale line count value, and the tilt angle of the water level gauge. The steps of obtaining the identifier value, scale line count value, and water level gauge tilt angle based on the target image include: Based on pre-obtained position coordinates, a first sub-image corresponding to the target region is obtained from the target image. The position coordinates are obtained as follows: a sample image is determined from all images acquired by the image acquisition unit. The sample image is an image taken in good daylight conditions, and the water level detected by the target water level gauge in the sample image is lower than a first water level threshold. The sample image is preprocessed to detect the position coordinates corresponding to the target region where the target water level gauge is located in the sample image. The position coordinates corresponding to the target region in the sample image are stored as a standard template. When processing and parsing target images from the same batch as the sample images, the position coordinates corresponding to the target region in the pre-stored sample image used as a standard template are directly called. Based on the first sub-image, straight line detection is performed to obtain the tilt angle of the straight line corresponding to the target water level gauge when the target image was acquired, which is used as the tilt angle of the water level gauge. The first sub-image is segmented to obtain the second and third sub-images; The second sub-image is a digital character ruler image located above the water level line, and the third sub-image is a scale line ruler image located above the water level line. The identifier value is obtained based on the second sub-image; The scale line count value is obtained based on the third sub-image.
2. The water level gauge image analysis method as described in claim 1, characterized in that, The step of obtaining the identifier value based on the second sub-image includes: The second sub-image is segmented to obtain an identifying numerical character, wherein the identifying numerical character is the first numerical character of the target water level gauge located on the water level line; The identification numeric characters are identified to obtain the identification value.
3. The water level gauge image analysis method as described in claim 1, characterized in that, The third sub-image is a binary image, and the step of obtaining the scale line count value based on the third sub-image includes: Set the initial value of the counter to 0; Starting from the identifier coordinates of the third sub-image, traverse downwards and count the pixel values of the third sub-image; Wherein, the identifier coordinates are the coordinates of the identifier value on the third sub-image; When the pixel value changes, the counter value is incremented by 1; After the traversal is completed, the value of the counter is determined as the scale line count value.
4. The water level gauge image analysis method as described in claim 1, characterized in that, Before performing image segmentation on the first sub-image to obtain the second and third sub-images, the method further includes: The first sub-image is tilted based on the tilt angle of the water level gauge to obtain the tilt-corrected first sub-image.
5. The water level gauge image analysis method as described in claim 1, characterized in that, Before performing image segmentation on the first sub-image to obtain the second and third sub-images, the method further includes: The first sub-image is subjected to a first type of preprocessing to calibrate the portion of the target water level gauge in the first sub-image that is above the water level line; The first type of preprocessing includes any one or more of grayscale processing, binarization processing, and morphological processing.
6. The water level gauge image analysis method as described in claim 1, characterized in that, The water level value corresponding to the water level line satisfies the following formula: in, WL Where M is the water level value (unit: meters), N is the scale count value, and θ is the tilt angle of the water level gauge.
7. A water level gauge image analysis device, characterized in that, The device includes: An information acquisition unit is used to acquire a target image, the target image including image information of the target area where the target water level gauge is located; The processing unit is used to obtain the identification value, scale line count value, and water level gauge tilt angle based on the target image; Wherein, the marked value is the first value of the target water level gauge on the water level line, the scale line count value is the number of scale lines between the marked value and the water level line, and the water level gauge tilt angle is the tilt angle of the target water level gauge when the target image is acquired. The processing unit is also used to obtain the water level value corresponding to the water level line based on the identification value, the scale line count value and the tilt angle of the water level gauge. The step of obtaining the identifier value, scale count value, and water level gauge tilt angle based on the target image includes: obtaining a first sub-image corresponding to the target area from the target image based on pre-obtained position coordinates. The position coordinates are obtained by determining a sample image from all images acquired by the image acquisition unit. The sample image is an image taken in good daylight conditions, and the water level detected by the target water level gauge in the sample image is lower than a first water level threshold. The sample image is preprocessed to detect the position coordinates corresponding to the target area where the target water level gauge is located in the sample image, and the position coordinates corresponding to the target area in the sample image are stored as a standard template. This is followed by further processing and parsing. When the target image is in the same batch as the sample image, the position coordinates corresponding to the target area in the pre-stored sample image used as a standard template are directly called; a straight line detection is performed based on the first sub-image to obtain the tilt angle of the straight line corresponding to the target water level gauge when the target image was acquired, which is used as the tilt angle of the water level gauge; the first sub-image is segmented to obtain a second sub-image and a third sub-image; wherein, the second sub-image is a digital character ruler image located above the water level line, and the third sub-image is a scale line ruler image located above the water level line; the identification value is obtained based on the second sub-image; the scale line count value is obtained based on the third sub-image.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-6.
9. An electronic device, characterized in that, include: Processor and memory, the memory being used to store one or more programs; When the one or more programs are executed by the processor, the method as described in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Water gauge water level identification method and system based on morphological image processing
CN116071692A