Water level identification method and device, storage medium and electronic equipment

The method addresses the challenges of camera stability and environmental adaptability in water level recognition by using feature matching and image masking to enhance detection accuracy and reliability.

CN120318806AActive Publication Date: 2025-07-15SICHUAN YUHONG TECH CO LTD +2
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202411311670.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-09-18
Filing Date
2024-09-20
Publication Date
2025-07-15
Estimated Expiration
2044-09-20

Smart Images

  • Figure CN120318806A_ABST
    Figure CN120318806A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image processing, in particular to a water level recognition method and device, a storage medium and electronic equipment. The water level identification method comprises the following steps: acquiring a real-time image of a scene to be identified; performing feature matching on the real-time image based on a preset feature model set to determine a to-be-recognized region corresponding to the real-time image; based on a mask algorithm, image mask processing is carried out on the real-time image containing the to-be-recognized area, so that information in the real-time image is enhanced and / or suppressed, and a target image after mask processing is obtained; and performing water level identification on the target image to obtain a water level identification result of the to-be-identified area, the water level identification result comprising a water line position and a water level reading of the to-be-identified area. Through the method, effective identification and accurate measurement of the to-be-identified area in the target image are realized, errors generated after the camera moves are reduced, dependence on the water gauge body is reduced, and the identification accuracy is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing, and particularly to a water level recognition method, apparatus, storage medium, and electronic device. Background Art

[0002] Water level recognition technology plays a crucial role in many fields such as modern water resources management, flood warning, shipping safety, and ecological environment monitoring. With the intensification of global climate change, extreme weather events occur frequently, and natural disasters such as floods and droughts have an increasingly significant impact on human society and the natural environment. Therefore, accurately and real-time monitoring and recognizing water level changes have become an important technical means to ensure people's life and property safety, optimize water resources allocation, and maintain ecological balance.

[0003] With the progress of technology, especially the application of modern information technologies such as sensor technology, remote communication technology, big data processing, and artificial intelligence, water level recognition methods are gradually developing towards automation and intelligence. These emerging technologies provide more accurate, efficient, and convenient solutions for water level recognition, greatly improving the real-time and accuracy of water level monitoring, and also injecting new vitality into the development of related fields. Traditionally, water level data collection relies on various sensor technologies, including but not limited to float type, radar type, pressure type, and bubble type. Although these methods have their own advantages, they are all easily restricted by the inherent performance differences of instruments and changes in external environmental conditions, which may lead to errors or anomalies in water level data. Summary of the Invention

[0004] The main purpose of the present disclosure is to provide a water level recognition method, apparatus, storage medium, and electronic device, aiming to solve the technical problem of poor reliability and accuracy in water level recognition in the prior art.

[0005] To achieve the above object, the present disclosure proposes a water level recognition method, including:

[0006] Obtain a real-time image of the scene to be recognized;

[0007] Based on a preset set of feature models, perform feature matching on the real-time image to determine the region to be recognized corresponding to the real-time image;

[0008] Based on the masking algorithm, perform image masking processing on the real-time image including the region to be recognized to enhance and / or suppress the information in the real-time image, and obtain a target image after masking processing;

[0009] Perform water level recognition on the target image to obtain a water level recognition result of the region to be recognized, where the water level recognition result includes the position of the water level line and the water level reading of the region to be recognized.

[0010] Optionally, based on the preset feature model set, performing feature matching on the real-time image to determine the area to be recognized corresponding to the real-time image, including:

[0011] Obtaining the feature model set, where the feature model set includes region feature models corresponding to different region features, and each region feature model in the feature model set corresponds to a water level height;

[0012] Based on the water level height of each region feature model in the feature model set, comparing the region features included in the feature model set with the target features included in the real-time image to determine the target region feature model corresponding to the real-time image;

[0013] According to the target region features corresponding to the target region feature model, determining the target region corresponding to the target region feature model;

[0014] According to the target region, determining the area to be recognized.

[0015] Optionally, based on the water level height of each region feature model in the feature model set, comparing the region features included in the feature model set with the target features included in the real-time image to determine the target region feature model corresponding to the real-time image, including:

[0016] Based on the water level height of each region feature model in the feature model set, determining the feature matching order of the feature models in the feature model set;

[0017] According to the feature matching order, determining the first region feature model in the feature model set, where the water level height corresponding to the first region feature model is the lowest;

[0018] Based on the first region feature model, performing feature extraction on the real-time image to determine the target features;

[0019] Comparing the target features with the region features of the first region feature model to obtain a first feature comparison result;

[0020] In the case where the first feature comparison result meets the preset feature comparison condition, determining the first region feature model as the target region feature model.

[0021] Optionally, further including:

[0022] In the case where the first feature comparison result does not meet the preset feature comparison condition, according to the feature matching order, determining the second region feature model in the feature model set, where the water level height corresponding to the second region feature model is higher than the water level height corresponding to the first region feature model;

[0023] Compare the target feature with the regional features of the second regional feature model to obtain a second feature comparison result;

[0024] When the second feature comparison result meets the preset feature comparison condition, determine the second regional feature model as the target regional feature model.

[0025] Optionally, the method for making the feature model set includes:

[0026] Obtain a scene image of the water level recognition scene, where the water level recognition scene includes the area to be recognized;

[0027] Partition the water level recognition scene based on the water level height to obtain a plurality of sub-regions, and each sub-region in the plurality of sub-regions corresponds to a water level height range;

[0028] Extract features from the water level recognition scene based on the scene image to obtain water level recognition scene features;

[0029] Determine the sub-region features corresponding to each sub-region in the plurality of sub-regions according to the water level recognition scene features;

[0030] Make the feature model set according to a preset standard model and the sub-region features corresponding to each sub-region in the plurality of sub-regions.

[0031] Optionally, the water level recognition of the target image to obtain the water level recognition result of the area to be recognized includes:

[0032] Perform color space conversion on the target image to obtain a converted first image, and the first image includes pixel values in different color channels and the gray scale space;

[0033] Perform threshold segmentation on each color channel in the first image to classify the pixels in the first image, and obtain a segmented second image, where the pixels in the second image are divided into foreground and background;

[0034] Perform contour detection on the second image to determine the water level line contour;

[0035] Based on the pixel points on the water level line contour, calculate the Y-axis position of the water level line in the target image;

[0036] Determine the water level reading according to the Y-axis position of the water level line and the preset mapping relationship for representing the relationship between the Y-axis position and the water level reading.

[0037] Optionally, performing image masking processing on the real-time image including the area to be recognized based on the masking algorithm to enhance and / or suppress the information in the real-time image, and obtaining the target image after masking processing, including:

[0038] Obtaining a preset target mask;

[0039] Applying the target mask to the real-time image to determine the area to be processed corresponding to the target mask in the real-time image;

[0040] Performing image processing on the area to be processed based on the target mask to obtain the target processed area; fusing the target processed area with the remaining part of the real-time image except the target processed area to determine the target image.

[0041] In addition, to achieve the above object, the present disclosure also provides a water level recognition device, where the water level recognition device includes:

[0042] An image acquisition module, configured to acquire a real-time image of a scene to be recognized;

[0043] A feature matching module, configured to perform feature matching on the real-time image based on a preset set of feature models to determine the area to be recognized corresponding to the real-time image;

[0044] An image processing module, configured to perform image masking processing on the real-time image including the area to be recognized based on the masking algorithm to enhance and / or suppress the information in the real-time image, and obtain the target image after masking processing;

[0045] A water level recognition module, configured to perform water level recognition on the target image to obtain a water level recognition result of the area to be recognized, where the water level recognition result includes the position of the water level line and the water level reading of the area to be recognized.

[0046] In addition, to achieve the above object, the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when a processor executes the computer program, the above method is implemented.

[0047] In addition, to achieve the above object, the present disclosure also provides an electronic device, which includes a memory and a processor, a computer program is stored in the memory, and when the processor executes the computer program, the above method is implemented.

[0048] In addition, to achieve the above object, the present disclosure also provides a computer program product, and when the computer program product is run by a processor, the above method is implemented.

[0049] First, obtain the real-time image of the scene to be recognized, and then, based on a preset set of feature models, perform feature matching on the real-time image to determine the area to be recognized corresponding to the real-time image. In this way, the area to be recognized in the real-time image can be accurately determined. This process does not depend on the absolute position of the camera or fixed preset points. Therefore, even if there are slight errors after the camera moves, as long as sufficient feature information can be captured, the area to be recognized can be accurately located through feature matching, thereby reducing the errors caused by the change of the camera position. Based on the masking algorithm, perform image masking processing on the real-time image containing the area to be recognized to enhance and / or suppress the information in the real-time image, and obtain the target image after masking processing. The application of the masking algorithm helps to reduce the interference of environmental factors and makes the extraction of the water level line more accurate and reliable. In addition, perform water level recognition on the target image to obtain the water level recognition result of the area to be recognized. The water level recognition result includes the position of the water level line and the water level reading of the area to be recognized. By constructing and applying a preset set of feature models, the direct dependence on the water gauge body is indeed reduced to a certain extent. Even if the water gauge is partially blocked or not in the center of the field of view in the actual scene, as long as the key features in the real-time image can be captured, the recognition task can still be completed. Brief Description of the Drawings

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present disclosure. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.

[0051] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment related to the solution of the embodiment of the present disclosure;

[0052] Figure 2 It is a schematic flowchart of a water level recognition method related to the solution of the embodiment of the present disclosure;

[0053] Figure 3 It is a schematic diagram of the setting of a regional feature model related to the solution of the embodiment of the present disclosure;

[0054] Figure 4 It is a block diagram of the structure of a water level recognition device related to the solution of the embodiment of the present disclosure.

[0055] The realization, functional features and advantages of the purpose of the present disclosure will be further described with reference to the embodiments and the drawings. Detailed Embodiments

[0056] Next, the technical solutions in the embodiments of the present disclosure will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.

[0057] Referring to Figure 1 , Figure 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present disclosure.

[0058] Generally, the device includes: at least one processor 301, a memory 302, and a water level recognition program stored on the memory 302 and operable on the processor 301. The water level recognition program is configured to implement the steps of the water level recognition method as described above.

[0059] The processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 301 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. The processor 301 may also include an AI (Artificial Intelligence) processor, which is used to process operations related to the water level recognition method, so that the water level recognition method model can autonomously train and learn to improve efficiency and accuracy.

[0060] The memory 302 may include one or more storage media, which may be non-transitory. The memory 302 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory storage media in the memory 302 is used to store at least one instruction for being executed by the processor 301 to implement the water level recognition method provided in the method embodiments of the present disclosure.

[0061] In some embodiments, the terminal may further optionally include: a communication interface 303 and at least one peripheral device. The processor 301, the memory 302, and the communication interface 303 may be connected through a bus or signal lines. Each peripheral device may be connected to the communication interface 303 through a bus, signal lines, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 304, a display screen 305, and a power supply 306.

[0062] The communication interface 303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 301 and the memory 302. In some embodiments, the processor 301, the memory 302, and the communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302, and the communication interface 303 may be implemented on a separate chip or circuit board, and the present embodiment does not limit this.

[0063] The radio frequency circuit 304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 304 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 304 converts an electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 304 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 304 may communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: a metropolitan area network, each generation of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 304 may further include a circuit related to NFC (Near Field Communication), and the present disclosure does not limit this.

[0064] The display screen 305 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 305 is a touch display screen, the display screen 305 also has the ability to collect touch signals on or above the surface of the display screen 305. The touch signals can be input as control signals to the processor 301 for processing. At this time, the display screen 305 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, the display screen 305 can be one, the front panel of the electronic device; in other embodiments, the display screen 305 can be at least two, respectively arranged on different surfaces of the electronic device or in a foldable design; in still other embodiments, the display screen 305 can be a flexible display screen, arranged on the curved surface or the folding surface of the electronic device. Even more, the display screen 305 can be set to an irregular non-rectangular shape, that is, a special-shaped screen. The display screen 305 can be prepared from materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0065] The power supply 306 is used to supply power to each component in the electronic device. The power supply 306 can be alternating current, direct current, a disposable battery, or a rechargeable battery. When the power supply 306 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology. Those skilled in the art can understand that Figure 1 the structure shown in does not constitute a limitation on the device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0066] In addition, the embodiments of the present disclosure also propose a storage medium, on which a water level recognition program is stored. When the water level recognition program is executed by a processor, the steps of the water level recognition method as described above are implemented. Therefore, it will not be elaborated here. In addition, the description of the beneficial effects of using the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the storage medium involved in the present disclosure, please refer to the description of the method embodiments of the present disclosure. By way of example, the program instructions can be deployed to be executed on one device, or on multiple devices located at one location, or on multiple devices distributed at multiple locations and interconnected through a communication network.

[0067] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The above program can be stored in a storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the above storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc.

[0068] In related technologies, in order to improve the accuracy and timeliness of water level monitoring and ensure the reliability of management decisions, an innovative technical solution - a water level recognition method based on machine vision and image processing technology - has been introduced. The core of this method is to use a high-definition camera to capture real-time video images of the water gauge and the surrounding water surface, and then perform in-depth analysis on the images through advanced image processing algorithms to accurately extract the water gauge scale and the corresponding water level line information from the complex background automatically.

[0069] Specifically, a high-definition camera is fixed to photograph the standard water gauge. Its operation process includes recording the pixel coordinate range of the water gauge in the picture and taking a photo of the water gauge at the lowest water level as a comparison template. During the recognition process, the system locates the water surface line and calculates the water level reading by comparing the similarity between the template and the water gauge image line by line. However, this solution faces several key problems:

[0070] Challenge of camera position stability: Although the camera supports setting preset points to return to a specific recognition perspective, due to the accuracy limitation of the current dome camera mechanical structure, there is a small angular deviation every time after returning, which causes the actual position of the water gauge to shift relative to the preset coordinate range. As a result, the recognition algorithm may not be able to accurately locate the water gauge, resulting in recognition failure. Therefore, the prior art tends to strictly fix the camera position and avoid any moving operations.

[0071] Strong dependence on the "water gauge": The recognition methods in the prior art highly rely on the visible water gauge body. Once the water gauge is blocked, damaged, or out of the field of view, the system will not be able to perform effective water level recognition.

[0072] Poor environmental adaptability: Environmental conditions such as rainy days, foggy days, or light changes will significantly affect the image quality and reduce the similarity matching accuracy between the template and the water gauge image. This environmental sensitivity makes the system prone to recognition errors or complete failure under different weather conditions.

[0073] In summary, the prior art solutions have made certain progress in improving the automation degree of water level recognition, but still need to solve key problems such as camera position stability, absolute dependence on the water gauge, and poor environmental adaptability to improve the overall reliability and accuracy of water level recognition.

[0074] In view of this, the present disclosure provides a water level recognition method, device, storage medium and electronic device to solve the above technical problems.

[0075] Referring to Figure 2 , Figure 2 is a schematic flowchart of a water level recognition method according to an embodiment of the present disclosure, including the following steps:

[0076] Step S11: Obtain a real-time image of the scene to be recognized.

[0077] Step S12: Based on a preset set of feature models, perform feature matching on the real-time image to determine the area to be recognized corresponding to the real-time image.

[0078] Step S13: Based on the masking algorithm, perform image masking processing on the real-time image including the area to be recognized to enhance and / or suppress the information in the real-time image, and obtain the target image after masking processing.

[0079] Step S14: Perform water level recognition on the target image to obtain the water level recognition result of the area to be recognized, where the water level recognition result includes the position of the water level line and the water level reading of the area to be recognized.

[0080] Through the above technical solutions, first, a real-time image of the scene to be recognized is obtained, and then based on a preset set of feature models, feature matching is performed on the real-time image to determine the area to be recognized corresponding to the real-time image. In this way, the area to be recognized in the real-time image can be accurately determined. This process does not depend on the absolute position or fixed preset point of the camera. Therefore, even if there are slight errors after the camera moves, as long as enough feature information can be captured, the area to be recognized can be accurately located through feature matching, thereby reducing the error caused by the change of the camera position. Based on the masking algorithm, perform image masking processing on the real-time image including the area to be recognized to enhance and / or suppress the information in the real-time image, and obtain the target image after masking processing. The application of the masking algorithm helps to reduce the interference of environmental factors and makes the extraction of the water level line more accurate and reliable. In addition, perform water level recognition on the target image to obtain the water level recognition result of the area to be recognized, where the water level recognition result includes the position of the water level line and the water level reading of the area to be recognized. By constructing and applying a preset set of feature models, the direct dependence on the water gauge body is indeed reduced to a certain extent. Even if the water gauge is partially blocked or not in the center of the field of view in the actual scene, as long as the key features in the real-time image can be captured, the recognition task can still be completed.

[0081] In a possible manner, the method for making the set of feature models includes:

[0082] Obtain a scene image of the water level recognition scene, where the water level recognition scene includes the area to be recognized;

[0083] Partition the water level recognition scenario based on the water level height to obtain multiple sub-regions, and each sub-region in the multiple sub-regions corresponds to a water level height range;

[0084] Extract features of the water level recognition scenario from the scenario image to obtain water level recognition scenario features;

[0085] Determine the sub-region features corresponding to each sub-region in the multiple sub-regions according to the water level recognition scenario features;

[0086] Make a set of feature models according to a preset standard model and the sub-region features corresponding to each sub-region in the multiple sub-regions.

[0087] Exemplarily, for the scenario where water level recognition is to be performed, first, a scenario image containing the area to be recognized (such as the area near the water level line) can be collected. The scenario image should cover different environmental conditions (such as light changes, weather changes, etc.) as comprehensively as possible to ensure that the subsequent feature models made have sufficient robustness. Then divide the water level recognition scenario into multiple sub-regions according to the water level height, and each sub-region corresponds to a specific water level height range. In this way, features can be extracted and modeled separately for different water level height ranges, thereby improving the accuracy and efficiency of recognition.

[0088] Then use image processing techniques (such as edge detection, corner detection, texture analysis, etc.) to extract useful feature information from the scenario image. These features should be able to reflect the physical characteristics (such as shape, size, color, etc.) of the area to be recognized and environmental conditions (such as light, shadow, etc.). On the basis of feature extraction, further analyze the features of each sub-region and determine which features are unique to the sub-region. These sub-region features will be used for subsequent feature model making. Use the preset standard model and the above-determined sub-region features to make a set of feature models. Make each sub-region correspond to a feature model, and this model can describe the regional features of the sub-region.

[0089] Among them, the preset standard model can be a template generated based on a template matching algorithm or a machine learning algorithm according to the water level recognition requirements and the characteristics of the scenario to be recognized, and it includes all the water level recognition-related information within the corresponding sub-region. Import or input the determined sub-region features into the corresponding standard model, and the feature models corresponding to each sub-region can be obtained. The specific form of the standard model in the embodiments of the present disclosure is not limited.

[0090] Figure 3 This is a schematic diagram of the setting of a regional feature model involved in the solution of the embodiments of the present disclosure. As Figure 3As shown, the feature model set may include three regional feature models, namely A, B, and C. The region corresponding to the regional feature model C is the region where the water level height ranges from 1 to 3, that is, the region shown within the dashed box. The region corresponding to the regional feature model B is the region where the water level height ranges from 4 to 6, and the region corresponding to the regional feature model A is the region where the water level height ranges from 7 to 9.

[0091] Of course, according to specific recognition accuracy requirements and the scope of the recognition scenario, the entire region that the water level line can reach can be divided into more or fewer sub-regions. At the same time, the water level height range of each sub-region can also be adjusted based on the recognition accuracy requirements and the scope of the recognition scenario. The embodiments of the present disclosure do not make specific limitations on this.

[0092] It is worth noting that in the present disclosure, even if Figure 3 as shown is to make a feature model set based on the features of the water gauge, the final water level recognition result is not determined based on the reading of the water gauge, but the water gauge is regarded as a visual feature included in a region. Therefore, as Figure 3 shown, the regional feature model C includes the features of the regions of water gauges 1, 2, and 3 and the rectangular feature. The regional feature model B includes the features of the regions of water gauges 4, 5, and 6 and the triangular feature. The regional feature model includes the features of the regions of water gauges 7, 8, and 9, the circular feature, and the elliptical feature.

[0093] If in Figure 3 the image shown, the feature of the water gauge does not exist, or the water gauge is partially blocked, resulting in the incompleteness of the feature of the water gauge, it is still possible to perform feature matching between the obtained rectangular feature and the regional feature model C, perform feature matching between the obtained triangular feature and the regional feature model B, and perform feature matching between the obtained circular feature and elliptical feature and the regional feature model A.

[0094] In a possible way, based on a preset feature model set, perform feature matching on a real-time image to determine the region to be recognized corresponding to the real-time image, including:

[0095] Obtain a feature model set. The feature model set includes regional feature models corresponding to different regional features, and each regional feature model in the feature model set corresponds to a water level height;

[0096] Based on the water level height of each regional feature model in the feature model set, compare the regional features included in the feature model set with the target features included in the real-time image to determine the target regional feature model corresponding to the real-time image;

[0097] According to the target regional features corresponding to the target regional feature model, determine the target region corresponding to the target regional feature model;

[0098] Determine the area to be recognized according to the target area.

[0099] Exemplarily, compare the real-time acquired image with each regional feature model in the feature model set to identify the consistency or similarity between the target features in the real-time image and the corresponding features in the feature model. Through the comparison, find the regional feature model that best matches the target features in the real-time image. This matching process may be based on image recognition algorithms, machine learning models, or simple feature comparison algorithms. The accuracy of the matching depends on the precision of the feature model and the quality of the real-time image. Once the target regional feature model is determined, the corresponding target area in the real-time image can be calculated inversely according to the area represented by the model.

[0100] In this way, by comparing the real-time image with the pre-constructed feature model set, the target area in the image can be quickly and accurately recognized, and further determine the area to be recognized that needs attention or processing.

[0101] In a possible way, based on the water level height of each regional feature model in the feature model set, compare the regional features included in the feature model set with the target features included in the real-time image to determine the target regional feature model corresponding to the real-time image, including:

[0102] Based on the water level height of each regional feature model in the feature model set, determine the feature matching order of the feature models in the feature model set;

[0103] According to the feature matching order, determine the first regional feature model in the feature model set, and the water level height corresponding to the first regional feature model is the lowest;

[0104] Based on the first regional feature model, extract features from the real-time image to determine the target features;

[0105] Compare the target features with the regional features of the first regional feature model to obtain the first feature comparison result;

[0106] In the case where the first feature comparison result meets the preset feature comparison condition, determine the first regional feature model as the target regional feature model.

[0107] Exemplarily, first, based on the water level height corresponding to each regional feature model in the feature model set, these models can be sorted from the lowest water level to the highest water level, and this sorting process will determine the subsequent order of feature comparison. From the sorted feature model set, select the regional feature model with the lowest water level height as the first regional feature model, which will be compared with the real-time image first. Then, image processing techniques can be used to extract features from the real-time image to determine the target features in the image. Compare the target features extracted from the real-time image with the regional features of the first regional feature model. Specifically, the similarity, distance, or other metric indicators between the features can be calculated. According to the comparison result, evaluate whether the preset feature comparison conditions are met. The feature comparison conditions can include a similarity threshold, a distance threshold, or other application-specific evaluation criteria.

[0108] If the first feature comparison result meets the preset feature comparison conditions, then determine the first regional feature model as the target regional feature model, that is, it is considered that the region represented by the real-time image matches the region represented by the first regional feature model in terms of features. If the conditions are not met, select the next regional feature model (i.e., the model with a slightly higher water level) according to the feature matching order, and repeat the steps until a model that meets the conditions is found or all models are traversed.

[0109] Exemplarily, based on the above Figure 3 schematic diagram of the setting of the regional feature model, in the present disclosure, based on the water level height, the feature matching order can be regional feature model C, regional feature model B, and regional feature model A. First, the first preset point can be set according to the position of the regional feature model C with the lowest corresponding water level, so that when the regional feature model C is not blocked, the image acquisition device can acquire the regional features corresponding to the regional feature model C when located at the first preset point. Set the second preset point according to the position of the regional feature model B, so that when the regional feature model B is not blocked, the image acquisition device can acquire the regional features corresponding to the regional feature model B when located at the second preset point. Set the third preset point according to the position of the regional feature model A, so that when the regional feature model A is not blocked, the image acquisition device can acquire the regional features corresponding to the regional feature model A when located at the third preset point.

[0110] Of course, the first preset point can also be set so that the image acquisition device can acquire the regional features corresponding to the regional feature model C and the regional feature model B when located at the first preset point. The embodiments of the present disclosure do not make specific limitations on this. Among them, the situation where the regional feature model is blocked can include being flooded by water flow, and the embodiments of the present disclosure also do not make specific limitations on this.

[0111] Thus, based on a preset first preset point, if the image acquisition device cannot obtain the regional features corresponding to the regional feature model C in real time when it is located at the first preset point, it indicates that the regional feature model C has been flooded by water or blocked by other obstacles at this time. At this time, according to the order from low water level to high water level, the image acquisition device is moved to the next preset point to obtain the regional features corresponding to the regional feature model of the next preset point. The subsequent operations are carried out in the same way and will not be elaborated here.

[0112] In a possible way, it also includes:

[0113] In the case where the first feature comparison result does not meet the preset feature comparison condition, according to the feature matching order, determine the second regional feature model in the feature model set, and the water level height corresponding to the second regional feature model is higher than the water level height corresponding to the first regional feature model;

[0114] Compare the target feature with the regional features of the second regional feature model to obtain a second feature comparison result;

[0115] In the case where the second feature comparison result meets the preset feature comparison condition, determine the second regional feature model as the target regional feature model.

[0116] Exemplarily, when the first feature comparison result does not meet the preset feature comparison condition, according to the above feature matching order (water level height from low to high), select the next regional feature model, that is, compare the regional features of the second regional feature model with the target feature to obtain a second feature comparison result.

[0117] If the second feature comparison result meets the preset feature comparison condition, determine the second regional feature model as the target regional feature model. This means that the region represented by the real-time image matches the region represented by the second regional feature model in terms of water level and other features. If the second feature comparison result still does not meet the condition, continue to select the next regional feature model according to the feature matching order for comparison until a model that meets the condition is found or all models are traversed.

[0118] In a possible way, perform water level recognition on the target image to obtain a water level recognition result of the area to be recognized, including:

[0119] Perform color space conversion on the target image to obtain a converted first image, and the first image includes pixel values of different color channels and grayscale spaces;

[0120] Perform threshold segmentation on each color channel in the first image to classify the pixels in the first image and obtain a segmented second image, and the pixels in the second image are divided into foreground and background;

[0121] Perform contour detection on the second image to determine the water level line contour;

[0122] Based on the pixel points on the water level line contour, calculate the Y-axis position of the water level line in the target image;

[0123] According to the Y-axis position of the water level line and the preset mapping relationship used to represent the relationship between the Y-axis position and the water level reading, determine the water level reading.

[0124] Exemplarily, since different color channels may have different sensitivities to the recognition of the water level line, in order to be able to analyze the image in different color spaces. Therefore, first, the target image can be subjected to color space conversion to obtain the first image, which contains different color channels (such as B, G, R) and may also include pixel values in the grayscale space. In order to separate the possible water level line regions from each color channel, threshold segmentation can be applied to each color channel in the first image, and one or more thresholds are selected for each color channel to classify the pixels into foreground (which can be the water level line) and background.

[0125] Then, in order to identify the specific shape or contour from the segmented image, especially the contour that may represent the water level line, a contour detection algorithm can be applied to the results of all color channels (or the selected best channel) that have undergone threshold segmentation to screen out the contour that best conforms to the characteristics of the water level line from the detected contours. Based on the determined water level line contour, calculate its Y-axis position, which can be specifically completed by calculating the average or median of the Y coordinates of all pixel points in the contour. Finally, according to the calculated Y-axis position and the preset mapping relationship used to represent the relationship between the Y-axis position and the actual water level reading, determine the final water level reading.

[0126] In a possible way, based on the matte algorithm, perform image matte processing on the real-time image containing the area to be recognized to enhance and / or suppress the information in the real-time image, and obtain the target image after matte processing, including:

[0127] Obtain a preset target matte;

[0128] Apply the target matte to the real-time image to determine the area to be processed corresponding to the target matte in the real-time image;

[0129] Based on the target matte, perform image processing on the area to be processed to obtain the target processed area;

[0130] Fuse the target processed area with the remaining part of the real-time image except the target processed area to determine the target image.

[0131] Exemplarily, the target mask can be a polarization mask, which is similar to the effect of a polarizing lens and is used to remove the highlights on the water surface or the highlights on reflective surfaces. An image processing strategy based on the HLS color space can be adopted. The HLS color space is more intuitive than the RGB space when processing brightness and color information.

[0132] First, the image can be converted from the RGB color space to the HLS color space, which can be specifically completed using image processing libraries such as OpenCV or PIL. In the HLS space, the highlight areas usually appear as areas with higher brightness, and these areas can be specifically identified by setting a threshold. Then, Gaussian blur is used to process the identified highlight areas to reduce their brightness or contrast, thereby removing the highlight effect. Since only the brightness channel is processed at this time, it is also necessary to merge the processed brightness channel with the original hue and saturation channels and convert back to the RGB color space.

[0133] Exemplarily, the target mask can also be a moss removal mask, which defines which areas in the image may contain moss. Specifically, it can be a simple binary image or a grayscale image with different weights, used to indicate the intensity and distribution of moss. For example, through the BGR color space of the picture, the pixel points of the green channel are extracted to calculate the moss attachment area.

[0134] Using the mask algorithm, the moss areas in the real-time image are processed. Specifically, the pixels identified as moss in the mask can be replaced with background pixels or average colors in the image, or according to the weights in the mask, the moss areas can be blurred, faded, or enhanced to different degrees. It is also possible to perform color correction based on the mask when the moss has a greater impact on the image color to restore the natural color.

[0135] In this way, relying on the mask algorithm based on the color space, during the video water level recognition process, the interference of external environmental factors can be reduced, and the inaccurate recognition results caused by factors such as light, floating object pollution, water gauge pollution, rainy days, and foggy days can be effectively reduced.

[0136] Refer to Figure 4 , Figure 4 FIG. is a structural block diagram of a water level recognition device according to an embodiment of the present disclosure. Based on the same inventive concept as the foregoing embodiments, the device includes:

[0137] An image acquisition module 10, configured to acquire a real-time image of a scene to be recognized;

[0138] A feature matching module 20, configured to perform feature matching on the real-time image based on a preset set of feature models to determine a region to be recognized corresponding to the real-time image;

[0139] An image processing module 30 for performing image masking processing on a real-time image including the region to be recognized based on a masking algorithm to enhance and / or suppress information in the real-time image, and obtaining a target image after the masking processing;

[0140] A water level recognition module 40 for performing water level recognition on the target image to obtain a water level recognition result of the region to be recognized, where the water level recognition result includes the position of the water level line and the water level reading of the region to be recognized.

[0141] Optionally, the feature matching module 20 is configured to:

[0142] Obtain the feature model set, where the feature model set includes region feature models corresponding to different region features, and each region feature model in the feature model set corresponds to a water level height;

[0143] Based on the water level height of each region feature model in the feature model set, compare the region features included in the feature model set with the target features included in the real-time image to determine the target region feature model corresponding to the real-time image;

[0144] According to the target region features corresponding to the target region feature model, determine the target region corresponding to the target region feature model;

[0145] According to the target region, determine the region to be recognized.

[0146] Optionally, the feature matching module 20 is configured to:

[0147] Based on the water level height of each region feature model in the feature model set, determine the feature matching order of the feature models in the feature model set;

[0148] According to the feature matching order, determine the first region feature model in the feature model set, where the water level height corresponding to the first region feature model is the lowest;

[0149] Based on the first region feature model, perform feature extraction on the real-time image to determine the target features;

[0150] Compare the target features with the region features of the first region feature model to obtain a first feature comparison result;

[0151] In the case where the first feature comparison result meets a preset feature comparison condition, determine the first region feature model as the target region feature model.

[0152] Optionally, the feature matching module 20 is further configured to:

[0153] In the case where the first feature comparison result does not meet the preset feature comparison condition, determine the second region feature model in the feature model set according to the feature matching order, where the water level height corresponding to the second region feature model is higher than the water level height corresponding to the first region feature model;

[0154] Compare the target feature with the region feature of the second region feature model to obtain a second feature comparison result;

[0155] In the case where the second feature comparison result meets the preset feature comparison condition, determine the second region feature model as the target region feature model.

[0156] Optionally, the method for making the feature model set includes:

[0157] Obtain a scene image of the water level recognition scene, where the water level recognition scene includes the area to be recognized;

[0158] Partition the water level recognition scene based on the water level height to obtain a plurality of sub-regions, where each sub-region in the plurality of sub-regions corresponds to a water level height range;

[0159] Based on the scene image, extract features from the water level recognition scene to obtain water level recognition scene features;

[0160] According to the water level recognition scene features, determine the sub-region features corresponding to each sub-region in the plurality of sub-regions;

[0161] Make the feature model set according to a preset standard model and the sub-region features corresponding to each sub-region in the plurality of sub-regions.

[0162] Optionally, the water level recognition module 40 is used for:

[0163] Perform color space conversion on the target image to obtain a converted first image, where the first image includes pixel values of different color channels and a grayscale space;

[0164] Perform threshold segmentation on each color channel in the first image to classify the pixels in the first image, and obtain a segmented second image, where the pixels in the second image are divided into foreground and background;

[0165] Perform contour detection on the second image to determine the water level line contour;

[0166] Based on the pixel points on the water level line contour, calculate the Y-axis position of the water level line in the target image;

[0167] Determine the water level reading according to the position of the water level line on the Y-axis and a preset mapping relationship representing the relationship between the Y-axis position and the water level reading.

[0168] Optionally, the image processing module 30 is configured to:

[0169] Obtain a preset target mask;

[0170] Apply the target mask to the real-time image to determine a processing area to be processed corresponding to the target mask in the real-time image;

[0171] Perform image processing on the processing area to be processed based on the target mask to obtain a target processing area;

[0172] Fuse the target processing area with the remaining part of the real-time image except the target processing area to determine the target image.

[0173] It should be noted that since the steps executed by the device in this embodiment are the same as those in the foregoing method embodiment, the specific implementation manners and the achievable technical effects can refer to the foregoing embodiment, and will not be elaborated here.

[0174] In addition, in one embodiment, the embodiment of the present disclosure further provides an electronic device, the device includes a processor, a memory, and a computer program stored in the memory, and the computer program implements the steps of the method in the foregoing embodiment when being run by the processor.

[0175] In addition, in one embodiment, the embodiment of the present disclosure further provides a computer storage medium, and a computer program is stored on the computer storage medium, and the computer program implements the steps of the method in the foregoing embodiment when being run by the processor.

[0176] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; or may be various devices including one or any combination of the foregoing memories. The computer may be various computing devices including smart terminals and servers.

[0177] In some embodiments, the executable instructions may be in the form of a program, software, software module, script, or code, and may be written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0178] By way of example, the executable instructions may or may not correspond to files in a file system and may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program under discussion, or in multiple cooperating files (such as files that hold one or more modules, subroutines, or portions of code).

[0179] By way of example, the executable instructions may be deployed to execute on one computing device, or on multiple computing devices located at one site, or alternatively, on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0180] It should be noted that, in this document, the terms "comprising", "may comprise", or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a series of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or system. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article, or system that comprises the element.

[0181] The serial numbers of the above-described embodiments of the present disclosure are for description only and do not represent the superiority or inferiority of the embodiments.

[0182] From the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as a read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions for causing a multimedia terminal device (which may be a mobile phone, a computer, a television receiver, or a network device, etc.) to execute the methods described in the various embodiments of the present disclosure.

[0183] The above are only optional embodiments of the present disclosure and do not limit the patent scope of the present disclosure accordingly. All equivalent structural transformations made under the inventive concept of the present disclosure by using the content of the specification and drawings of the present disclosure, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present disclosure.

Claims

1. A water level recognition method, characterized in that, Including: Obtain a real-time image of the scene to be recognized; Based on a preset set of feature models, perform feature matching on the real-time image to determine the area to be recognized corresponding to the real-time image; Based on a masking algorithm, perform masking processing on the real-time image including the area to be recognized to enhance and / or suppress the information in the real-time image, and obtain a target image after masking processing; Perform water level recognition on the target image to obtain a water level recognition result of the area to be recognized, where the water level recognition result includes the position of the water level line and the water level reading of the area to be recognized.

2. The method according to claim 1, wherein The step of performing feature matching on the real-time image based on the preset set of feature models to determine the area to be recognized corresponding to the real-time image includes: Obtain the set of feature models, where the set of feature models includes area feature models corresponding to different area features, and each area feature model in the set of feature models corresponds to a water level height; Based on the water level height of each area feature model in the set of feature models, compare the area features included in the set of feature models with the target features included in the real-time image to determine the target area feature model corresponding to the real-time image; According to the target area features corresponding to the target area feature model, determine the target area corresponding to the target area feature model; According to the target area, determine the area to be recognized.

3. The method according to claim 2, wherein The step of comparing the area features included in the set of feature models with the target features included in the real-time image based on the water level height of each area feature model in the set of feature models to determine the target area feature model corresponding to the real-time image includes: Based on the water level height of each area feature model in the set of feature models, determine the feature matching order of the feature models in the set of feature models; According to the feature matching order, determine the first area feature model in the set of feature models, where the water level height corresponding to the first area feature model is the lowest; Based on the first area feature model, perform feature extraction on the real-time image to determine the target features; Compare the target features with the area features of the first area feature model to obtain a first feature comparison result; In the case where the first feature comparison result meets the preset feature comparison condition, determine the first area feature model as the target area feature model.

4. The method according to claim 3, wherein It further includes: In the case where the first feature comparison result does not meet the preset feature comparison condition, according to the feature matching order, determine the second area feature model in the set of feature models, where the water level height corresponding to the second area feature model is higher than the water level height corresponding to the first area feature model; Compare the target features with the area features of the second area feature model to obtain a second feature comparison result; In the case where the second feature comparison result meets the preset feature comparison condition, determine the second area feature model as the target area feature model.

5. The method according to any one of claims 1-4, characterized in that, The method for making the set of feature models includes: Obtain a scene image of the water level recognition scene, where the water level recognition scene includes the area to be recognized; Partition the water level recognition scenario based on the water level height to obtain multiple sub-regions, where each sub-region in the multiple sub-regions corresponds to a water level height range; Extract features from the water level recognition scenario based on the scenario image to obtain water level recognition scenario features; Determine the sub-region features corresponding to each sub-region in the multiple sub-regions according to the water level recognition scenario features; Produce the feature model set according to a preset standard model and the sub-region features corresponding to each sub-region in the multiple sub-regions.

6. The method according to any one of claims 1-4, characterized in that, The water level recognition of the target image to obtain the water level recognition result of the area to be recognized includes: Perform color space conversion on the target image to obtain a converted first image, where the first image includes pixel values of different color channels and a grayscale space; Perform threshold segmentation on each color channel in the first image to classify the pixels in the first image, obtaining a segmented second image, where the pixels in the second image are divided into foreground and background; Perform contour detection on the second image to determine the water level line contour; Calculate the Y-axis position of the water level line in the target image based on the pixel points on the water level line contour; Determine the water level reading according to the Y-axis position of the water level line and a preset mapping relationship representing the relationship between the Y-axis position and the water level reading.

7. The method according to any one of claims 1-4, characterized in that The image matting process of the real-time image including the area to be recognized based on the matting algorithm to enhance and / or suppress the information in the real-time image to obtain a target image after matting processing includes: Obtain a preset target matting; Apply the target matting to the real-time image to determine the area to be processed corresponding to the target matting in the real-time image; Perform image processing on the area to be processed based on the target matting to obtain a target processed area; Fuse the target processed area with the remaining part of the real-time image except the target processed area to determine the target image.

8. A water level recognition device, characterized in that, Include: An image acquisition module for acquiring a real-time image of the scene to be recognized; A feature matching module for performing feature matching on the real-time image based on a preset feature model set to determine the area to be recognized corresponding to the real-time image; An image processing module for performing image matting processing on the real-time image including the area to be recognized based on the matting algorithm to enhance and / or suppress the information in the real-time image to obtain a target image after matting processing; A water level recognition module for performing water level recognition on the target image to obtain the water level recognition result of the area to be recognized, where the water level recognition result includes the water level line position and water level reading of the area to be recognized.

9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and the processor executes the computer program to implement the method according to any one of claims 1-7.

10. An electronic device, characterized in that, The electronic device includes a memory and a processor, a computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for detecting abnormal behaviors

    CN103761748A

  • A method for recognizing and estimating water level of hydrological ruler based on image analysis

    CN109522889A

  • Water level monitoring method for scale identification based on clustering partition

    CN111626190A

  • River water level detection system and method based on point cloud and program product

    CN115060343A

  • Basin model generation method and device, electronic equipment and storage medium

    CN115526999A