Water leakage detection method, device, medium and equipment based on color change
By using a leak detection method based on color change in steel production, converting it into HSV color space and performing spatial correlation analysis, the problems of low leakage detection efficiency and light interference in the prior art are solved, and accurate identification and timely processing of minor leaks are achieved.
Patent Information
- Application Number
- CN202510765747.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-10
AI Technical Summary
The existing water leakage detection technology is inefficient in steel production and is susceptible to light interference, making it difficult to accurately identify minor water leakage, resulting in safety hazards and economic losses.
The leakage detection method based on color change is adopted, and the images of the multi-frame water-soaked color-changing equipment are acquired, and the image is converted into the HSV color space. Combined with spatial correlation analysis, the water-soaked degree is identified and whether there is water leakage is determined.
It improves the accuracy of water leakage detection, can timely identify minor water leakage, reduce misjudgment, and meets the needs of safe production and efficient operation and maintenance.
Smart Images

Figure CN120279118B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a water leakage detection method, device, medium and equipment based on color change. Background Art
[0002] The unique environment of steel production, characterized by high temperatures, high humidity, high dust levels, dense equipment, and complex pipelines, places extremely high demands on leak detection. The steel production process involves numerous cooling systems, circulating water networks, and industrial water equipment. Failure to promptly detect and address pipeline leaks or equipment seepage can lead to serious consequences, including equipment downtime, production safety accidents (such as the risk of explosions in high-temperature equipment upon contact with water), and environmental pollution, resulting in significant economic losses and production delays.
[0003] Currently, leak detection methods commonly used in steel production rely primarily on manual inspections and traditional contact sensors (such as humidity sensors). Manual inspections are labor-intensive and, in harsh environments like high temperatures and dust, result in high workload, low efficiency, and a high risk of missed detections. Traditional contact sensors, which must be deployed at potential leak locations, have drawbacks such as high installation and maintenance costs, susceptibility to environmental interference (such as dust accumulation causing false sensor alarms), and an inability to cover large areas.
[0004] Using a water-discoloring device for leak detection is a very simple and effective solution. When exposed to water, the color of the test paper changes significantly, and based on this color signature, it can be used to determine if there is significant water seepage in the environment. However, existing methods using color signatures can only accurately identify significant water seepage. For less severe cases, such as when the water-discoloring device is only slightly exposed to water, or when the environment is extremely humid, causing the water-discoloring device to change color due to moisture, current detection technologies struggle to accurately identify these situations.
[0005] Furthermore, steel production workshops have complex lighting conditions (such as strong lighting and radiation from high-temperature equipment). Image detection technology based on traditional RGB color space is susceptible to lighting fluctuations, leading to color recognition bias and difficulty in achieving stable and accurate detection of minor leaks in complex lighting environments. Some improved methods have adopted the HSV color space for leak detection, but existing HSV color recognition methods typically use a fixed threshold range to determine whether a leak exists or not. This judgment method is still difficult to adapt to detecting minor leaks in such complex scenarios. As a result, once a leak is identified, it is often obvious that water seepage has occurred, resulting in significant losses.
[0006] Based on this, in special environments such as steel production, there is an urgent need for a non-contact, light-interference-resistant device that can accurately and promptly identify minor water leaks, so that relevant maintenance personnel can deal with minor water leaks in a timely manner to avoid more serious water leaks and meet their needs for safe production and efficient operation and maintenance. Summary of the Invention
[0007] The purpose of this application is to provide a water leakage detection method, device, medium and equipment based on color change to solve at least one of the above technical problems.
[0008] In a first aspect of the present application, a water leakage detection method based on color change is provided, the method comprising:
[0009] Acquire multiple frames of raw images of multiple water-chromatic devices captured, each of which is placed at a different location in the current environment. Each water-chromatic device includes a closed box formed of a transparent material and a water-chromatic test paper within the box. A water inlet is defined on one side of the box. Each raw image reflects the RGB color characteristics of a corresponding water-chromatic device at a corresponding moment.
[0010] Extracting a ROI region for water leakage analysis from each frame of the original image to form a corresponding image to be analyzed, wherein the ROI region represents the area corresponding to the water-immersed color-changing test paper;
[0011] Convert each frame of the image to be analyzed into the corresponding HSV image;
[0012] Analyze the comprehensive water immersion degree of the corresponding water-immersion color-changing device based on each frame of the image to be analyzed and each frame of the HSV image;
[0013] Based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement of each water-immersion color-changing device, spatial correlation analysis is used to determine whether there is water leakage in the current environment.
[0014] Optionally, the comprehensive water immersion degree of the corresponding water-immersion color-changing device based on each frame of the image to be analyzed and each frame of the HSV image analysis includes:
[0015] identifying a first water immersion degree of the corresponding water-immersion color-changing device according to the color characteristics of the HSV image;
[0016] Subtracting the rear frame image from the front frame image to obtain a first RGB difference image, wherein the rear frame image is the image to be analyzed corresponding to the HSV image, and the front frame image is the image to be analyzed formed by the original image taken at the previous moment for the same water-immersion color-changing device relative to the rear frame image;
[0017] converting the first RGB difference image into a first HSV difference image, and analyzing a second water immersion degree of the corresponding water-immersion color-changing device based on color features of the first HSV difference image;
[0018] The comprehensive water immersion degree of the corresponding water immersion color changing device is calculated based on the first water immersion degree and the second water immersion degree.
[0019] Optionally, before calculating the comprehensive water immersion degree of the corresponding water immersion color changing device based on the first water immersion degree and the second water immersion degree, the method further includes:
[0020] Subtracting the rear frame image from the corresponding reference frame image to obtain a second RGB difference image, and converting the second RGB difference image into a second HSV difference image, wherein the reference frame image is an image to be analyzed formed by an original image taken at the same time as the rear frame image for a reference water-immersion color-changing device, and the reference water-immersion color-changing device and the water-immersion color-changing device corresponding to the rear frame image belong to the same water leakage detection point;
[0021] Analyzing a third water immersion degree of the corresponding water immersion color-changing device based on the color characteristics of the second HSV difference image;
[0022] Calculating the comprehensive water immersion degree of the corresponding water immersion color changing device based on the first water immersion degree and the second water immersion degree includes: determining the comprehensive water immersion degree of the water immersion color changing device based on the first water immersion degree, the second water immersion degree and the third water immersion degree.
[0023] Optionally, identifying the first water immersion degree of the corresponding water-discoloring device according to the color feature of the HSV image includes:
[0024] Determining a corresponding first color change threshold according to a placement position of the water-immersion color change device corresponding to the HSV image and environmental parameters of the current environment;
[0025] determining a first water immersion degree of the corresponding water immersion color-changing device based on the first color change threshold and the HSV image;
[0026] The analyzing the second water immersion degree of the corresponding water-immersion color-changing device based on the color feature of the first HSV difference image includes:
[0027] Determining a corresponding second color change threshold value according to the placement position of the water-immersion color change device corresponding to the first HSV difference image and environmental parameters of the current environment;
[0028] A second water immersion degree of the corresponding water immersion color-changing device is determined based on the second color change threshold and the first HSV difference image.
[0029] Optionally, determining a first water immersion degree of the corresponding water-immersion color-changing device based on the first color-changing threshold and the HSV image includes:
[0030] Determine a theoretical water-immersion area in the HSV image according to the position of the water inlet hole of the water-immersion color-changing device corresponding to the HSV image and the corresponding water leakage detection point;
[0031] Determining a first weight value for each pixel in the HSV image based on the theoretical water immersion area;
[0032] determining a first water immersion degree based on a color feature of each pixel in the HSV image and a corresponding first weight;
[0033] The determining, based on the second color change threshold and the first HSV difference image, a second water immersion degree of the corresponding water immersion color change device includes:
[0034] Determining a second weight for each pixel in the first HSV difference image based on the theoretical water immersion area;
[0035] A second water immersion degree is determined based on the color feature of each pixel in the HSV image and the corresponding second weight.
[0036] Optionally, the water-immersion color-changing device includes a main water-immersion color-changing device and an auxiliary water-immersion color-changing device;
[0037] The method of determining whether there is water leakage in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device includes:
[0038] When the combined water immersion degree of multiple main water-immersion color-changing devices exceeds a preset first water immersion degree threshold T1, it is determined that there is water leakage in the current environment;
[0039] When the comprehensive water immersion degree of none of the main water-immersion color-changing devices exceeds the preset second water immersion degree threshold value T2, and the comprehensive water immersion degree of the auxiliary water-immersion color-changing devices exceeds the preset third water immersion degree T3, and exceeds the comprehensive water immersion degree of one of the main water-immersion color-changing devices, it is determined that there is no water leakage in the current environment, and it is determined that the auxiliary water-immersion color-changing devices are abnormal;
[0040] When there is no main water immersion color-changing device whose comprehensive water immersion degree exceeds the first water immersion degree threshold T1, and there is at least one auxiliary water immersion color-changing device whose comprehensive water immersion degree and at least one main water immersion color-changing device both exceed the second water immersion degree threshold T2, it is determined that the current environment is humid, where T2≤T1.
[0041] Optionally, the determining whether there is water leakage in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device includes:
[0042] A trend analysis is performed on the comprehensive water immersion degree of each water immersion color-changing device at each moment, and based on the trend analysis result of each water immersion color-changing device, it is determined whether there is water leakage in the current environment.
[0043] In a second aspect of the present application, a water leakage detection device based on color change is provided, the device comprising:
[0044] An image acquisition module is configured to capture multiple frames of raw images of multiple water-chromatic devices. Each water-chromatic device is positioned in a corresponding position within the current environment. Each water-chromatic device comprises a closed box formed of a transparent material and a water-chromatic test paper within the box. A water inlet is provided on one side of the box. Each raw image frame reflects the RGB color characteristics of a corresponding water-chromatic device at a corresponding moment.
[0045] An image processing module is used to extract the ROI region for water leakage analysis from each frame of the original image to form a corresponding image to be analyzed, wherein the ROI region represents the area corresponding to the water-immersed color-changing test paper; and convert each frame of the image to be analyzed into a corresponding HSV image;
[0046] A water immersion degree calculation module is used to analyze the comprehensive water immersion degree of the corresponding water immersion color changing device based on each frame of the image to be analyzed and each frame of the HSV image;
[0047] The water leakage judgment module is used to determine whether there is a water leakage in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device.
[0048] In a third aspect of the present application, a computer-readable storage medium is provided, on which executable instructions are stored. When the executable instructions are executed by a processor, the processor executes the method described in any embodiment of the present application.
[0049] In a fourth aspect of the present application, an electronic device is provided, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the method as described in any one of the embodiments of the present application.
[0050] The color-change-based water leak detection method, apparatus, medium, and equipment disclosed in this application utilize the color changes of water-discoloring devices to detect water immersion at water leak detection points. Specifically, by converting their RGB color features into HSV color features and separating color information (H and S) from brightness information (V), the interference of illumination changes on color recognition is reduced, enabling more accurate identification of the color changes of each water-discoloring device, thereby accurately determining the water immersion degree of each water-discoloring device. Combined with the water immersion degree of each water-discoloring device, a comprehensive determination of whether a water leak exists in the current environment can be made, thereby avoiding deviations in leak detection at the water leak detection point due to anomalies in a single water-discoloring device and improving the accuracy of water leak detection. Furthermore, by utilizing HSV color features, minor water leaks can be more accurately identified, allowing relevant personnel to promptly address them and avoid more serious leaks, thereby meeting the requirements of safe production and efficient operation and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope of the present application.
[0052] Figure 1 1 is a flow chart of a water leakage detection method based on color change in one embodiment;
[0053] Figure 2 Schematic diagram of the structure of a water-immersion color-changing device in one embodiment at a first viewing angle;
[0054] Figure 3 Schematic diagram of the structure of the water-immersion color-changing device in one embodiment at a second viewing angle;
[0055] Figure 4 A schematic diagram of the placement of multiple water-immersion color-changing devices in a current environment from a third perspective in one embodiment;
[0056] Figure 5 A schematic diagram of the placement of multiple water-immersion color-changing devices in a current environment at a fourth viewing angle in one embodiment;
[0057] Figure 6 1. A schematic diagram of a process for analyzing the comprehensive water immersion degree of a corresponding water immersion color changing device based on each frame of an image to be analyzed and each frame of an HSV image in one embodiment;
[0058] Figure 7 Schematic diagram of the structure of a water leakage detection device based on color change in one embodiment;
[0059] Figure 8FIG. 1 is a schematic structural diagram of an electronic device in an embodiment.
[0060] Explanation of the accompanying figures: 100, water-immersion color-changing device; 110, water-immersion color-changing test paper; 101, front panel 101; 102, back panel; 103, bottom; 104, top; 105, side; 106, water inlet; 107, positioning mark; 200, pipeline; 210, water leakage detection point. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0062] All terms (including technical and scientific terms) used in this application have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0063] For example, the terms "first," "second," etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element.
[0064] For example, the terms "include", "comprising", etc. used in this application indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0065] This application provides a water leakage detection method based on color change, such as Figure 1 As shown, the method includes:
[0066] Step 310: Acquire multiple frames of original images of multiple water-immersion color-changing devices.
[0067] In this embodiment, each water-immersion color-changing device is arranged in a different placement corresponding to the current environment. Each water-immersion color-changing device includes a closed box body formed of a transparent material, and a water-immersion color-changing test paper in the box body. A water inlet hole is opened on one side of the box body. Each frame of the original image reflects the RGB color characteristics of the corresponding water-immersion color-changing device at a corresponding moment.
[0068] Combine Figure 2 and Figure 3As shown, the water-discoloration device 100 includes water-discoloration test paper 110 and a transparent material box that partially encloses the water-discoloration test paper. The box can be made of acrylic. The water-discoloration test paper can be a dedicated chemical reagent paper that undergoes a significant color change upon contact with water, serving as a visual signal for leak detection.
[0069] Based on the color change, it can be known whether the water-immersion color-changing device is immersed in water, and it can be determined whether a water leak occurs at the corresponding position of the water-immersion color-changing device. The box body may include a front panel 101, a back panel 102, a bottom 103 and a side 105 connected between the front panel 101 and the back panel 102. The front panel 101, the back panel 102, the bottom 103 and the side 105 can all be integrally formed of a transparent acrylic material. The top is provided with an opening, and a space is formed inside to accommodate the water-immersion color-changing test paper 110, so that the water-immersion color-changing test paper 110 can be placed from the top into the accommodating space. The top 104 can be sealed with a silicone sealing strip, and a water inlet hole 106 is provided on the back panel 102 of the water-immersion color-changing device 100. In this way, water can only enter the water-immersion color-changing test paper 110 of the water-immersion color-changing device through the water inlet hole 106.
[0070] The water-immersion color-changing test paper 110 can be affixed to the front panel 101 in the accommodating space. Furthermore, one or more positioning marks 107 are provided on the front panel 101 for positioning the water-immersion color-changing test paper 110 therein. The positioning mark 107 has a specific shape and / or color, so that the positioning mark 107 can be accurately identified from the image. For example, the positioning mark 107 can be circular, rectangular, etc., and the shape of the space surrounded by the multiple positioning marks 107 matches the size of the water-immersion color-changing test paper. The positioning mark 107 can be at the edge of the water-immersion color-changing test paper 110. Through the positioning mark 107, the specific position of the water-immersion color-changing test paper in the accommodating space can be identified.
[0071] Combine Figure 4 and Figure 5 As shown, in the current environment being tested, there are one or more water leakage detection points 210. These water leakage detection points 210 can be the connection points of pipes 200, the water outlet points of faucets, or the outer walls of specific water storage tanks. At each detection point, one or more water immersion color-changing devices 100 can be deployed, and one or more water immersion color-changing devices 100 can be used to jointly detect water leakage at each water leakage detection point 210. The current environment can specifically be a pump room with pipelines in a steel production process, or other spatial environment requiring water leakage detection.
[0072] Alternatively, using pipe 200 as an example, if a leak actually occurs at the connection point between the two pipes (leak detection point 210), and the leak is relatively minor, the leaked water will generally flow in a specific direction due to gravity or the pipe's texture. For example, if pipe 200 is arranged horizontally, the leaked water will fall directly downward, while if it is arranged vertically, the leaked water will flow downward along the pipe wall.
[0073] Based on this, for the multiple water-immersing color-changing devices arranged around the water leakage detection point 210, some of the water-immersing color-changing devices 100 are located at the position where the leaked water flows under normal flow. For the water-immersing color-changing devices at this position, they are used as the main water-immersing color-changing devices; and some of the water-immersing color-changing devices 100 are located at the position where the leaked water will not flow under normal flow. For the water-immersing color-changing devices at this position, they are used as auxiliary water-immersing color-changing devices.
[0074] That is to say, the main water-immersion color-changing device refers to a detection device that is arranged on the priority flow path of the water leakage detection point and is most likely to be the first to contact and respond to the water leakage signal in the case of a slight leakage. Its position is directly located on the natural flow path of the liquid under the guidance of gravity, surface tension or pipeline structure. The auxiliary water-immersion color-changing device refers to a detection device that is arranged on the non-priority flow path of the water leakage detection point and will not contact the water flow in the case of normal slight leakage, and may only respond in the case of severe leakage or abnormal flow. It is located outside the natural flow path of the liquid. The water inlet of each water-immersion color-changing device is oriented towards the flow path of the leaked water, so that the leaked water can enter from the water inlet and stick to the water-immersion color-changing test paper 110 therein.
[0075] Optionally, one or more cameras are arranged in the current environment as image acquisition devices and installed in the area where water leaks need to be detected. The cameras can be specifically high-definition cameras, each of which can capture one or more corresponding water-discoloring devices. Each camera can capture original images containing water-discoloring devices at a preset frequency. The color characteristics of the water-discoloring test paper 110 in the corresponding water-discoloring device can be extracted from each original image. The shooting frequency can be any suitable shooting frequency set, such as once every 30 seconds, once every 1 minute, once every 10 minutes, once every 30 minutes, or once every hour.
[0076] Step 320: extract the ROI region for water leakage analysis from each frame of the original image to form a corresponding image to be analyzed.
[0077] In this embodiment, the ROI region represents the area corresponding to the water-discoloring test paper. The electronic device, combining the shape and original color of the water-discoloring test paper, the overall shape of the water-discoloring device, and the position of the test paper within the device, can identify the water-discoloring device and the water-discoloring test paper within the device from the original image. The electronic device then uses the position of the water-discoloring test paper in the original image as the ROI region (i.e., region of interest), performs corresponding preprocessing on the original image, and uses the preprocessed ROI region as the image to be analyzed.
[0078] Specifically, the ROI region can be identified by combining the positioning markers on the water-discoloration device. The preprocessing process can include geometric correction, noise suppression, illumination normalization, and feature enhancement of the ROI region in the original image, resulting in a standardized image with consistent image size across each frame of the image to be analyzed. Within each frame of the image to be analyzed, pixels at the same position represent the same position on the water-discoloration test paper.
[0079] Step 330: Convert each frame of the image to be analyzed into a corresponding HSV image.
[0080] In this embodiment, the original image and the image to be analyzed are both RGB images. Based on the conversion formula between RGB images and HSV images, the image to be analyzed can be converted into a corresponding HSV image.
[0081] Among them, in the HSV image, hue (H) indicates the type of color (such as red, blue), and the value range is usually 0° to 360°; saturation (S) indicates the purity of the color, and the value range is 0% (gray) to 100% (pure color); value (V): indicates the brightness of the color, and the value range is 0% (black) to 100% (white).
[0082] Step 340 : Analyze the comprehensive water immersion degree of the corresponding water-immersion color-changing device based on each frame of the image to be analyzed and each frame of the HSV image.
[0083] In this embodiment, the comprehensive water immersion degree reflects the degree of water immersion of the corresponding water-changing device. Since the placement positions of the water-changing devices in the current environment are the same, the comprehensive water immersion degrees of the water-changing devices are also different.
[0084] In one embodiment, the comprehensive water immersion degree can be a specific numerical value or a specific vector. When it is a specific numerical value, it represents the overall water immersion degree reflected by the water immersion color changing device. The larger the numerical value, the higher the water immersion degree.
[0085] When the comprehensive water immersion degree is a specific vector, the number of elements in the vector can be the number of pixels in the HSV image + 1, and the first element / last element corresponds to the overall water immersion degree reflected by the water immersion color-changing device, which can be expressed as the overall water immersion degree value; the remaining elements represent the water immersion degree reflected by one of the pixels in the HSV image, that is, the water immersion degree reflected by a certain point on the water immersion color-changing test paper corresponding to the pixel, and each remaining element can represent the corresponding pixel point water immersion value.
[0086] In complex lighting environments like steel workshops, the r, g, and b values of an RGB image may fluctuate synchronously due to changes in light intensity (e.g., appearing brighter or darker overall). However, the hue (H) and saturation (S) in the HSV space are less affected by lighting. By analyzing the hue and / or saturation of each pixel in an HSV image, the degree of water immersion reflected in the corresponding HSV image can be determined. By comprehensively analyzing multiple HSV images, the overall water immersion level of each water-discoloring device can be determined.
[0087] For example, when a large area of pixels with a saturation value greater than 50° is detected in a certain HSV image, it means that the corresponding water-changing test paper has a large area of water immersion and its color changes to red, which indicates that there is a high suspicion of water immersion.
[0088] Step 350 , based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device, determine whether there is water leakage in the current environment through spatial correlation analysis.
[0089] In this embodiment, after obtaining the comprehensive water immersion degree of each water-immersion color-changing device, it can be combined with the placement position of the corresponding water-immersion color-changing device. By using the comprehensive water immersion degree of the water-immersion color-changing device at the leakage detection point and different leakage detection points, it can be determined whether there is a leakage at the corresponding leakage detection point.
[0090] For example, when at a certain water leakage detection point, the comprehensive water immersion values of its multiple main water immersion color-changing devices are all large, showing that the water immersion color-changing device has been flooded, while the comprehensive water immersion value of its auxiliary water immersion color-changing device is small, indicating that it has not been flooded, then it can be judged that the water leakage detection point is flooded; on the contrary, when at the water leakage detection point, only one auxiliary water immersion color-changing device presents a relatively large comprehensive water immersion value, while the comprehensive water immersion value of other water immersion color-changing devices is small, then it means that there is no leakage at the corresponding water leakage detection point, but the auxiliary water immersion color-changing device with a larger comprehensive water immersion value may be abnormal.
[0091] The color change-based water leak detection method disclosed in this application utilizes the color changes of water-discoloring devices to detect water immersion at water leak detection points. Specifically, by converting their RGB color features into HSV color features and separating color information (H and S) from brightness information (V), the interference of illumination changes on color recognition is reduced. This allows for more accurate identification of the color changes of each water-discoloring device, thereby accurately determining the water immersion degree of each device. Combined with the water immersion degree of each device, a comprehensive assessment of whether a water leak exists in the current environment is possible, preventing deviations in leak detection at the leak detection point due to anomalies in a single water-discoloring device and improving the accuracy of water leak detection. Furthermore, by utilizing HSV color features, minor water leaks can be more accurately identified, allowing relevant personnel to promptly address them and avoid more serious leaks, thus meeting the requirements of safe production and efficient operation and maintenance.
[0092] Furthermore, once a leak is detected, a pre-set alarm unit triggers an audible and visual alarm, while a display unit displays the leak location and related information on the monitoring screen. This information includes the leak time, a screenshot of the leaking area, and numerical information related to color changes, allowing personnel to understand the specific leak location and severity.
[0093] In one embodiment, Figure 6 As shown, step 340 includes:
[0094] Step 610 : Identify a first water immersion degree of the corresponding water-immersion color-changing device according to the color features of the HSV image.
[0095] In this embodiment, the first water immersion degree represents the water immersion degree of the water-discoloring device identified based on a single HSV image; the second water immersion degree described below represents the water immersion degree of the water-discoloring device identified based on the first HSV difference image. Similar to the comprehensive water immersion degree, the first and second water immersion degrees can be either individual values or vectors. When all three are vectors, their lengths are the same.
[0096] Based on the characteristic of the water-changing test paper that changes color when exposed to water, the HSV color characteristics of each pixel in the HSV image can reflect the water exposure condition of the corresponding position of the water-changing test paper. Therefore, based on the HSV image of each pixel, the value of the element in the corresponding vector in the corresponding first water immersion degree can be calculated.
[0097] Optionally, the electronic device pre-sets a water immersion calculation model. Based on the hue and / or saturation of each pixel in the HSV image, the water immersion value of the corresponding pixel can be obtained through the water immersion calculation model. Based on the water immersion value of each pixel, the overall water immersion value can be obtained, thereby forming a corresponding first water immersion value. Specifically, the overall water immersion value can be a weighted sum of the water immersion values of each pixel. The weights corresponding to the water immersion values of each pixel are not necessarily the same. Among them, the weights of the pixels corresponding to the water-immersed color-changing test paper positions that are easily stained by water are larger, while the weights of the pixels corresponding to the water-immersed color-changing test paper positions that are not easily stained by water are smaller.
[0098] Specifically, a corresponding first color change threshold is determined according to the placement position of the water-immersion color-changing device corresponding to the HSV image and the environmental parameters of the current environment; and a first water immersion degree of the corresponding water-immersion color-changing device is determined based on the first color change threshold and the HSV image.
[0099] Environmental parameters include one or more parameters such as ambient light, temperature, and humidity. The placement of the water-discoloring device includes its orientation, height, positional relationship with the corresponding camera, positional relationship with the light source, and orientation of the water inlet, all of which significantly affect the RGB pixel values in the captured original image and the HSV pixel values in the processed image.
[0100] In the current environment, by setting environmental parameter sensors such as light sensors, temperature sensors, and humidity sensors, the parameter values in the environment can be collected in real time. Combined with the placement position, the first color change threshold can be calculated accordingly.
[0101] The first color change threshold is a static color threshold used to determine whether the device has experienced a color change due to factors such as water immersion or moisture, based on the color characteristics of a single-frame HSV image, combined with the spatial location of the water-discoloring device and real-time environmental parameters. This threshold includes thresholds for one or more of the three components: hue (H), saturation (S), and value (V). It is understood that the color change thresholds of the HSV image obtained under different environmental parameters and at different shooting angles may not be the same. Optionally, the electronic device pre-sets a correspondence between the first color change threshold and various environmental parameters and placement positions. Based on this correspondence, the first color change threshold can be quickly determined.
[0102] After obtaining the first color change threshold, the pixel value of each pixel in the HSV image can be subtracted from the first color change threshold, and the water immersion degree of the pixel corresponding to the pixel with a difference value less than or equal to 0 is set to 0. For the pixel with a difference value greater than 0, the corresponding water immersion degree is given according to the mapping relationship between the corresponding difference value and the water immersion degree. It can be understood that a difference value less than or equal to 0 indicates that the corresponding pixel position has not undergone a significant color change, indicating that it has not been exposed to water or moisture, while a difference value greater than 0 indicates that the corresponding pixel position may be exposed to water. The larger the difference value, the more obvious the water immersion.
[0103] In one embodiment, a theoretical water immersion area in the HSV image is determined based on the position of the water inlet hole of the water immersion color-changing device corresponding to the HSV image and the corresponding water leakage detection point; a first weight of each pixel point in the HSV image is determined based on the theoretical water immersion area; and a first water immersion degree is determined based on the color characteristics of each pixel point in the HSV image and the corresponding first weight.
[0104] In this embodiment, the theoretical water immersion area refers to the area expected to be initially covered by water upon contact with the device, based on the physical structure of the water-discoloring device, the location of the water inlet, and the physical laws of water flow. This area serves as a spatial reference for determining actual water leakage and is used to distinguish effective water immersion characteristics from environmental interference (such as dust, condensation, etc.). Optionally, the theoretical water immersion area is related to the location, orientation, and water flow path of the water inlet. Based on this positional relationship, the theoretical water immersion area can be determined. For example, the area covered by the water inlet is generally classified as the theoretical water immersion area. The farther away from the water inlet, the lower the probability of being classified as the theoretical water immersion area.
[0105] The first weight of pixels within the theoretical water immersion area is higher than the first weight of pixels outside the theoretical water immersion area, and the farther the pixel is from the theoretical water immersion area, the smaller the corresponding first weight. Optionally, a fixed, higher first weight is set for pixels within the theoretical water immersion area, and a corresponding attenuation coefficient is set for pixels outside the theoretical water immersion area based on their distance from the theoretical water immersion area. The first weight is set using any suitable mathematical model, such as a Gaussian kernel function, so that the farther the distance, the smaller the first weight.
[0106] After obtaining the first weight corresponding to each pixel, a first water immersion degree is determined based on the first weight and the pixel value (color feature). For example, the first water immersion degree of the corresponding water immersion color change device is determined based on the first weight, the first color change threshold, and the HSV image.
[0107] Specifically, the pixel value of each pixel in the HSV image can be subtracted from the first color change threshold, and the water immersion of the pixel corresponding to the pixel with a difference value less than or equal to 0 is set to 0. For pixels with a difference value greater than 0, the corresponding difference is multiplied by the corresponding first weight, and the resulting value is used as the corresponding pixel water immersion value. After obtaining the water immersion value of each pixel, the overall water immersion value in the first water immersion value can be calculated.
[0108] Step 620 : Subtract the subsequent frame image from the previous frame image to obtain a first RGB difference image.
[0109] In this embodiment, the rear frame image is the image to be analyzed corresponding to the HSV image, and the front frame image is the image to be analyzed formed by the original image taken at the previous moment for the same water immersion color change device relative to the rear frame image.
[0110] For two adjacent frames of images to be analyzed of the same water-immersion color-changing device, pixel-by-pixel subtraction can be performed point by point to obtain a difference image (first RGB difference image) between the two frames of images to be analyzed.
[0111] Step 630 : Convert the first RGB difference image into a first HSV difference image, and analyze the second water immersion degree of the corresponding water-immersion color-changing device based on the color characteristics of the first HSV difference image.
[0112] After obtaining the first RGB difference image, it can be converted into a corresponding first HSV difference image, and the second water immersion degree can be calculated based on the color features in the first HSV difference image.
[0113] Similarly, the first RGB difference image and the first HSV difference image reflect the color change of the water-discoloring device between the two shots. Using a similar calculation method as the first water immersion degree, the HSV pixel values of each pixel in the first HSV difference image are used to determine the corresponding pixel water immersion degree value. A weighted summation of the pixel water immersion degree values is then performed to determine the corresponding overall water immersion degree value, thereby forming the second water immersion degree.
[0114] By performing a subtraction on the two frames of images, interference in the environment can be further suppressed, so that the first RGB difference image and the first HSV difference image can more accurately reflect the water immersion situation.
[0115] In one embodiment, the second water immersion degree of the corresponding water immersion color-changing device is analyzed based on the color characteristics of the first HSV difference image, including: determining the corresponding second color change threshold according to the placement position of the water immersion color-changing device corresponding to the first HSV difference image and the environmental parameters of the current environment; and determining the second water immersion degree of the corresponding water immersion color-changing device based on the second color change threshold and the first HSV difference image.
[0116] In this embodiment, the second color change threshold is a dynamic threshold used to determine whether a device's color change is caused by a true water leak or moisture condition, based on the HSV difference between two adjacent image frames, combined with the device's spatial location, time series characteristics, and historical operating data. This threshold includes thresholds for one or more of the three components: hue (H), saturation (S), and value (V). The first and second color change thresholds are different.
[0117] Similarly, after obtaining the second color change threshold, the pixel value of each pixel in the first HSV difference image can be subtracted from the second color change threshold. The water immersion degree of each pixel with a difference value less than or equal to 0 is set to 0. For pixels with a difference value greater than 0, the corresponding water immersion degree is determined according to the mapping relationship between the corresponding difference value and the water immersion degree, forming the second water immersion degree.
[0118] In one embodiment, a second weight of each pixel in the first HSV difference image is determined based on the theoretical water immersion area; and a second water immersion degree is determined based on the color feature of each pixel in the first HSV difference image and the corresponding second weight.
[0119] In this embodiment, the theoretical water immersion area also applies to the first HSV difference image. The second weight at the same pixel position can be the same as or different from the first weight. For pixels within the theoretical water immersion area, a fixed, higher second weight is set. For pixels outside the theoretical water immersion area, a corresponding second weight is set based on their distance from the theoretical water immersion area, such that the farther the distance, the smaller the second weight.
[0120] After obtaining the second weight corresponding to each pixel, a second water immersion degree is determined based on the second weight and the pixel value (color feature). For example, the second water immersion degree of the corresponding water immersion color changing device is determined based on the second weight, the second color change threshold, and the first HSV difference image.
[0121] Specifically, the pixel value of each pixel in the first HSV difference image can be subtracted from the second color change threshold, and the water immersion of the pixel corresponding to the pixel with a difference value less than or equal to 0 is set to 0. For pixels with a difference value greater than 0, the corresponding difference is multiplied by the corresponding second weight, and the resulting value is used as the corresponding pixel water immersion value. After obtaining the water immersion value of each pixel, the overall water immersion value in the second water immersion value can be calculated.
[0122] Step 640 : Calculate the comprehensive water immersion degree of the corresponding water immersion color changing device based on the first water immersion degree and the second water immersion degree.
[0123] In this embodiment, the electronic device may be configured with a corresponding weighted fusion formula to obtain a comprehensive water immersion degree by performing a weighted summation of the first water immersion degree and the second water immersion degree, wherein the weights corresponding to the first water immersion degree and the second water immersion degree may be calculated based on relevant experience.
[0124] In one embodiment, before step 640, it also includes: subtracting the post-frame image from the corresponding reference frame image to obtain a second RGB difference image, and converting the second RGB difference image into a second HSV difference image, the reference frame image is an image to be analyzed formed by the original image taken at the same time for the reference water-immersion color-changing device relative to the post-frame image, and the reference water-immersion color-changing device and the water-immersion color-changing device corresponding to the post-frame image belong to the same water leakage detection point; based on the color characteristics of the second HSV difference image, the third water immersion degree of the corresponding water-immersion color-changing device is analyzed.
[0125] Specifically, the water immersion color-changing device corresponding to the rear frame image and the water immersion color-changing device corresponding to the reference frame image are water immersion color-changing devices arranged at the same water leakage detection point, but the two are not the same water immersion color-changing device. Specifically, the water immersion color-changing device corresponding to the rear frame image can be the above-mentioned main water immersion color-changing device, and the water immersion color-changing device corresponding to the reference frame image (reference water immersion color-changing device) can be the above-mentioned auxiliary water immersion color-changing device.
[0126] Since the subsequent and reference frames were captured using the water-discoloration device at different locations, the subtraction process requires aligning the pixels so that each pixel in the same position represents the same location on the water-discoloration test paper. The resulting image after subtraction is the second RGB difference image.
[0127] After the second RGB difference image is obtained, it can be converted into a corresponding second HSV difference image, and the third water immersion degree is calculated based on the color features in the second HSV difference image.
[0128] Similarly, the second RGB difference image and the second HSV difference image reflect the color changes of different water-discoloring devices at the same moment. Using a similar calculation method as the second water immersion degree, the HSV pixel values of each pixel in the second HSV difference image can be used to determine the corresponding pixel water immersion degree value. A weighted summation of the pixel water immersion degree values is then performed to determine the corresponding overall water immersion degree value, thereby forming the third water immersion degree.
[0129] By subtracting the images corresponding to different water-immersion color-changing devices, not only can the interference in the environment be suppressed, but the first RGB difference image and the first HSV difference image can also more accurately reflect the difference between the images of the two water-immersion color-changing devices. Based on the difference between the images, the water immersion situation can be analyzed.
[0130] In one embodiment, the third water immersion degree is calculated based on the color features in the second HSV difference image, including: determining the corresponding third color change threshold according to the placement position of the water immersion color change device corresponding to the second HSV difference image and the environmental parameters of the current environment; determining the third water immersion degree of the corresponding water immersion color change device based on the third color change threshold and the second HSV difference image.
[0131] The third color change threshold is the HSV difference feature of images corresponding to different water-discoloring devices. Combined with the device's spatial location, time series characteristics, and historical operating data, it serves as a reference threshold for determining whether the device's color change is caused by actual water leakage or moisture. This threshold includes thresholds for one or more of the three components: hue (H), saturation (S), and value (V). The first, second, and third color change thresholds are different.
[0132] Similarly, after obtaining the third color change threshold, the pixel value of each pixel in the second HSV difference image can be subtracted from the third color change threshold. The water immersion degree of each pixel with a difference value less than or equal to 0 is set to 0. For pixels with a difference value greater than 0, the corresponding water immersion degree is determined according to the mapping relationship between the corresponding difference value and the water immersion degree, forming the third water immersion degree.
[0133] In one embodiment, a third weight of each pixel in the second HSV difference image is determined based on the theoretical immersion area; and a third immersion degree is determined based on the color feature of each pixel in the second HSV difference image and the corresponding third weight.
[0134] In this embodiment, the theoretical water immersion area also applies to the second HSV difference image. Similarly, a fixed, higher third weight is set for pixels in the second HSV difference image within the theoretical water immersion area. For pixels outside the theoretical water immersion area, a corresponding third weight is set based on their distance from the theoretical water immersion area, such that the farther the distance, the smaller the third weight.
[0135] After obtaining the third weight corresponding to each pixel, a third water immersion degree is determined based on the third weight and the pixel value (color feature). For example, the third water immersion degree of the corresponding water immersion color-changing device is determined based on the third weight, the third color change threshold, and the second HSV difference image. This third water immersion degree is the third water immersion degree of the corresponding primary water immersion color-changing device.
[0136] Specifically, the pixel value of each pixel in the second HSV difference can be subtracted from the third color change threshold, and the water immersion of the pixel corresponding to the pixel with a difference value less than or equal to 0 is set to 0. For pixels with a difference value greater than 0, the corresponding difference is multiplied by the corresponding third weight, and the resulting value is used as the corresponding pixel water immersion value. After obtaining the water immersion value of each pixel, the overall water immersion value in the third water immersion value can be calculated.
[0137] In one embodiment, step 640 includes determining a comprehensive water immersion degree of the water-changing device based on the first water immersion degree, the second water immersion degree, and the third water immersion degree.
[0138] In this embodiment, the comprehensive water infiltration index further incorporates a third water infiltration index, creating a multi-dimensional quantitative indicator of water leakage severity that combines the spatial dimension (first water infiltration index), the temporal dimension (second water infiltration index), and the reference dimension (third water infiltration index). Optionally, weights can be assigned to each water infiltration index dimension, and the weighted sum of the three dimensions can be used to generate the comprehensive water infiltration index. Specifically, the weighted sum of the first, second, and third water infiltration indexes is used to generate the comprehensive water infiltration index. The weights for each water infiltration index can be pre-set, appropriate values.
[0139] This embodiment introduces a reference device comparison mechanism to construct a three-dimensional detection framework: spatial, temporal, and reference. In the spatial dimension, a first water level is determined by using HSV images of the same device. In the temporal dimension, a second water level is determined by analyzing the first HSV difference images of adjacent frames. In the reference dimension, a second HSV difference image is generated by comparing images with a reference device at the same location, and a third water level is determined based on this second HSV difference image. By integrating these three factors into a comprehensive water level, the reliability and accuracy of detection are significantly improved, enabling the accurate and timely identification of even minor water leaks.
[0140] In one embodiment, step 350 includes: when the comprehensive water immersion degree of multiple main water immersion color-changing devices exceeds the preset first water immersion degree threshold T1, it is determined that there is water leakage in the current environment; when the comprehensive water immersion degree of no main water immersion color-changing device exceeds the preset second water immersion degree threshold T2, and the comprehensive water immersion degree of the auxiliary water immersion color-changing devices exceeds the preset third water immersion degree T3, and exceeds the comprehensive water immersion degree of one of the main water immersion color-changing devices, it is determined that there is no water leakage in the current environment, and it is determined that there is an abnormality in the auxiliary water immersion color-changing device; when the comprehensive water immersion degree of no main water immersion color-changing device exceeds the first water immersion degree threshold T1, and the comprehensive water immersion degree of at least one auxiliary water immersion color-changing device and the comprehensive water immersion degree of at least one main water immersion color-changing device both exceed the third water immersion degree threshold T3, it is determined that the current environment is humid, wherein T3≤T2≤T1.
[0141] In this embodiment, the first water level threshold T1, the second water level threshold T2, and the third water level threshold T3 are thresholds set relative to the overall water level. When the overall water level is represented by a vector, it has the same vector length as the first, second, and third water levels. One element of the vector represents the overall water level (overall water level value), and the remaining elements represent the water level reflected by a pixel (pixel water level value).
[0142] By comparing the overall water level value in the comprehensive water level with the first water level threshold, the second water level threshold, and the third water level threshold, it is identified whether the comprehensive water level exceeds the preset water level threshold.
[0143] In this embodiment, the second water immersion threshold T2 is less than the first water immersion threshold T1 and greater than the third water immersion threshold T3. The first water immersion threshold T1 represents the critical value at which the corresponding water immersion color-changing device is significantly wet; the second water immersion threshold T2 represents the safety threshold corresponding to the water immersion color-changing device absorbing moisture from the surrounding environment due to humidity; and the third water immersion threshold T3 represents the upper limit of normal fluctuations caused by relevant interference when the water immersion color-changing device is not damp or wet.
[0144] If the integrated water level of a primary water immersion detection device exceeds T1, it indicates that the primary water immersion detection device has leaked and changed color. By deploying multiple primary water immersion detection devices at a single leak detection point, if multiple primary water immersion detection devices have integrated water levels exceeding T1, the leak detection point is directly determined to have a leak and an alarm is generated. If only one primary water immersion detection device has integrated water levels exceeding T1, but other primary water immersion detection devices have integrated water levels exceeding T2, the leak detection point can still be determined to have a leak. If only one primary water immersion detection device has integrated water levels exceeding T1, and the integrated water levels of the other primary water immersion detection devices do not exceed T2, it indicates that the primary water immersion detection device that has integrated water levels exceeding T2 has an abnormality.
[0145] When it is detected that the comprehensive water immersion degree of no main water immersion color-changing device exceeds T1, but the comprehensive water immersion degree of the auxiliary water immersion color-changing device exceeds the comprehensive water immersion degree of one or more main water immersion color-changing devices, if the comprehensive water immersion degree of the auxiliary water immersion color-changing device further exceeds T3, it means that there is an abnormality in the auxiliary water immersion color-changing device, but there is no water leakage at the leakage detection point in the current environment.
[0146] When there is no comprehensive water immersion degree exceeding T1, but the comprehensive water immersion degree of at least one auxiliary water immersion color-changing device and the comprehensive water immersion degree of at least one main water immersion color-changing device both exceed the second water immersion degree threshold T2, it means that the current environment is humid and the water immersion color-changing test papers of multiple water immersion color-changing devices are affected by moisture. At this time, the corresponding staff can be reminded to replace the water immersion color-changing devices and ventilate the current environment.
[0147] In one embodiment, step 350 includes: performing trend analysis on the comprehensive water immersion degree of each water-immersion color-changing device at each moment, and determining whether there is water leakage in the current environment based on the trend analysis results of each water-immersion color-changing device.
[0148] In this embodiment, for situations that do not fall into the above three categories, trend analysis can be performed on the primary water-discoloring device to identify any leakage trends. For example, if the comprehensive water immersion level of a primary water-discoloring device exceeds T2 but is less than T1, this indicates that the device may be slightly leaking. Trend analysis can then be performed on the comprehensive water immersion level of each primary water-discoloring device collected at multiple time points.
[0149] Optionally, for the main water-immersion color-changing device to be analyzed, the comprehensive water immersion degree of the main water-immersion color-changing device at each moment within a preset time period can be sorted according to the generation time to form a water immersion degree sequence. The preset time period can be, for example, 30 minutes, 1 hour, 2 hours, 12 hours, or any other suitable time period.
[0150] For the constructed water level sequence, the system identifies whether the overall water level value under the corresponding comprehensive water level is on an upward trend and calculates the corresponding rising speed. When the rising speed exceeds a preset rising speed threshold and the corresponding water level values of the pixels within the theoretical water level area are also on an overall upward trend, the main water level discoloration device is determined to indicate a water leakage risk at the corresponding leak detection point. When multiple main water level discoloration devices indicate a water leakage risk at the corresponding leak detection point, the leak detection point is determined to be leaking and an alarm is generated, prompting relevant personnel to take timely action. When the overall trend is upward, but the rising speed is lower than the preset rising speed threshold, specifically manifested as the water level values of the pixels within the theoretical water level area remain unchanged or rise slowly, while the water level values of the pixels outside the theoretical water level area rise at an accelerated rate, this indicates that there is no water leakage in the current environment, but there is an abnormality in the water level discoloration device, prompting relevant personnel to conduct an inspection.
[0151] If only the comprehensive water immersion degree of a single main water immersion color-changing device undergoes a sudden change at a certain moment, and its overall trend and other main water immersion color-changing devices do not show an upward trend, it can be determined as human interference and there is no need to trigger an alarm.
[0152] In this embodiment, the accuracy of water leakage identification can be further improved by performing trend analysis.
[0153] In one embodiment, Figure 7 As shown, a water leakage detection device based on color change is provided, which includes:
[0154] Image acquisition module 710 is used to obtain multiple frames of original images of multiple water-immersion color-changing devices. Each water-immersion color-changing device is arranged in a corresponding position in the current environment. Each water-immersion color-changing device includes a closed box body formed of a transparent material and a water-immersion color-changing test paper in the box body. A water inlet hole is opened on one side of the box body. Each frame of the original image reflects the RGB color characteristics of the corresponding water-immersion color-changing device at a corresponding moment.
[0155] The image processing module 720 is used to extract the ROI area for water leakage analysis from each frame of the original image to form a corresponding image to be analyzed. The ROI area represents the area corresponding to the water-immersed color-changing test paper; and convert each frame of the image to be analyzed into a corresponding HSV image.
[0156] The water immersion degree calculation module 730 is used to analyze the comprehensive water immersion degree of the corresponding water immersion color changing device based on each frame of the image to be analyzed and each frame of the HSV image.
[0157] The water leakage judgment module 740 is used to judge whether there is water leakage in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device.
[0158] In one embodiment, the water immersion degree calculation module 730 is also used to identify the first water immersion degree of the corresponding water immersion color-changing device based on the color characteristics of the HSV image; subtract the rear frame image from the front frame image to obtain a first RGB difference image, the rear frame image is the image to be analyzed corresponding to the HSV image, and the front frame image is the image to be analyzed formed by the original image taken at the previous moment for the same water immersion color-changing device relative to the rear frame image; convert the first RGB difference image into a first HSV difference image, and analyze the second water immersion degree of the corresponding water immersion color-changing device based on the color characteristics of the first HSV difference image; and calculate the comprehensive water immersion degree of the corresponding water immersion color-changing device based on the first water immersion degree and the second water immersion degree.
[0159] In one embodiment, the water immersion degree calculation module 730 is also used to subtract the post-frame image from the corresponding reference frame image to obtain a second RGB difference image, and convert the second RGB difference image into a second HSV difference image. The reference frame image is an image to be analyzed formed by the original image taken at the same time for the reference water immersion color-changing device relative to the post-frame image. The reference water immersion color-changing device and the water immersion color-changing device corresponding to the post-frame image belong to the same water leakage detection point; the third water immersion degree of the corresponding water immersion color-changing device is analyzed based on the color characteristics of the second HSV difference image; and the comprehensive water immersion degree of the water immersion color-changing device is determined based on the first water immersion degree, the second water immersion degree and the third water immersion degree.
[0160] In one embodiment, the water immersion degree calculation module 730 is also used to determine the corresponding first color change threshold based on the placement position of the water immersion color change device corresponding to the HSV image and the environmental parameters of the current environment; and determine the first water immersion degree of the corresponding water immersion color change device based on the first color change threshold and the HSV image.
[0161] In one embodiment, the water immersion degree calculation module 730 is also used to determine the corresponding second color change threshold based on the placement position of the water immersion color change device corresponding to the first HSV difference image and the environmental parameters of the current environment; and determine the second water immersion degree of the corresponding water immersion color change device based on the second color change threshold and the first HSV difference image.
[0162] In one embodiment, the water immersion degree calculation module 730 is also used to determine the theoretical water immersion area in the HSV image based on the position of the water inlet hole of the water immersion color-changing device corresponding to the HSV image and the corresponding water leakage detection point; determine the first weight of each pixel point in the HSV image based on the theoretical water immersion area; determine the first water immersion degree based on the color characteristics of each pixel point in the HSV image and the corresponding first weight.
[0163] In one embodiment, the water immersion calculation module 730 is further used to determine the second weight of each pixel in the first HSV difference image based on the theoretical water immersion area; and determine the second water immersion based on the color characteristics of each pixel in the HSV image and the corresponding second weight.
[0164] In one embodiment, the water-immersion color-changing device includes a main water-immersion color-changing device and an auxiliary water-immersion color-changing device. The water leakage judgment module 740 is further configured to determine that there is a water leak in the current environment when the combined water immersion degree of multiple main water-immersion color-changing devices exceeds a preset first water immersion degree threshold T1; determine that there is no water leak in the current environment and that an abnormality exists in the auxiliary water-immersion color-changing device when the combined water immersion degree of no main water-immersion color-changing device exceeds a preset second water immersion degree threshold T2, and the combined water immersion degree of the auxiliary water-immersion color-changing device exceeds a preset third water immersion degree T3 and exceeds the combined water immersion degree of one of the main water-immersion color-changing devices; and determine that the current environment is humid when the combined water immersion degree of no main water-immersion color-changing device exceeds the first water immersion degree threshold T1, and the combined water immersion degree of at least one auxiliary water-immersion color-changing device and the combined water immersion degree of at least one main water-immersion color-changing device both exceed a second water immersion degree threshold T2, wherein T2 ≤ T1.
[0165] In one embodiment, the water leakage judgment module 740 is further configured to perform trend analysis on the comprehensive water immersion degree of each water-immersion color-changing device at each moment, and determine whether there is water leakage in the current environment based on the trend analysis results of each water-immersion color-changing device.
[0166] In one embodiment, a computer-readable storage medium is provided, on which executable instructions are stored. When the instructions are executed by a processor, the processor executes the steps in the above-mentioned method embodiments.
[0167] In one embodiment, an electronic device is also provided, comprising one or more processors; a memory, wherein one or more programs are stored in the memory, wherein when the one or more programs are executed by one or more processors, the one or more processors execute the steps in the above-mentioned method embodiments.
[0168] In one embodiment, Figure 8 , which shows a schematic diagram of the structure of an electronic device for implementing an embodiment of the present application. Electronic device 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 802 or programs loaded from a storage unit 808 into a random access memory (RAM) 803. RAM 803 also stores various programs and data required for the operation of electronic device 800. CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to bus 804.
[0169] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, mouse, and the like; an output section 807 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and speakers; a storage section 808 including a hard disk; and a communication section 809 including a network interface card such as a LAN card or a modem. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. Removable media 811, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 810 as needed, so that computer programs read from the removable media can be installed in the storage section 808 as needed.
[0170] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer-readable medium carrying instructions. In such embodiments, the instructions can be downloaded and installed from a network via the communication portion 809 and / or installed from removable media 811. When the instructions are executed by the central processing unit (CPU) 801, the various method steps described in this application are performed.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
[0172] Furthermore, those skilled in the art will appreciate that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of this application and to form different embodiments. For example, all of the above embodiments may be used in any combination. The information disclosed in this background section is intended solely to enhance understanding of the overall background of this application and should not be construed as an admission or any form of implication that such information constitutes prior art known to those skilled in the art.
Claims
1. A water leakage detection method based on color change, characterized in that: The method comprises: Acquire multiple frames of raw images of multiple captured water-chromic devices, each of which is arranged at a different position in the current environment. Each water-chromic device includes a closed box formed of a transparent material and a water-chromic test paper within the box. A water inlet is defined on one side of the box. Each frame of the raw image reflects the RGB color characteristics of a corresponding water-chromic device at a corresponding moment. The water-chromic devices include a primary water-chromic device and an auxiliary water-chromic device. Extract the ROI area for water leakage analysis from each frame of the original image to form the corresponding image to be analyzed. The ROI area represents the area corresponding to the water-immersed color-changing test paper. Convert each frame of the image to be analyzed into the corresponding HSV image; The method includes analyzing the comprehensive water immersion degree of the corresponding water-immersion color-changing device based on each frame of the image to be analyzed and each frame of the HSV image, including: determining the corresponding first color change threshold according to the placement position of the water-immersion color-changing device corresponding to the HSV image and the environmental parameters of the current environment, determining the theoretical water immersion area in the HSV image according to the position of the water inlet hole of the water-immersion color-changing device corresponding to the HSV image and the corresponding water leakage detection point, determining the first weight of each pixel in the HSV image based on the theoretical water immersion area, and determining the color change threshold of each pixel in the HSV image based on the color feature of each pixel in the HSV image and the corresponding first weight. Determine a first water immersion degree, and subtract a subsequent frame image from a preceding frame image to obtain a first RGB difference image, where the subsequent frame image is the image to be analyzed corresponding to the HSV image, and the preceding frame image is the image to be analyzed formed by an original image captured at a previous moment for the same water immersion color-changing device relative to the subsequent frame image. Convert the first RGB difference image into a first HSV difference image, analyze the second water immersion degree of the corresponding water immersion color-changing device based on color features of the first HSV difference image, and calculate a comprehensive water immersion degree of the corresponding water immersion color-changing device based on the first and second water immersion degrees. Based on the comprehensive water immersion degree of each water immersion color-changing device and the placement position of each water immersion color-changing device, spatial correlation analysis is used to determine whether there is water leakage in the current environment, including: when the comprehensive water immersion degree of multiple main water immersion color-changing devices exceeds the preset first water immersion degree threshold T1, it is determined that there is water leakage in the current environment; when the comprehensive water immersion degree of no main water immersion color-changing device exceeds the preset second water immersion degree threshold T2, and the comprehensive water immersion degree of the auxiliary water immersion color-changing device exceeds the preset third water immersion degree T3, and exceeds the comprehensive water immersion degree of one of the main water immersion color-changing devices, it is determined that there is no water leakage in the current environment, and it is determined that the auxiliary water immersion color-changing device is abnormal, wherein T2≤T1.
2. The water leakage detection method according to claim 1, characterized in that: Before calculating the comprehensive water immersion degree of the corresponding water immersion color changing device based on the first water immersion degree and the second water immersion degree, the method further includes: Subtracting the rear frame image from the corresponding reference frame image to obtain a second RGB difference image, and converting the second RGB difference image into a second HSV difference image, wherein the reference frame image is an image to be analyzed formed by an original image taken at the same time as the rear frame image for a reference water-immersion color-changing device, and the reference water-immersion color-changing device and the water-immersion color-changing device corresponding to the rear frame image belong to the same water leakage detection point; Analyzing a third water immersion degree of the corresponding water immersion color-changing device based on the color characteristics of the second HSV difference image; Calculating the comprehensive water immersion degree of the corresponding water immersion color changing device based on the first water immersion degree and the second water immersion degree includes: determining the comprehensive water immersion degree of the water immersion color changing device based on the first water immersion degree, the second water immersion degree and the third water immersion degree.
3. The water leakage detection method according to claim 1, characterized in that: The analyzing the second water immersion degree of the corresponding water-immersion color-changing device based on the color feature of the first HSV difference image includes: Determining a corresponding second color change threshold value according to the placement position of the water-immersion color change device corresponding to the first HSV difference image and environmental parameters of the current environment; A second water immersion degree of the corresponding water immersion color-changing device is determined based on the second color change threshold and the first HSV difference image.
4. The water leakage detection method according to claim 3, characterized in that: The determining, based on the second color change threshold and the first HSV difference image, a second water immersion degree of the corresponding water immersion color change device includes: Determining a second weight for each pixel in the first HSV difference image based on the theoretical water immersion area; A second water immersion degree is determined based on the color feature of each pixel in the HSV image and the corresponding second weight.
5. The water leakage detection method according to claim 1, characterized in that: The determining whether there is a water leak in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device also includes: When there is no main water immersion color-changing device with a comprehensive water immersion degree exceeding the first water immersion degree threshold T1, and there are at least one auxiliary water immersion color-changing device and at least one main water immersion color-changing device with a comprehensive water immersion degree exceeding the second water immersion degree threshold T2, it is determined that the current environment is humid.
6. The water leakage detection method according to claim 1, characterized in that: The method of determining whether there is water leakage in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-immersion color-changing device and the placement position of each water-immersion color-changing device includes: A trend analysis is performed on the comprehensive water immersion degree of each water immersion color-changing device at each moment, and based on the trend analysis result of each water immersion color-changing device, it is determined whether there is water leakage in the current environment.
7. A water leakage detection device based on color change, characterized in that: The device comprises: An image acquisition module, configured to acquire multiple frames of raw images of multiple water-chromic devices captured, each of which is arranged in a corresponding position in the current environment. Each water-chromic device comprises a closed box formed of a transparent material, and a water-chromic test paper within the box. A water inlet is provided on one side of the box. Each frame of the raw image reflects the RGB color characteristics of a corresponding water-chromic device at a corresponding moment. The water-chromic devices comprise a primary water-chromic device and an auxiliary water-chromic device. An image processing module is used to extract the ROI region for water leakage analysis from each frame of the original image to form a corresponding image to be analyzed, wherein the ROI region represents the area corresponding to the water-immersed color-changing test paper; and convert each frame of the image to be analyzed into a corresponding HSV image; A water immersion degree calculation module is used to analyze the comprehensive water immersion degree of the corresponding water immersion color changing device based on each frame of the image to be analyzed and each frame of the HSV image; A water leakage judgment module is used to determine whether there is a water leakage in the current environment through spatial correlation analysis based on the comprehensive water immersion degree of each water-changing device and the placement of each water-changing device; The water immersion degree calculation module is further configured to determine a corresponding first color change threshold based on the placement position of the water immersion color changing device corresponding to the HSV image and environmental parameters of the current environment, determine a theoretical water immersion area in the HSV image based on the position of the water inlet of the water immersion color changing device corresponding to the HSV image and the corresponding water leakage detection point, determine a first weight for each pixel in the HSV image based on the theoretical water immersion area, determine a first water immersion degree based on the color characteristics of each pixel in the HSV image and the corresponding first weight, subtract a subsequent frame image from a previous frame image to obtain a first RGB difference image, the subsequent frame image being the image to be analyzed corresponding to the HSV image, the previous frame image being the image to be analyzed formed by an original image taken at a previous moment for the same water immersion color changing device relative to the subsequent frame image, convert the first RGB difference image into a first HSV difference image, analyze a second water immersion degree of the corresponding water immersion color changing device based on the color characteristics of the first HSV difference image, and calculate a comprehensive water immersion degree of the corresponding water immersion color changing device based on the first water immersion degree and the second water immersion degree; The water leakage judgment module is also used to determine that there is water leakage in the current environment when the comprehensive water immersion degree of multiple main water immersion color-changing devices exceeds a preset first water immersion degree threshold T1; when the comprehensive water immersion degree of no main water immersion color-changing device exceeds the preset second water immersion degree threshold T2, and the comprehensive water immersion degree of the auxiliary water immersion color-changing devices exceeds the preset third water immersion degree T3, and exceeds the comprehensive water immersion degree of one of the main water immersion color-changing devices, determine that there is no water leakage in the current environment and determine that there is an abnormality in the auxiliary water immersion color-changing device, wherein T2≤T1.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores executable instructions, which, when executed by a processor, enable the processor to perform the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs, which, when executed by the one or more processors, causes the one or more processors to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for determining detection result of urine test paper
CN108593645A
Accumulated water detection method based on color-changeable paper and image recognition
CN114820468A