Water level identification methods, devices, storage media and electronic equipment
By processing real-time images using feature model sets and masking algorithms, the problems of camera position stability and environmental adaptability were solved, achieving efficient water level recognition in complex environments.
Patent Information
- Application Number
- CN202411311670.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2024-09-18
- Filing Date
- 2024-09-20
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-09-20
AI Technical Summary
Existing water level recognition technologies have shortcomings in terms of camera position stability, dependence on water gauges, and environmental adaptability, resulting in poor reliability and accuracy of recognition.
The algorithm uses feature matching and masking based on feature model sets to process real-time images, reducing dependence on camera position and water level gauge, enhancing image information processing, and improving recognition accuracy.
By using feature matching and masking algorithms, the water level position and readings can be accurately identified under conditions of camera position changes and environmental interference, reducing reliance on water gauges and improving the reliability and accuracy of water level identification.
Smart Images

Figure CN120318806B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing, and in particular to a water level identification method, apparatus, storage medium, and electronic device. Background Technology
[0002] Water level identification technology plays a crucial role in various fields, including modern water resource management, flood warning, navigation safety, and ecological environment monitoring. With the intensification of global climate change and the increasing frequency of extreme weather events, natural disasters such as floods and droughts are having a more significant impact on human society and the natural environment. Therefore, accurate and real-time monitoring and identification of water level changes has become an important technical means to protect people's lives and property, optimize water resource allocation, and maintain ecological balance.
[0003] With the advancement of technology, particularly the application of modern information technologies such as sensor technology, remote communication technology, big data processing, and artificial intelligence, water level identification methods are gradually developing towards automation and intelligence. These emerging technologies provide more accurate, efficient, and convenient solutions for water level identification, greatly improving the real-time performance and accuracy of water level monitoring, and injecting new vitality into the development of related fields. Traditionally, water level data acquisition relies on various sensor technologies, including but not limited to float-type, radar-type, pressure-type, and bubble-type sensors. While these methods each have their advantages, they are all susceptible to inherent differences in instrument performance and changes in external environmental conditions, which may lead to errors or anomalies in the water level data. Summary of the Invention
[0004] The main objective of this disclosure is to provide a water level identification method, apparatus, storage medium, and electronic device, which aims to solve the technical problems of poor reliability and accuracy of water level identification in the prior art.
[0005] To achieve the above objectives, this disclosure proposes a water level identification method, comprising:
[0006] Acquire real-time images of the scene to be identified;
[0007] Based on a preset set of feature models, feature matching is performed on the real-time image to determine the region to be identified in the real-time image.
[0008] Based on the masking algorithm, image masking processing is performed on the real-time image containing the region to be identified in order to enhance and / or suppress the information in the real-time image, so as to obtain the target image after masking processing.
[0009] Water level recognition is performed on the target image to obtain the water level recognition result of the area to be recognized. The water level recognition result includes the water level line position and water level reading of the area to be recognized.
[0010] Optionally, the step of performing feature matching on the real-time image based on a preset feature model set to determine the region to be identified corresponding to the real-time image includes:
[0011] Obtain the feature model set, which 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.
[0012] Based on the water level height of each region feature model in the feature model set, the region features contained in the feature model set are compared with the target features contained in the real-time image to determine the target region feature model corresponding to the real-time image.
[0013] Based on the target region features corresponding to the target region feature model, determine the target region corresponding to the target region feature model;
[0014] The region to be identified is determined based on the target region.
[0015] Optionally, the step of comparing the regional features contained in the feature model set with the target features contained in the real-time image based on the water level height of each regional feature model in the feature model set to determine the target regional feature model corresponding to the real-time image includes:
[0016] Based on the water level height of each regional feature model in the feature model set, the feature matching order of the feature models in the feature model set is determined;
[0017] Based on the feature matching order, a first region feature model is determined in the feature model set, and the water level height corresponding to the first region feature model is the lowest.
[0018] Based on the first region feature model, feature extraction is performed on the real-time image to determine the target features;
[0019] The target feature is compared with the regional features of the first regional feature model to obtain the first feature comparison result;
[0020] If the first feature comparison result meets the preset feature comparison conditions, the first region feature model is determined as the target region feature model.
[0021] Optionally, it also includes:
[0022] If the first feature comparison result does not meet the preset feature comparison condition, the second region feature model in the feature model set is determined according to the feature matching order, and 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] The target feature is compared with the regional features of the second regional feature model to obtain the second feature comparison result;
[0024] If the second feature comparison result meets the preset feature comparison conditions, the second region feature model is determined as the target region feature model.
[0025] Optionally, the method for creating the feature model set includes:
[0026] Acquire a scene image of a water level recognition scenario, wherein the water level recognition scenario includes the area to be recognized;
[0027] The water level recognition scene is divided into multiple sub-regions based on the water level height, and each sub-region corresponds to a water level height range.
[0028] Based on the scene image, feature extraction is performed on the water level recognition scene to obtain water level recognition scene features;
[0029] Based on the water level identification scene characteristics, determine the sub-region characteristics corresponding to each of the multiple sub-regions;
[0030] The feature model set is created based on the preset standard model and the sub-region features corresponding to each of the multiple sub-regions.
[0031] Optionally, the step of performing water level recognition on the target image to obtain the water level recognition result of the area to be recognized includes:
[0032] The target image is subjected to color space conversion to obtain a converted first image, which includes pixel values of different color channels and grayscale space.
[0033] Threshold segmentation is performed on each color channel in the first image to classify the pixels in the first image, resulting in a segmented second image, in which the pixels are divided into foreground and background.
[0034] Contour detection is performed on the second image to determine the water level line contour;
[0035] Based on the pixels on the water level contour, calculate the Y-axis position of the water level in the target image;
[0036] The water level reading is determined based on the Y-axis position of the water level line and a preset mapping relationship between the Y-axis position and the water level reading.
[0037] Optionally, the masking algorithm-based method performs image masking processing on the real-time image containing the region to be identified, to enhance and / or suppress information in the real-time image, to obtain a masked target image, including:
[0038] Obtain the preset target mask;
[0039] The target mask is applied to the real-time image to determine the region to be processed in the real-time image corresponding to the target mask.
[0040] Based on the target mask, image processing is performed on the area to be processed to obtain the target processing area; the target processing area is then fused with the remaining parts of the real-time image excluding the target processing area to determine the target image.
[0041] Furthermore, to achieve the above objectives, this disclosure also provides a water level identification device, the water level identification device comprising:
[0042] The image acquisition module is used to acquire real-time images of the scene to be identified;
[0043] The feature matching module is used to perform feature matching on the real-time image based on a preset set of feature models in order to determine the region to be identified in the real-time image.
[0044] The image processing module is used to perform image masking processing on the real-time image containing the region to be identified based on the masking algorithm, so as to enhance and / or suppress the information in the real-time image and obtain the target image after masking processing.
[0045] The water level recognition module is used to 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 water level line position and water level reading of the area to be recognized.
[0046] In addition, to achieve the above objectives, this disclosure also provides a computer-readable storage medium storing a computer program, on which a processor executes the computer program to implement the above-described method.
[0047] In addition, to achieve the above objectives, this disclosure also provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor executes the computer program to implement the above-described method.
[0048] In addition, to achieve the above objectives, this disclosure also provides a computer program product that implements the above-described method when run by a processor.
[0049] First, a real-time image of the scene to be identified is acquired. Then, based on a pre-defined set of feature models, feature matching is performed on the real-time image to determine the region to be identified. This allows for accurate identification of the region in the real-time image. This process does not rely on the absolute position of the camera or a fixed preset point. Therefore, even if the camera moves and there are minor errors, as long as sufficient feature information is captured, the region to be identified can be accurately located through feature matching, thus reducing errors caused by changes in camera position. Based on a masking algorithm, an image mask is applied to the real-time image containing the region to be identified to enhance and / or suppress information in the real-time image, resulting in a masked target image. The application of the masking algorithm helps reduce interference from environmental factors, making water level extraction more accurate and reliable. Additionally, water level recognition is performed on the target image to obtain the water level recognition result for the region to be identified, including the position of the water level line and the water level reading. By constructing and applying a pre-defined set of feature models, the direct dependence on the water level gauge itself is indeed reduced to a certain extent. Even if the water level gauge is partially obscured or not in the center of the field of view in a real-world scenario, the recognition task can still be completed as long as the key features in the real-time image are captured. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0051] Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of this disclosure;
[0052] Figure 2 This is a flowchart illustrating a water level identification method according to an embodiment of the present disclosure;
[0053] Figure 3 This is a schematic diagram illustrating the setting of a regional feature model according to an embodiment of the present disclosure;
[0054] Figure 4 This is a structural block diagram of a water level identification device according to an embodiment of the present disclosure.
[0055] The realization of the purpose, functional features and advantages of this disclosure will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0056] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. Based on the embodiments of this disclosure, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this disclosure.
[0057] Reference Figure 1 , Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of this disclosure.
[0058] Typically, the device includes: at least one processor 301, a memory 302, and a water level identification program stored in the memory 302 and executable on the processor 301, the water level identification program being configured to implement the steps of the water level identification method as described above.
[0059] Processor 301 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 301 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 301 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 301 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. Processor 301 may also include an AI (Artificial Intelligence) processor, which processes operations related to the water level recognition method, enabling the water level recognition method model to learn autonomously, improving 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 or flash memory devices. In some embodiments, the non-transitory storage media in the memory 302 are used to store at least one instruction, which is executed by the processor 301 to implement the water level identification method provided in the method embodiments of this disclosure.
[0061] In some embodiments, the terminal may also optionally include a communication interface 303 and at least one peripheral device. The processor 301, memory 302, and communication interface 303 can be connected via a bus or signal line. Each peripheral device can be connected to the communication interface 303 via a bus, signal line, or 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 can be used to connect at least one I / O (Input / Output) related peripheral device 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 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0063] The radio frequency (RF) circuit 304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 304 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 304 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF 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 user identity module card, etc. The RF circuit 304 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 304 may also include circuitry related to NFC (Near Field Communication), which is not limited in this disclosure.
[0064] Display screen 305 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 305 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 301 for processing. In this case, 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, display screen 305 can be a single screen, the front panel of an electronic device; in other embodiments, display screen 305 can be at least two screens, respectively disposed on different surfaces of the electronic device or in a folded design; in still other embodiments, display screen 305 can be a flexible display screen, disposed on a curved or folded surface of the electronic device. Furthermore, display screen 305 can be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 305 can be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0065] Power supply 306 is used to supply power to various components in an electronic device. Power supply 306 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 306 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology. Those skilled in the art will understand that... Figure 1 The structure shown 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] Furthermore, this disclosure also proposes a storage medium storing a water level identification program, which, when executed by a processor, implements the steps of the water level identification method described above. Therefore, further details will not be repeated here. Additionally, the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the storage medium embodiments of this disclosure, please refer to the description of the method embodiments of this disclosure. As an example, program instructions can be deployed to execute on a single device, or on multiple devices located at one location, or on multiple devices distributed across multiple locations and interconnected via a communication network.
[0067] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0068] In order to improve the accuracy and timeliness of water level monitoring and ensure the reliability of management decisions, an innovative technical solution has been introduced—a water level recognition method based on machine vision and image processing technology. The core of this method lies in using a high-definition camera to capture real-time video images of the water gauge and the surrounding water surface. Then, advanced image processing algorithms are used to perform depth analysis on the images, automatically and accurately extracting the water gauge markings and corresponding water level information from the complex background.
[0069] Specifically, a high-definition camera is fixed to photograph a standard water level gauge. The operation involves recording the pixel coordinates of the water level gauge within the frame and taking a photo of the gauge at its lowest water level as a comparison template. During the recognition process, the system locates the water level line and calculates the water level reading by comparing the template image line by line with the water level gauge image. However, this approach faces several key challenges:
[0070] Camera position stability challenge: Although cameras support setting preset points to return to a specific recognition angle, the precision limitations of current PTZ camera mechanical structures result in slight angular deviations after each return to position. This causes the actual water level gauge position to shift relative to the preset coordinate range, potentially preventing the recognition algorithm from accurately locating the water level gauge and leading to recognition failure. Therefore, existing technologies tend to strictly fix the camera position to avoid any movement.
[0071] High dependence on "water level gauge": The existing identification methods rely heavily on the visible water level gauge itself. Once the water level gauge is obscured, damaged, or out of sight, the system will be unable to perform effective water level identification.
[0072] Poor environmental adaptability: Environmental conditions such as rain, fog, or changes in lighting can significantly affect image quality and reduce the accuracy of similarity matching between the template and the water level gauge image. This environmental sensitivity makes the system prone to recognition errors or complete failure under different weather conditions.
[0073] In summary, existing technical solutions have made some progress in improving the automation level of water level identification, but key issues such as camera position stability, absolute dependence on water gauges, and poor environmental adaptability still need to be addressed in order to improve the overall reliability and accuracy of water level identification.
[0074] In view of this, the present disclosure proposes a water level identification method, device, storage medium, and electronic device to solve the above-mentioned technical problems.
[0075] Reference Figure 2 , Figure 2 This is a flowchart illustrating a water level identification 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 identified.
[0077] Step S12: Based on the preset feature model set, perform feature matching on the real-time image to determine the region to be identified in the real-time image.
[0078] Step S13: Based on the masking algorithm, perform image masking processing on the real-time image containing the region to be identified in order 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. 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] The above technical solution first acquires a real-time image of the scene to be identified. Then, based on a preset feature model set, feature matching is performed on the real-time image to determine the region to be identified. This allows for accurate determination of the region to be identified in the real-time image. This process does not rely on the absolute position of the camera or a fixed preset point. Therefore, even if the camera experiences minor errors after movement, as long as sufficient feature information is captured, the region to be identified can be accurately located through feature matching, thus reducing errors caused by changes in camera position. Based on a masking algorithm, an image mask is applied to the real-time image containing the region to be identified to enhance and / or suppress information in the real-time image, resulting in a masked target image. The application of the masking algorithm helps reduce interference from environmental factors, making water level extraction more accurate and reliable. Furthermore, water level recognition is performed on the target image to obtain the water level recognition result for the region to be identified, including the water level line position and water level reading. By constructing and applying a pre-defined set of feature models, the direct dependence on the water gauge itself is indeed reduced to a certain extent. Even if the water gauge is partially obscured or not in the center of the field of view in a real-world scenario, the recognition task can still be completed as long as the key features in the real-time image can be captured.
[0081] Among the possible methods for creating feature model sets are:
[0082] Acquire scene images of the water level recognition scenario, which includes the area to be recognized;
[0083] The water level recognition scene is divided into multiple sub-regions based on the water level height, and each sub-region corresponds to a water level height range.
[0084] Based on scene images, feature extraction is performed on water level recognition scenes to obtain water level recognition scene features;
[0085] Based on the characteristics of the water level identification scene, determine the sub-region features corresponding to each sub-region in multiple sub-regions;
[0086] Based on the preset standard model and the sub-region features corresponding to each sub-region in multiple sub-regions, a feature model set is created.
[0087] For example, in a scenario where water level identification is to be performed, scene images containing the area to be identified (such as the area near the water level line) can be collected first. The scene images should comprehensively cover different environmental conditions (such as changes in lighting and weather) to ensure the robustness of the subsequently created feature model. Then, the water level identification scene is divided into multiple sub-regions based on water level height, with each sub-region corresponding to a specific water level height range. This allows for the extraction and modeling of features for different water level height ranges, thereby improving the accuracy and efficiency of the identification process.
[0088] Image processing techniques (such as edge detection, corner detection, and texture analysis) are then used to extract useful feature information from the scene image. These features should reflect the physical characteristics (such as shape, size, and color) and environmental conditions (such as lighting and shadows) of the area to be identified. Based on feature extraction, the features of each sub-region are further analyzed to determine which features are unique to that sub-region. These sub-region features will be used for subsequent feature model creation. A set of feature models is created using a preset standard model and the identified sub-region features. This ensures that each sub-region corresponds to a feature model that can describe the regional characteristics of that sub-region.
[0089] The preset standard model can be a template generated based on template matching or machine learning algorithms according to the water level identification requirements and the characteristics of the scene to be identified. It includes all water level identification-related information within the corresponding sub-region. By importing or inputting the determined sub-region features into the corresponding standard model, the feature model corresponding to each sub-region can be obtained. This disclosure does not limit the specific form of the standard model.
[0090] Figure 3 This is a schematic diagram illustrating a regional feature model setting according to an embodiment of the present disclosure. Figure 3As shown, the feature model set can include three regional feature models: A, B, and C. Regional feature model C corresponds to the region with a water level height range of 1-3, which is the region shown in the dashed box. Regional feature model B corresponds to the region with a water level height range of 4-6, and regional feature model A corresponds to the region with a water level height range of 7-9.
[0091] Of course, the entire area reachable by the water level can be divided into more or fewer sub-regions according to the specific recognition accuracy requirements and the size of the recognition scene. 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 size of the recognition scene. This disclosure does not specifically limit this.
[0092] It is worth noting that, even in this disclosure, Figure 3 The diagram shows a feature model set created based on the characteristics of a water level gauge. However, the final water level identification result is not determined based on the water level gauge readings, but rather the water level gauge is treated as a visual feature contained within a region. Therefore, as shown... Figure 3 As shown, region feature model C includes features of regions 1, 2, and 3 and rectangular features; region feature model B includes features of regions 4, 5, and 6 and triangular features; and region feature model B includes features of regions 7, 8, and 9, circular features, and elliptical features.
[0093] If in Figure 3 Even if the water gauge feature is missing in the image shown, or if the water gauge is partially obscured and thus incomplete, feature matching can still be performed based on the obtained rectangular feature and region feature model C, the obtained triangular feature and region feature model B, and the obtained circular and elliptical features and region feature model A.
[0094] In one possible approach, feature matching is performed on the real-time image based on a pre-defined set of feature models to determine the region to be identified in the real-time image, including:
[0095] Obtain a feature model set, which includes regional feature models corresponding to different regional features. Each regional feature model in the feature model set corresponds to a water level height.
[0096] Based on the water level height of each region feature model in the feature model set, the regional features contained in the feature model set are compared with the target features contained in the real-time image to determine the target region feature model corresponding to the real-time image.
[0097] Based on the target region features corresponding to the target region feature model, determine the target region corresponding to the target region feature model;
[0098] Based on the target area, determine the area to be identified.
[0099] For example, the real-time acquired image is compared with each region feature model in the feature model set to identify the consistency or similarity between the target feature in the real-time image and the corresponding feature in the feature model. Through comparison, the region feature model that best matches the target feature in the real-time image is found. 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 region feature model is determined, the corresponding target region in the real-time image can be calculated from the region represented by that model.
[0100] In this way, by comparing real-time images with a pre-built set of feature models, the target region in the image can be quickly and accurately identified, and the region to be identified that needs to be focused on or processed can be further determined.
[0101] In one possible approach, based on the water level height of each region feature model in the feature model set, the regional features contained in the feature model set are compared with the target features contained in the real-time image to determine the target region feature model corresponding to the real-time image, including:
[0102] 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;
[0103] Based on the feature matching order, the first region feature model in the feature model set is determined, and the water level height corresponding to the first region feature model is the lowest.
[0104] Based on the first region feature model, feature extraction is performed on the real-time image to determine the target features;
[0105] The target feature is compared with the regional features of the first region feature model to obtain the first feature comparison result;
[0106] If the first feature comparison result meets the preset feature comparison conditions, the first region feature model is determined as the target region feature model.
[0107] For example, firstly, based on the water level height corresponding to each regional feature model in the feature model set, these models are sorted from lowest to highest water level. This sorting process determines the order of subsequent feature comparisons. From the sorted feature model set, the regional feature model with the lowest water level height is selected as the first regional feature model and 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. The target features extracted from the real-time image are compared with the regional features of the first regional feature model. Specifically, similarity, distance, or other metrics between features can be calculated. Based on the comparison results, it is evaluated whether preset feature comparison conditions are met. Feature comparison conditions may include similarity thresholds, distance thresholds, or other application-specific evaluation criteria.
[0108] If the first feature matching result meets the preset feature matching conditions, then the first region feature model is determined as the target region feature model, meaning that the region represented by the real-time image is considered to match the region represented by the first region feature model in terms of features. If the conditions are not met, then the next region feature model (i.e., the model with a slightly higher water level) is selected according to the feature matching order, and the steps are repeated until a model that meets the conditions is found or all models have been traversed.
[0109] For example, based on the above Figure 3 The diagram illustrates the setting of regional feature models. In this disclosure, based on water level height, the feature matching order can be regional feature model C, regional feature model B, and regional feature model A. First, a first preset point can be set based on the position of regional feature model C, corresponding to the lowest water level. This ensures that when regional feature model C is not obscured, the image acquisition device can acquire the regional features corresponding to regional feature model C when located at the first preset point. A second preset point is set based on the position of regional feature model B. This ensures that when regional feature model B is not obscured, the image acquisition device can acquire the regional features corresponding to regional feature model B when located at the second preset point. Finally, a third preset point is set based on the position of regional feature model A. This ensures that when regional feature model A is not obscured, the image acquisition device can acquire the regional features corresponding to regional feature model A when located at the third preset point.
[0110] Of course, a first preset point can also be set, so that the image acquisition device located at the first preset point can acquire the regional features corresponding to regional feature model C and regional feature model B. This embodiment of the present disclosure does not specifically limit this. The situation where the regional feature model is occluded can include being submerged by water flow, and this embodiment of the present disclosure also does not specifically limit this.
[0111] Thus, based on the preset first preset point, if the image acquisition device cannot acquire the regional features corresponding to the regional feature model C in real time when it is located at the first preset point, it means that the regional feature model C has been submerged by water or blocked by other obstructions. In this case, the image acquisition device is moved to the next preset point in order from low water level to high water level to acquire the regional features corresponding to the regional feature model of the next preset point. Subsequent operations follow the same principle and will not be elaborated here.
[0112] Among the possible approaches are:
[0113] If the first feature comparison result does not meet the preset feature comparison conditions, the second region feature model in the feature model set is determined according to the feature matching order. 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.
[0114] The target features are compared with the regional features of the second region feature model to obtain the second feature comparison result;
[0115] If the second feature comparison result meets the preset feature comparison conditions, the second region feature model is determined as the target region feature model.
[0116] For example, when the first feature comparison result does not meet the preset feature comparison conditions, the next regional feature model is selected according to the feature matching order (water level from low to high), that is, the regional features of the second regional feature model are compared with the target features to obtain the second feature comparison result.
[0117] If the second feature comparison result meets the preset feature comparison conditions, then the second region feature model is determined as the target region feature model. This means that the region represented by the real-time image matches the region represented by the second region feature model in terms of water level and other features. If the second feature comparison result still does not meet the conditions, the next region feature model is selected for comparison according to the feature matching order until a model that meets the conditions is found or all models have been traversed.
[0118] In possible ways, water level identification is performed on the target image to obtain the water level identification result of the area to be identified, including:
[0119] The target image is converted to a color space to obtain the first image after conversion. The first image includes pixel values of different color channels and grayscale space.
[0120] Thresholding is performed on each color channel in the first image to classify the pixels in the first image, resulting in a segmented second image in which the pixels are divided into foreground and background.
[0121] Contour detection is performed on the second image to determine the contour of the water level line;
[0122] Calculate the Y-axis position of the water level line in the target image based on the pixels on the water level line contour;
[0123] The water level reading is determined based on the position of the water level line on the Y-axis and a preset mapping relationship between the Y-axis position and the water level reading.
[0124] For example, since different color channels may have varying sensitivities to waterline identification, image analysis can be performed in different color spaces. Therefore, the target image can first be color space converted to obtain a first image. This first image contains different color channels (e.g., B, G, R) and may also include pixel values in the grayscale space. To separate potential waterline regions from each color channel, thresholding can be applied to each color channel in the first image. One or more thresholds are selected for each color channel, classifying pixels as foreground (which could be waterline) and background.
[0125] Then, to identify specific shapes or contours from the segmented image, especially those potentially representing water levels, a contour detection algorithm can be applied to the results of all thresholded color channels (or the best selected channel) to filter out the contours that best match the water level characteristics. Based on the determined water level contour, its Y-axis position is calculated, specifically by calculating the average or median of the Y-coordinates of all pixels in the contour. Finally, based on the calculated Y-axis position and a pre-defined mapping relationship between the Y-axis position and the actual water level reading, the final water level reading is determined.
[0126] In one possible approach, based on a masking algorithm, an image masking process is applied to a real-time image containing the region to be identified to enhance and / or suppress information in the real-time image, resulting in a masked target image, including:
[0127] Obtain the preset target mask;
[0128] A target mask is applied to the real-time image to determine the region to be processed in the real-time image corresponding to the target mask.
[0129] Based on the target mask, image processing is performed on the area to be processed to obtain the target processing area;
[0130] The target processing region is fused with the rest of the real-time image excluding the target processing region to determine the target image.
[0131] For example, the target mask could be a polarizing mask, similar to the effect of a polarizing filter, used to remove highlights from water surfaces or reflective surfaces. An image processing strategy based on the HLS color space can be employed. 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 done using image processing libraries such as OpenCV or PIL. In the HLS space, highlight areas are typically represented by areas with high brightness, which can be 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 luminance channel has been processed at this point, the processed luminance channel needs to be merged with the original hue and saturation channels and converted back to the RGB color space.
[0133] For example, the target mask could also be a moss removal mask, which defines which areas in the image might contain moss. Specifically, it could be a simple binary image or a grayscale image with different weights to indicate the intensity and distribution of the moss. For instance, the moss-covered areas can be calculated by extracting pixels from the green channel using the image's BGR color space.
[0134] A masking algorithm is used to process moss-covered areas in real-time images. Specifically, pixels identified as moss in the mask can be replaced with background pixels or the average color in the image. Alternatively, based on the weights in the mask, the moss-covered areas can be blurred, faded, or enhanced to varying degrees. In cases where moss significantly affects image color, color correction can be performed based on the mask to restore natural colors.
[0135] Thus, by relying on the color space-based masking algorithm, interference from external environmental factors can be reduced during video water level recognition, effectively reducing inaccurate recognition results caused by factors such as lighting, floating debris pollution, water level contamination, rain, and fog.
[0136] Reference Figure 4 , Figure 4 This is a structural block diagram of a water level identification device according to an embodiment of the present disclosure. Based on the same inventive concept as the foregoing embodiments, the device includes:
[0137] Image acquisition module 10 is used to acquire real-time images of the scene to be identified;
[0138] Feature matching module 20 is used to perform feature matching on the real-time image based on a preset feature model set in order to determine the region to be identified in the real-time image.
[0139] Image processing module 30 is used to perform image masking processing on a real-time image containing the region to be identified based on a masking algorithm, so as to enhance and / or suppress information in the real-time image to obtain a target image after masking processing.
[0140] The water level recognition module 40 is used to 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 water level line position and water level reading of the area to be recognized.
[0141] Optionally, the feature matching module 20 is used to:
[0142] Obtain the feature model set, which 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.
[0143] Based on the water level height of each region feature model in the feature model set, the region features contained in the feature model set are compared with the target features contained in the real-time image to determine the target region feature model corresponding to the real-time image.
[0144] Based on the target region features corresponding to the target region feature model, determine the target region corresponding to the target region feature model;
[0145] The region to be identified is determined based on the target region.
[0146] Optionally, the feature matching module 20 is used to:
[0147] Based on the water level height of each regional feature model in the feature model set, the feature matching order of the feature models in the feature model set is determined;
[0148] Based on the feature matching order, a first region feature model is determined in the feature model set, and the water level height corresponding to the first region feature model is the lowest.
[0149] Based on the first region feature model, feature extraction is performed on the real-time image to determine the target features;
[0150] The target feature is compared with the regional features of the first regional feature model to obtain the first feature comparison result;
[0151] If the first feature comparison result meets the preset feature comparison conditions, the first region feature model is determined as the target region feature model.
[0152] Optionally, the feature matching module 20 is further configured to:
[0153] If the first feature comparison result does not meet the preset feature comparison condition, the second region feature model in the feature model set is determined according to the feature matching order, and 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] The target feature is compared with the regional features of the second regional feature model to obtain the second feature comparison result;
[0155] If the second feature comparison result meets the preset feature comparison conditions, the second region feature model is determined as the target region feature model.
[0156] Optionally, the method for creating the feature model set includes:
[0157] Acquire a scene image of a water level recognition scenario, wherein the water level recognition scenario includes the area to be recognized;
[0158] The water level recognition scene is divided into multiple sub-regions based on the water level height, and each sub-region corresponds to a water level height range.
[0159] Based on the scene image, feature extraction is performed on the water level recognition scene to obtain water level recognition scene features;
[0160] Based on the water level identification scene characteristics, determine the sub-region characteristics corresponding to each of the multiple sub-regions;
[0161] The feature model set is created based on the preset standard model and the sub-region features corresponding to each of the multiple sub-regions.
[0162] Optionally, the water level identification module 40 is used for:
[0163] The target image is subjected to color space conversion to obtain a converted first image, which includes pixel values of different color channels and grayscale space.
[0164] Threshold segmentation is performed on each color channel in the first image to classify the pixels in the first image, resulting in a segmented second image, in which the pixels are divided into foreground and background.
[0165] Contour detection is performed on the second image to determine the water level line contour;
[0166] Based on the pixels on the water level contour, calculate the Y-axis position of the water level in the target image;
[0167] The water level reading is determined based on the Y-axis position of the water level line and a preset mapping relationship between the Y-axis position and the water level reading.
[0168] Optionally, the image processing module 30 is used for:
[0169] Obtain the preset target mask;
[0170] The target mask is applied to the real-time image to determine the region to be processed in the real-time image corresponding to the target mask.
[0171] Based on the target mask, image processing is performed on the area to be processed to obtain the target processing area;
[0172] The target processing region is fused with the rest of the real-time image excluding the target processing region to determine the target image.
[0173] It should be noted that since the steps performed by the device in this embodiment are the same as those in the aforementioned method embodiments, the specific implementation methods and the technical effects that can be achieved can be referred to the aforementioned embodiments, and will not be repeated here.
[0174] Furthermore, in one embodiment, the present disclosure also provides an electronic device, the device including a processor, a memory, and a computer program stored in the memory, the computer program being executed by the processor to implement the steps of the methods in the foregoing embodiments.
[0175] Furthermore, in one embodiment, the present disclosure also provides a computer storage medium storing a computer program that, when executed by a processor, implements the steps of the methods described in the foregoing embodiments.
[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 disk, or CD-ROM; or it may be a device including one or any combination of the above-mentioned memories. The computer may be a variety of computing devices, including smart terminals and servers.
[0177] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, 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 as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0178] As an example, executable instructions may, but do not necessarily, correspond to files in the file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0179] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0180] It should be noted that, in this document, the terms "comprising," "may include," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system 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 system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0181] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a multimedia terminal device (which may be a mobile phone, computer, television receiver, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.
[0183] The above description is merely an optional embodiment of this disclosure and does not limit the patent scope of this disclosure. Any equivalent structural transformations made using the contents of this specification and drawings under the inventive concept of this disclosure, or direct / indirect applications in other related technical fields, are included within the patent protection scope of this disclosure.
Claims
1. A water level identification method, characterized in that, include: Acquire real-time images of the scene to be identified; A feature model set is obtained, comprising regional feature models corresponding to different regional features, each regional feature model in the feature model set corresponding to a water level height; based on the water level height of each regional feature model in the feature model set, the regional features contained in the feature model set are compared with the target features contained in the real-time image to determine the target regional feature model corresponding to the real-time image; based on the target regional features corresponding to the target regional feature model, the target region corresponding to the target regional feature model is determined; based on the target region, the region to be identified corresponding to the real-time image is determined. Based on the masking algorithm, a masking process is performed on the real-time image containing the region to be identified in order to enhance and / or suppress the information in the real-time image, thereby obtaining the target image after masking. Water level recognition is performed on the target image to obtain the water level recognition result of the area to be recognized. The water level recognition result includes the water level line position and water level reading of the area to be recognized.
2. The method according to claim 1, characterized in that, The step of comparing the regional features contained in the feature model set with the target features contained in the real-time image based on the water level height of each regional feature model in the feature model set to determine the target regional feature model corresponding to the real-time image includes: Based on the water level height of each regional feature model in the feature model set, the feature matching order of the feature models in the feature model set is determined; Based on the feature matching order, a first region feature model is determined in the feature model set, and the water level height corresponding to the first region feature model is the lowest. Based on the first region feature model, feature extraction is performed on the real-time image to determine the target features; The target feature is compared with the regional features of the first regional feature model to obtain the first feature comparison result; If the first feature comparison result meets the preset feature comparison conditions, the first region feature model is determined as the target region feature model.
3. The method according to claim 2, characterized in that, Also includes: If the first feature comparison result does not meet the preset feature comparison condition, the second region feature model in the feature model set is determined according to the feature matching order, and 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. The target feature is compared with the regional features of the second regional feature model to obtain the second feature comparison result; If the second feature comparison result meets the preset feature comparison conditions, the second region feature model is determined as the target region feature model.
4. The method according to any one of claims 1-3, characterized in that, The method for creating the feature model set includes: Acquire a scene image of a water level recognition scenario, wherein the water level recognition scenario includes the area to be recognized; The water level recognition scene is divided into multiple sub-regions based on the water level height, and each sub-region corresponds to a water level height range. Based on the scene image, feature extraction is performed on the water level recognition scene to obtain water level recognition scene features; Based on the water level identification scene characteristics, determine the sub-region characteristics corresponding to each of the multiple sub-regions; The feature model set is created based on the preset standard model and the sub-region features corresponding to each of the multiple sub-regions.
5. The method according to any one of claims 1-3, characterized in that, The step of performing water level recognition on the target image to obtain the water level recognition result of the area to be recognized includes: The target image is subjected to color space conversion to obtain a converted first image, which includes pixel values of different color channels and grayscale space. Threshold segmentation is performed on each color channel in the first image to classify the pixels in the first image, resulting in a segmented second image, in which the pixels are divided into foreground and background. Contour detection is performed on the second image to determine the water level line contour; Based on the pixels on the water level contour, calculate the Y-axis position of the water level in the target image; The water level reading is determined based on the Y-axis position of the water level line and a preset mapping relationship between the Y-axis position and the water level reading.
6. The method according to any one of claims 1-3, characterized in that, The masking algorithm performs image masking processing on the real-time image containing the region to be identified, in order to enhance and / or suppress information in the real-time image, to obtain a masked target image, including: Obtain the preset target mask; The target mask is applied to the real-time image to determine the region to be processed in the real-time image corresponding to the target mask. Based on the target mask, image processing is performed on the area to be processed to obtain the target processing area; The target processing region is fused with the rest of the real-time image excluding the target processing region to determine the target image.
7. A water level identification device, characterized in that, For implementing the water level identification method as described in claim 1, comprising: The image acquisition module is used to acquire real-time images of the scene to be identified; The feature matching module is used to perform feature matching on the real-time image based on a preset set of feature models in order to determine the region to be identified in the real-time image. The image processing module is used to perform image masking processing on the real-time image containing the region to be identified based on the masking algorithm, so as to enhance and / or suppress the information in the real-time image and obtain the target image after masking processing. The water level recognition module is used to 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 water level line position and water level reading of the area to be recognized.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, wherein the memory stores a computer program and the processor executes the computer program to implement the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Water gauge image recognition method using AI algorithm
CN116052140A
3D structured light camera system and method, electronic equipment and readable storage medium
CN116320357A