Water leakage detection method and apparatus, and electronic device and storage medium
By analyzing the temperature matrix of thermal infrared images and identifying temperature change patterns, the system can automatically identify leakage areas and points, solving the problems of high false alarm rates and poor usability in existing technologies, and achieving highly accurate leakage detection.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HANGZHOU MICROIMAGE SOFTWARE CO LTD
- Filing Date
- 2026-01-06
- Publication Date
- 2026-07-16
Smart Images

Figure CN2026070869_16072026_PF_FP_ABST
Abstract
Description
Leakage detection methods, devices, electronic equipment and storage media
[0001] This application claims priority to Chinese Patent Application No. 202510052638.8, filed on January 13, 2025, entitled "Leakage Detection Method and Apparatus", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of image processing technology, and in particular to methods, apparatus, electronic devices and storage media for water leakage detection. Background Technology
[0003] Infrared thermal imaging technology uses a detector array to receive infrared signals emitted by objects in a specific wavelength band and converts these signals into thermal infrared images that can be discerned by the human eye. In a thermal infrared image, the pixel value directly reflects the object's temperature: the higher the temperature of the object, the brighter it appears in the thermal image. Grayscale-temperature conversion can be used to convert the grayscale data of each pixel in the thermal infrared image into temperature data. Infrared thermal imaging technology is widely used in leak detection.
[0004] The basic steps of existing infrared thermal imaging-based leak detection methods are as follows: First, an infrared thermal imaging device is used to acquire a thermal infrared image. Then, the image data is processed, including gradient calculation, filtering, binarization, and opening operations. Through this processing, all suspected leak areas in the image (usually areas with a temperature difference from the environment) are highlighted. Then, rules (such as upper and lower limits of contour area) are set to filter these suspected leak areas, and based on this, the presence of a leak area in the acquired image is determined. However, in real-world applications, many objects have temperature differences from the environment, not just leak areas, and simple filtering rules are insufficient to distinguish leak areas. The complex and varied application scenarios lead to a high false alarm rate for existing infrared thermal imaging-based leak detection methods. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for leak detection, so as to improve the accuracy of leak detection. The specific technical solution is as follows:
[0006] In a first aspect, embodiments of this application provide a water leakage detection method, the method comprising:
[0007] Acquire thermal infrared images of the scene to be detected;
[0008] The corresponding temperature matrix is obtained from the thermal infrared image, where each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image.
[0009] In the scene to be tested, the temperature matrix is used to search for areas where the temperature gradually increases from the center to the edge. If such areas are found, the area is identified as a low-temperature leakage area. Alternatively, the temperature matrix is used to search for areas where the temperature gradually decreases from the center to the edge. If such areas are found, the area is identified as a high-temperature leakage area.
[0010] In one possible implementation, after determining that the area is a low-temperature leakage area, the process further includes: finding the lowest temperature point in the low-temperature leakage area and determining the lowest temperature point as the low-temperature leakage point.
[0011] Alternatively, after identifying the area as a high-temperature leakage area, the process may further include: finding the highest temperature point within the high-temperature leakage area and identifying that point as the high-temperature leakage point.
[0012] In one possible implementation, after obtaining the corresponding temperature matrix from the thermal infrared image, and before searching in the scene to be detected using the temperature matrix for regions where the temperature gradually increases from the center to the edge, or before searching in the scene to be detected using the temperature matrix for regions where the temperature gradually decreases from the center to the edge, the method further includes:
[0013] Find the highest and lowest temperatures in the temperature matrix, calculate the difference between the highest and lowest temperatures, and determine whether the difference is greater than a preset first threshold. If it is greater, it is determined that there may be water leakage in the scene to be detected, and then perform the action of finding, through the temperature matrix, a region in the scene to be detected where the temperature gradually increases from the center to the edge, or a region in the scene to be detected where the temperature gradually decreases from the center to the edge.
[0014] In one possible implementation, after obtaining the corresponding temperature matrix from the thermal infrared image, and before searching in the scene to be detected using the temperature matrix for regions where the temperature gradually increases from the center to the edge, or before searching in the scene to be detected using the temperature matrix for regions where the temperature gradually decreases from the center to the edge, the method further includes:
[0015] Calculate the average temperature of the temperature matrix and find the highest and lowest temperatures in the temperature matrix. If the difference between the average temperature and the lowest temperature is greater than the difference between the highest temperature and the average temperature, it is determined that there is a low-temperature water leakage phenomenon in the scene to be detected. Then, perform the action of finding the area in the scene to be detected by the temperature matrix that gradually increases in temperature from the center to the edge.
[0016] If the difference between the highest temperature and the average temperature is greater than the difference between the average temperature and the lowest temperature, it is determined that there is a high-temperature water leakage in the scene to be tested, and the action of searching for the area where the temperature gradually decreases from the center to the edge in the scene to be tested through the temperature matrix is performed.
[0017] In one possible implementation, after obtaining the corresponding temperature matrix from the thermal infrared image and before calculating the average temperature of the temperature matrix, the process further includes:
[0018] Temperatures below a preset second threshold and above a preset third threshold are removed from the temperature matrix to obtain an updated temperature matrix; or / and, the proportion of each temperature in the temperature matrix is calculated based on the temperature matrix, and temperatures with a proportion below a preset fourth threshold are removed from the temperature matrix to obtain an updated temperature matrix.
[0019] Furthermore, the calculation of the average value of the temperature matrix and the search for the highest and lowest temperatures within the temperature matrix include:
[0020] Calculate the average value of the updated temperature matrix, and then find the highest and lowest temperatures within the updated temperature matrix.
[0021] In one possible implementation, the step of searching for regions in the scene to be detected by using a temperature matrix, where the temperature gradually increases from the center to the edge, includes:
[0022] The lowest temperature in the temperature matrix is used as the lower limit of the low-temperature leakage area segmentation; the upper limit of the low-temperature leakage area segmentation is calculated based on the lowest and average temperatures in the temperature matrix; a connected region with a temperature between the lower and upper limits of the low-temperature leakage area segmentation is found in the thermal infrared image, and this connected region is used as the low-temperature leakage area.
[0023] Alternatively, the step of finding regions in the scene to be detected by means of a temperature matrix that gradually decreases in temperature from the center to the edge includes: taking the highest temperature of the temperature matrix as the upper limit of the temperature for dividing the high-temperature leakage region; calculating the lower limit of the temperature for dividing the high-temperature leakage region based on the highest temperature and the average temperature of the temperature matrix; and finding a connected region in the thermal infrared image whose temperature is between the lower limit and the upper limit of the temperature for dividing the high-temperature leakage region, and taking this connected region as the high-temperature leakage region.
[0024] In one possible implementation, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the low-temperature leakage area segmentation, and before identifying this connected region as the low-temperature leakage area, the process further includes:
[0025] For any connected region found, determine whether the area of the connected region is greater than the fifth threshold and less than the sixth threshold. If so, execute the action of treating the connected region as a low-temperature leakage area.
[0026] Alternatively, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before identifying this connected region as the high-temperature leakage area, the process further includes:
[0027] For any connected region found, determine whether the area of the connected region is greater than the seventh threshold and less than the eighth threshold. If so, execute the action of treating the connected region as a high-temperature leakage area.
[0028] In one possible implementation, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the low-temperature leakage area segmentation, and before identifying this connected region as the low-temperature leakage area, the process further includes:
[0029] According to the preset segmentation level, the temperature between the lower limit and the upper limit of the low temperature leakage area is divided into multiple temperature levels equal to the segmentation level; for each connected region found, the sub-regions corresponding to each temperature level are searched in the connected region, and if the area of any sub-region is less than the preset ninth threshold, the sub-region is considered to be noise. It is determined whether the number of non-noise sub-regions contained in the connected region is greater than the preset tenth threshold. If so, the action of treating the connected region as a low temperature leakage area is performed.
[0030] Alternatively, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before identifying this connected region as the high-temperature leakage area, the process further includes:
[0031] According to the preset segmentation level, the temperature between the lower and upper temperature limits of the high-temperature leakage area is divided into multiple temperature levels equal to the segmentation level. For any connected region found, a sub-region corresponding to each temperature level is searched within the connected region. If the area of any sub-region is less than the preset eleventh threshold, the sub-region is considered to be noise. It is then determined whether the number of non-noise sub-regions contained in the connected region is greater than the preset twelfth threshold. If so, the action of treating the connected region as a high-temperature leakage area is performed.
[0032] In one possible implementation, after finding a connected region in the thermal infrared image whose temperature is located between the lower and upper temperature limits of the low-temperature leakage region segmentation, and before designating the connected region as the low-temperature leakage region, the process further includes: determining a temperature curve from the lowest temperature point of the connected region to the corner point of the outer rectangle of the connected region; determining whether there are segments in the temperature curve of the connected region where the temperature continuously increases; if so, dividing the temperature between the lower and upper temperature limits of the low-temperature leakage region segmentation into multiple temperature levels equal to the number of segmentation levels according to a preset number of segmentation levels; if the number of temperature levels in the segments where the temperature continuously increases is greater than a preset tenth threshold, then performing the action of designating the connected region as the low-temperature leakage region.
[0033] Alternatively, after finding the connected region in the thermal infrared image where the temperature is located between the lower and upper temperature limits of the high-temperature leakage area segment, and before designating the connected region as the high-temperature leakage area, the process further includes: determining the temperature curve from the highest temperature point of the connected region to the corner point of the outer rectangle of the connected region; determining whether there are segments in the temperature curve of the connected region where the temperature continuously decreases; if so, dividing the temperature between the lower and upper temperature limits of the high-temperature leakage area segment into multiple temperature levels equal to the number of segmentation levels according to a preset number of segmentation levels; if the number of temperature levels in the segments where the temperature continuously decreases is greater than a preset twelfth threshold, then performing the action of designating the connected region as the high-temperature leakage area.
[0034] Secondly, embodiments of this application provide a water leakage detection device, which includes:
[0035] The temperature data acquisition module acquires the thermal infrared image of the scene to be detected and obtains the corresponding temperature matrix based on the thermal infrared image. Each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image.
[0036] The detection module uses a temperature matrix to search for areas in the scene to be tested where the temperature gradually increases from the center to the edge. If such an area is found, it is determined to be a low-temperature leakage area. Alternatively, it uses a temperature matrix to search for areas in the scene to be tested where the temperature gradually decreases from the center to the edge. If such an area is found, it is determined to be a high-temperature leakage area.
[0037] A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the processor to perform any of the above-described leakage detection methods.
[0038] Thirdly, embodiments of this application provide a method for detecting water leakage, the method comprising:
[0039] Acquire thermal infrared images of the scene to be detected;
[0040] Based on the temperature of each pixel in the thermal infrared image, the leakage area is determined, wherein the leakage area includes a low-temperature leakage area or a high-temperature leakage area. The temperature of the low-temperature leakage area gradually increases from the center to the edge, and the temperature of the high-temperature leakage area gradually decreases from the center to the edge.
[0041] In one possible implementation, the method further includes:
[0042] The leaking area is displayed in the image of the scene to be detected. The leaking area shows multiple interconnected regions distributed in a nested manner, and different interconnected regions correspond to different temperature ranges.
[0043] In one possible implementation, the method further includes:
[0044] The leakage points of the leakage area are displayed in the image of the scene to be detected. The leakage points of the low-temperature leakage area of the low-temperature leakage type are the lowest temperature points, and the leakage points of the high-temperature leakage area of the high-temperature leakage type are the highest temperature points.
[0045] In one possible implementation, before determining the leakage area based on the temperature of each pixel in the thermal infrared image, the method further includes:
[0046] The highest and lowest temperatures in the thermal infrared image are obtained, and the first highest temperature and the first lowest temperature are obtained respectively.
[0047] Determine whether the difference between the first highest temperature and the first lowest temperature is greater than a preset first threshold. If it is greater, proceed to step: determine the leakage area based on the temperature of each pixel in the thermal infrared image; otherwise, determine that there is no leakage area.
[0048] In one possible implementation, determining the leakage area based on the temperature of each pixel in the thermal infrared image includes:
[0049] Pixels in the thermal infrared image whose temperature is outside the preset temperature range are filtered out to obtain the filtered pixels. The preset temperature threshold is set according to the temperature range of the water.
[0050] Calculate the average temperature of each pixel after filtering, and obtain the highest and lowest temperatures to get the second highest and second lowest temperatures;
[0051] If the first difference is greater than the second difference, it is determined that there is a high-temperature leakage type, wherein the first difference is the difference between the second highest temperature and the average temperature, and the second difference is the difference between the average temperature and the second lowest temperature.
[0052] If the second difference is greater than the first difference, then it is determined that there is a low-temperature leakage type.
[0053] Determine the area of leakage based on the type of leakage.
[0054] In one possible implementation, before calculating the average temperature of each of the filtered pixels and obtaining the highest and lowest temperatures therein to obtain a second highest and a second lowest temperature, the method further includes:
[0055] Calculate the percentage of pixels at each temperature in the total number of pixels, and filter out pixels with a percentage lower than the preset fourth threshold.
[0056] In one possible implementation, determining the leakage area based on the leakage type includes:
[0057] In the case where the leakage type is low-temperature leakage, the second lowest temperature is used as the lower limit of the low-temperature leakage area segmentation; the upper limit of the low-temperature leakage area segmentation is calculated based on the second lowest temperature and the average temperature; a connected region with a temperature between the lower limit and the upper limit of the low-temperature leakage area segmentation is determined in the thermal infrared image to obtain a first connected region; the first connected region is used as the low-temperature leakage area.
[0058] Alternatively, if the leakage type is a high-temperature leakage type, the second highest temperature is used as the upper temperature limit for dividing the high-temperature leakage area; the lower temperature limit for dividing the high-temperature leakage area is calculated based on the second highest temperature and the average temperature; a connected region with a temperature between the lower temperature limit and the upper temperature limit of the high-temperature leakage area is determined in the thermal infrared image to obtain a second connected region; the second connected region is used as the high-temperature leakage area.
[0059] In one possible implementation, before identifying the first connected region as a low-temperature leakage region, the method further includes: filtering out the first connected region whose area is not between a fifth threshold and a sixth threshold, wherein the sixth threshold is greater than the fifth threshold;
[0060] Alternatively, before identifying the second connected region as a high-temperature leakage region, the method further includes filtering out the second connected region whose area is not between the seventh threshold and the eighth threshold, wherein the eighth threshold is greater than the seventh threshold.
[0061] In one possible implementation, before designating the first connected region as a low-temperature leakage region, the method further includes: dividing the temperature between the lower limit and the upper limit of the low-temperature leakage region into multiple temperature levels equal to the number of division levels according to a preset division level; determining a sub-region corresponding to each temperature level in the first connected region; identifying sub-regions with an area smaller than a preset ninth threshold as noise points; determining whether the number of non-noise sub-regions contained in the first connected region is greater than a preset tenth threshold; if so, then performing the step: designating the first connected region as a low-temperature leakage region.
[0062] Alternatively, before designating the second connected region as a high-temperature leakage region, the method further includes: dividing the temperature between the lower and upper temperature limits of the high-temperature leakage region into multiple temperature levels equal to the number of division levels, according to a preset division level; determining a sub-region corresponding to each temperature level in the second connected region; identifying sub-regions with an area smaller than a preset ninth threshold as noise points; determining whether the number of non-noise sub-regions contained in the second connected region is greater than a preset twelfth threshold; if so, then executing the step: designating the second connected region as a high-temperature leakage region.
[0063] In one possible implementation, before designating the first connected region as a low-temperature leakage region, the method further includes: determining a temperature curve from the lowest temperature point of the first connected region to the corner point of the outer rectangle of the first connected region to obtain a first temperature curve; determining whether there are segments with continuously increasing temperatures in the first temperature curve; if so, dividing the temperature between the lower limit and the upper limit of the low-temperature leakage region into multiple temperature levels equal to the number of division levels according to a preset division level; if the number of temperature levels in the segments with continuously increasing temperatures is greater than a preset tenth threshold, then the step of designating the first connected region as a low-temperature leakage region is executed.
[0064] Alternatively, before designating the second connected region as a high-temperature leakage region, the method further includes: determining a temperature curve from the highest temperature point of the second connected region to the corner point of the outer rectangle of the second connected region to obtain a second temperature curve; determining whether there are segments in the second temperature curve where the temperature continuously decreases; if so, dividing the temperature between the lower limit and the upper limit of the high-temperature leakage region into multiple temperature levels equal to the number of division levels according to a preset division level; if the number of temperature levels in the segments where the temperature continuously decreases is greater than a preset twelfth threshold, then the step of designating the second connected region as a high-temperature leakage region is executed.
[0065] Fourthly, embodiments of this application provide a non-transitory computer-readable storage medium that stores instructions, which, when executed by a processor, cause the processor to perform any of the leakage detection methods described in this application.
[0066] Fifthly, embodiments of this application provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0067] Memory, used to store computer programs;
[0068] The processor, when executing a program stored in memory, implements any of the water leakage detection methods described in this application.
[0069] In the above embodiments, after obtaining the temperature matrix from the thermal infrared image of the scene to be detected, the temperature matrix is used to search for areas in the scene to be detected where the temperature gradually increases from the center to the edge. If such areas are found, the area is determined to be a low-temperature leakage area. Alternatively, the temperature matrix is used to search for areas in the scene to be detected where the temperature gradually decreases from the center to the edge. If such areas are found, the area is determined to be a high-temperature leakage area. This allows for the detection of low-temperature or high-temperature leakage areas based on the temperature change patterns within them, thus improving the accuracy of leakage detection. Attached Figure Description
[0070] The accompanying drawings, which are provided to further understand this application and constitute a part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application.
[0071] Figure 1 is a flowchart of a water leakage detection method provided in an embodiment of this application;
[0072] Figure 2a is an example of a thermal infrared image and a visible light image of a scene where low-temperature water leakage occurs;
[0073] Figure 2b is a black and white image of Figure 2a;
[0074] Figure 3 is a schematic diagram showing the proportion of each temperature after removing temperatures below the second threshold and above the third threshold from the temperature matrix corresponding to part 21 of Figure 2a, and removing temperatures with a proportion below the fourth threshold.
[0075] Figure 4a is a schematic diagram of temperature segmentation of the two connected regions detected in part 21 of Figure 2a and plotted on part 22 of Figure 2a;
[0076] Figure 4b is a black and white image of Figure 4a;
[0077] Figure 5a is a schematic diagram of temperature segmentation of two connected regions detected in a thermal infrared image of another scenario where low-temperature water leakage may exist, and plotting them onto a visible light image of the scenario.
[0078] Figure 5b is a black and white image of Figure 5a;
[0079] Figure 6 is a schematic diagram showing the location of the two low-temperature leaks finally detected in Figure 4a;
[0080] Figure 7 is a flowchart of a water leakage detection method provided in another embodiment of this application;
[0081] Figure 8 is a schematic diagram of the structure of a water leakage detection device provided in an embodiment of this application. Detailed Implementation
[0082] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided with reference to the accompanying drawings and embodiments. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments in this application are within the scope of protection of this application.
[0083] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0084] Existing infrared thermal imaging-based leak detection methods require users to configure filtering temperatures, specifying the temperature difference between the leaking area and the ambient temperature, or a range of absolute temperatures, to identify leaking areas. This approach demands precise knowledge of the leaking temperature from the user, resulting in poor usability. Furthermore, many objects exhibit temperature differences from the environment, not just leaking areas, and simple filtering rules are insufficient to distinguish between them, easily leading to false alarms.
[0085] To address at least one of the aforementioned problems, this application provides a water leakage detection method, as shown in Figure 1, which is a flowchart of a water leakage detection method provided in an embodiment of this application. As shown in Figure 1, the specific steps are as follows:
[0086] Step 101: Acquire the thermal infrared image of the scene to be detected.
[0087] Step 102: Obtain the corresponding temperature matrix based on the thermal infrared image, where each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image.
[0088] Step 103: Use the temperature matrix to find areas in the scene to be tested where the temperature gradually increases from the center to the edge. If found, the area is determined to be a low-temperature leakage area. Alternatively, use the temperature matrix to find areas in the scene to be tested where the temperature gradually decreases from the center to the edge. If found, the area is determined to be a high-temperature leakage area.
[0089] The inventors observed that both low-temperature and high-temperature leaks exhibit temperature diffusion, but the temperature changes differ between the two. In low-temperature leaks, water seeps outwards from the leak point, and the amount of water stored and evaporated per unit area gradually decreases from the leak point outwards. Evaporation absorbs heat, thus the temperature in the leaking area increases from the leak point outwards, exhibiting temperature diffusion. In high-temperature leaks, heat continuously dissipates outwards, so the temperature in the leaking area decreases from the leak point outwards, also exhibiting temperature diffusion. Therefore, in low-temperature leaks, the temperature gradually increases from the center (leak point) to the edges; in high-temperature leaks, the temperature gradually decreases from the center (leak point) to the edges.
[0090] In the above embodiments, after obtaining the temperature matrix from the thermal infrared image of the scene to be detected, the temperature matrix is used to search for areas in the scene where the temperature gradually increases from the center to the edge. If such areas are found, the area is identified as a low-temperature leakage area. Alternatively, the temperature matrix is used to search for areas in the scene where the temperature gradually decreases from the center to the edge. If such areas are found, the area is identified as a high-temperature leakage area. This approach does not simply identify areas with a temperature difference from the environment as leakage areas, but rather detects low-temperature or high-temperature leakage areas based on the internal temperature change patterns, thus improving the accuracy of leakage detection. Furthermore, it eliminates the need for user-configured temperature filtering, improving ease of use.
[0091] Since the temperature in a low-temperature leak area gradually increases from the leak point towards the edge, the temperature at the leak point is the lowest. Conversely, in a high-temperature leak area, the temperature gradually decreases from the leak point towards the edge, thus the temperature at the leak point is the highest. Therefore, the following solution is provided for determining low-temperature and high-temperature leak points:
[0092] In one optional embodiment, after determining that the area is a low-temperature leakage area in step 103, the method further includes: finding the lowest temperature point in the low-temperature leakage area and determining the lowest temperature point as the low-temperature leakage point; or, after determining that the area is a high-temperature leakage area, the method further includes: finding the highest temperature point in the high-temperature leakage area and determining the highest temperature point as the high-temperature leakage point.
[0093] When a water leak occurs, a low-temperature leak will cause the temperature of the leaking area to be lower than the temperature of other areas; conversely, a high-temperature leak will cause the temperature of the leaking area to be higher than the temperature of other areas. In other words, both low-temperature and high-temperature leaks will increase the difference between the highest and lowest temperatures in the tested area. Therefore, the following preliminary solution is provided for detecting whether a water leak may exist in the tested area:
[0094] In one optional embodiment, after step 102 and before step 103, the process further includes: finding the highest and lowest temperatures in the temperature matrix, calculating the difference between the highest and lowest temperatures, and determining whether the difference is greater than a preset first threshold. If it is greater, it is determined that there may be a water leakage in the scene to be tested, and step 103 is executed; otherwise, it is determined that there is no water leakage in the scene to be tested, and the process ends. The value of the first threshold can be set based on experience, etc. The preset first threshold can be set based on experience, for example, it can be set to 2 degrees Celsius, 3 degrees Celsius, 4 degrees Celsius, or 5 degrees Celsius, etc.
[0095] Similarly, when a leak occurs, the temperature of the non-leaking areas will be very similar. For example, in a roof leak scenario, the temperature of the non-leaking areas on the roof should be room temperature, except for the leaking area. When it's a low-temperature leak, the water in the leaking area will evaporate and absorb heat, causing the temperature of the leaking area to be lower than the temperature of other areas (non-leaking areas). Since low-temperature leaking areas are usually small, this increases the difference between the average temperature and the lowest temperature. When it's a high-temperature leak, the water temperature will be higher than the ambient temperature, causing the temperature of the leaking area to be higher than the temperature of other areas, thus increasing the difference between the average temperature and the highest temperature. Therefore, the following solution is provided for detecting whether a leak is low-temperature or high-temperature in the scenario being tested:
[0096] In one optional embodiment, after step 102 and before step 103, the method further includes: calculating the average temperature of the temperature matrix, and finding the highest and lowest temperatures in the temperature matrix; if the difference between the average temperature and the lowest temperature is greater than the difference between the highest temperature and the average temperature, then it is determined that there is a low-temperature water leakage phenomenon in the scene to be tested, and the action of "finding the area where the temperature gradually increases from the center to the edge in the scene to be tested through the temperature matrix" in step 103 is executed; if the difference between the highest temperature and the average temperature is greater than the difference between the average temperature and the lowest temperature, then it is determined that there is a high-temperature water leakage phenomenon in the scene to be tested, and the action of "finding the area where the temperature gradually decreases from the center to the edge in the scene to be tested through the temperature matrix" in step 103 is executed.
[0097] Considering that there may be some noise in the scene to be detected, causing the temperature of some points to be abnormally high or low, in order to remove this noise, pixels in the thermal infrared image whose temperature is not within the preset temperature range can be filtered out. Also, pixels with a small percentage of temperatures can be filtered out, resulting in filtered pixels. The preset temperature range is set based on the temperature range of water and is used to filter out areas with abnormally high or low temperatures (e.g., fire sources).
[0098] Specifically, the following solutions are provided:
[0099] In one optional embodiment, after step 102 and before calculating the average temperature of the temperature matrix, the method further includes: removing temperatures lower than a preset second threshold and higher than a preset third threshold from the temperature matrix to obtain an updated temperature matrix; or / and, calculating the proportion of each temperature in the temperature matrix based on the temperature matrix, removing temperatures with a proportion lower than a preset fourth threshold from the temperature matrix to obtain an updated temperature matrix; wherein, the values of the second to fourth thresholds can be set based on experience, etc.; the second threshold is usually consistent with the lower limit of the temperature measurement of the infrared thermal imaging device used, and the third threshold is usually set based on the highest water temperature. The third threshold is usually 100℃ (degrees Celsius). The second and third thresholds are set to exclude ultra-high temperature or ultra-low temperature areas in the scene to be detected, such as gas stoves used in kitchen scenes (temperatures can reach several hundred degrees). In one example, the third threshold can be used as the upper limit of the preset temperature range, and the second threshold can be used as the lower limit of the preset temperature range.
[0100] Furthermore, the average value of the temperature matrix is calculated, and the highest and lowest temperatures are found within the temperature matrix. This includes calculating the average value of the updated temperature matrix and finding the highest and lowest temperatures within the updated temperature matrix. The temperature matrix represents the temperature of each pixel in the thermal infrared image; therefore, the updated temperature matrix represents the filtered temperatures of each pixel.
[0101] Figure 2a shows example thermal infrared and visible light images of a scene with low-temperature water leakage. 21 is the thermal infrared image, and 22 is the visible light image. From section 21 of Figure 2a, it can be seen that the average temperature of the entire image is high, while the temperature of the leaking area is low. Figure 2b is a black-and-white image of Figure 2a, where the temperatures of leaking areas 211 and 212 are significantly lower than the temperatures of other areas.
[0102] Figure 3 shows the proportion of each temperature after removing temperatures below the second threshold and above the third threshold from the temperature matrix corresponding to section 21 of Figure 2a, and also removing temperatures with a proportion below the fourth threshold. The horizontal axis represents temperature in °C, and the vertical axis represents the proportion of each temperature (the ratio of pixels at that temperature to the total number of pixels). Figure 3 clearly shows that the difference between the average temperature and the lowest temperature is greater than the difference between the highest temperature and the average temperature, indicating a clear low-temperature leakage phenomenon.
[0103] In one optional embodiment, step 103 involves finding, using a temperature matrix, a region in the scene to be detected where the temperature gradually increases from the center to the edge. This includes: using the lowest temperature of the temperature matrix as the lower limit of the low-temperature leakage region segmentation; calculating the upper limit of the low-temperature leakage region segmentation based on the lowest and average temperatures of the temperature matrix; and finding a connected region in the thermal infrared image whose temperature falls between the lower limit and the upper limit of the low-temperature leakage region segmentation, and using this connected region as the low-temperature leakage region.
[0104] In practical applications, using the lowest temperature of the temperature matrix as the lower limit for segmenting low-temperature leakage areas specifically means: using the lowest temperature of the updated temperature matrix as the lower limit for segmenting low-temperature leakage areas. The updated temperature matrix is the one mentioned above that excludes temperatures below the second threshold, above the third threshold, and those with a proportion lower than the preset fourth threshold.
[0105] In practical applications, the lower limit T of the low-temperature leakage zone segmentation l_l and upper temperature limit T l_h They can be represented as follows: T l_l =T min T l_h =T min +σ(T ave -T min )
[0106] Among them, T min T represents the lowest temperature in the updated temperature matrix. ave The average temperature of the updated temperature matrix is σ, which is a preset constant. Generally, 0.5 ≤ σ < 1.
[0107] Considering that the thermal infrared image may contain some noise points that are obviously not leaking areas but are either too large or too small, and that the temperature of these noise points also meets the condition of being between the lower and upper temperature limits of the low-temperature leaking area segmentation, the following solution is proposed to eliminate these noise points:
[0108] In one optional embodiment, after finding a connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the segmented low-temperature leakage area, and before designating that connected region as the low-temperature leakage area, the process further includes: for any found connected region, determining whether the area of the connected region is greater than a fifth threshold and less than a sixth threshold; if so, then performing the action of designating the connected region as the low-temperature leakage area; otherwise, determining that the connected region is noise and not participating in subsequent processes. The values of the fifth and sixth thresholds can be set based on experience, etc.
[0109] Considering that the temperature in the low-temperature leakage area gradually increases from the center to the edge, meaning the temperature change is continuous, the low-temperature leakage area can be further confirmed based on the temperature change pattern, as follows:
[0110] In one optional embodiment, after finding a connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the segmented low-temperature leakage region, and before designating that connected region as the low-temperature leakage region, the method further includes: dividing the temperature between the lower and upper temperature limits of the segmented low-temperature leakage region into multiple temperature levels equal to the number of segmentation levels, according to a preset number of segmentation levels; for each found connected region, searching for sub-regions corresponding to each temperature level within that connected region; and if the area of any sub-region is less than a preset ninth threshold, then the sub-region is considered noise; determining whether the number of non-noise sub-regions contained in the connected region is greater than a preset tenth threshold; if so, then performing the action of designating the connected region as the low-temperature leakage region; otherwise, the connected region is considered not to be the low-temperature leakage region. The values of the ninth and tenth thresholds can be set based on experience, etc.
[0111] In practical applications, the temperature level of low-temperature leakage areas can be classified as follows:
[0112] Among them, T l_i T represents the upper temperature limit of the i-th temperature level in the low-temperature leakage zone, and also the lower temperature limit of the (i+1)-th temperature level in the low-temperature leakage zone; l_l T l_h The lower and upper temperature limits, C, are used to divide the low-temperature leakage area. l_num Let i be the number of levels for dividing the low-temperature leakage area, 1≤i≤C l_num .
[0113] Figure 4a is a schematic diagram showing the temperature segmentation of the two connected regions detected in part 21 of Figure 2a and plotted on 22, where each color corresponds to a temperature level. It can be seen that the connected region on the right contains a large number of small red noise points. After excluding these red noise points, the connected region on the right contains 5 non-noise sub-regions, i.e., 5 temperature levels; the connected region on the left contains 6 non-noise sub-regions, i.e., 6 temperature levels. If the tenth threshold is set to 4, both the left and right connected regions will be identified as low-temperature leakage areas. Figure 4b is a black and white image of Figure 4a. In Figure 4b, the connected region on the left side, from the inside out, includes non-noise sub-regions 411, 412, 413, 414, 415, and 416. In Figure 4b, the connected region on the right side, from the inside out, includes non-noise sub-regions 422, 423, 424, and 425. Among them, the non-noise sub-region 422 contains multiple noise sub-regions 421. The area of the noise sub-regions 421 is smaller than the preset ninth threshold and needs to be filtered out.
[0114] Figure 5a is a schematic diagram of temperature segmentation of two connected regions detected in a thermal infrared image of another scene where low-temperature leakage may exist, and plotting it onto the visible light image of the scene. Each color corresponds to a temperature level. Figure 5b is a black and white image of Figure 5a. It can be seen that the connected region on the left only has two temperature levels, sub-regions 511 and 512. Therefore, if the tenth threshold is set to 4, the connected region on the left will not be identified as a low-temperature leakage area.
[0115] Figure 6 is a schematic diagram showing the location of the two low-temperature leaks finally detected in Figure 4a, and Figure 6 also provides the text message: Suspected abnormality.
[0116] In one optional embodiment, step 103 involves finding, through the temperature matrix, a region in the scene to be detected where the temperature gradually decreases from the center to the edge. This includes: using the highest temperature of the temperature matrix as the upper temperature limit for segmenting the high-temperature leakage region; calculating the lower temperature limit for segmenting the high-temperature leakage region based on the highest and average temperatures of the temperature matrix; and finding a connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the high-temperature leakage region segmentation, and using this connected region as the high-temperature leakage region.
[0117] In practical applications, using the highest temperature in the temperature matrix as the upper limit for segmenting high-temperature leakage areas specifically means: using the highest temperature in the updated temperature matrix as the upper limit for segmenting high-temperature leakage areas. The updated temperature matrix is, as mentioned above, the temperature matrix that excludes temperatures below the second threshold, above the third threshold, and those with a proportion lower than the preset fourth threshold.
[0118] In practical applications, the upper temperature limit T for high-temperature leakage zone segmentation h_h and lower limit T h_l They can be represented as follows: T h_h =T max T h_l =T max -σ(T max -T ave )
[0119] Among them, T max T represents the highest temperature in the updated temperature matrix. ave The average temperature of the updated temperature matrix is σ, which is a preset constant. Generally, 0.5 ≤ σ < 1.
[0120] Considering that the thermal infrared image may contain some noise points that are obviously not leaking areas but are either too large or too small, and that the temperature of these noise points also meets the condition of being between the lower and upper temperature limits of the high-temperature leaking area segmentation, the following solution is proposed to eliminate these noise points:
[0121] In one optional embodiment, after finding a connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before designating that connected region as the high-temperature leakage area, the process further includes: for any found connected region, determining whether the area of the connected region is greater than a seventh threshold and less than an eighth threshold; if so, then performing the action of designating the connected region as the high-temperature leakage area; otherwise, considering the connected region as noise and not participating in subsequent processes. The values of the seventh and eighth thresholds can be set based on experience, etc.
[0122] Considering that the temperature in the high-temperature leakage area gradually decreases from the center to the edge, meaning the temperature change is continuous, the high-temperature leakage area can be further confirmed based on the temperature change pattern, as follows:
[0123] In one optional embodiment, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage region segmentation, and before designating that connected region as the high-temperature leakage region, the method further includes: dividing the temperature between the lower and upper temperature limits of the high-temperature leakage region segmentation into multiple temperature levels equal to the number of segmentation levels, according to a preset number of segmentation levels; for any found connected region, searching for sub-regions corresponding to each temperature level within that connected region; and if the area of any sub-region is less than a preset eleventh threshold, then the sub-region is considered noise; determining whether the number of non-noise sub-regions contained in the connected region is greater than a preset twelfth threshold; if so, then performing the action of designating the connected region as the high-temperature leakage region; otherwise, the connected region is considered not to be a high-temperature leakage region. The values of the eleventh and twelfth thresholds can be set based on experience, etc.
[0124] In practical applications, the temperature level of high-temperature leakage areas can be classified as follows:
[0125] Among them, T h_i T represents the upper temperature limit of the i-th temperature level in the high-temperature leakage area, and also the lower temperature limit of the (i+1)-th temperature level in the high-temperature leakage area; h_l T h_h The lower and upper temperature limits, C, are respectively used to divide the high-temperature leakage area. h_num Let i be the number of levels that divide the high-temperature leakage area, 1≤i≤C h_num .
[0126] In an optional embodiment, after locating a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the low-temperature leakage region segmentation, and before identifying this connected region as the low-temperature leakage region, the method further includes:
[0127] Determine the temperature curve from the lowest temperature point of the connected region to the corner point of the outer rectangle of the connected region; determine whether there are segments in the temperature curve of the connected region where the temperature increases continuously; if so, divide the temperature between the lower limit and the upper limit of the low temperature leakage area into multiple temperature levels equal to the number of division levels according to the preset division level; if the number of temperature levels in the segment where the temperature increases continuously is greater than the preset tenth threshold, then execute the action of treating the connected region as a low temperature leakage area.
[0128] The method for dividing temperature levels can be found in the above embodiments and will not be repeated here. In one example, a line can be drawn from the lowest temperature point of the connected region to the corner point of the outer rectangle of the connected region, and a temperature curve can be obtained based on the temperature of each point on the line. For each temperature curve, it is determined whether there is a segment with continuously increasing temperature. If so, the number of temperature levels in the segment with continuously increasing temperature is determined. If the number of temperature levels in the segment with continuously increasing temperature in each temperature curve is greater than a preset tenth threshold, the connected region is designated as a low-temperature leakage region; or, if there is at least one temperature curve with a segment with continuously increasing temperature and the number of temperature levels is greater than the preset tenth threshold, the connected region is designated as a low-temperature leakage region. The line drawn from the lowest temperature point of the connected region to the corner point of the outer rectangle of the connected region can be four temperature curves drawn to the four corner points, one temperature curve drawn to one corner point, or two temperature curves drawn to the two diagonally opposite corner points. This can be set according to the actual situation.
[0129] In this embodiment of the application, by detecting segments of continuously increasing temperature and determining the number of temperature levels in the segments of continuously increasing temperature, a more reasonable detection mechanism is provided for detecting low-temperature leakage areas, which can improve the accuracy of the detection results.
[0130] In an optional embodiment, after locating a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before identifying this connected region as the high-temperature leakage area, the method further includes:
[0131] Determine the temperature curve from the highest temperature point in the connected region to the corner point of the outer rectangle of the connected region; determine whether there are segments in the temperature curve of the connected region where the temperature continuously decreases; if so, divide the temperature between the lower and upper temperature limits of the high-temperature leakage area into multiple temperature levels equal to the number of division levels, according to the preset division level; if the number of temperature levels in the segment where the temperature continuously decreases is greater than the preset twelfth threshold, then execute the action of treating the connected region as a high-temperature leakage area.
[0132] In this embodiment of the application, by detecting segments of continuously decreasing temperature and determining the number of temperature levels in the segments of continuously decreasing temperature, a more reasonable detection mechanism is provided for detecting high-temperature leakage areas, which can improve the accuracy of detection results.
[0133] Figure 7 is a flowchart of a leakage detection method provided in another embodiment of this application. As shown in Figure 7, the specific steps are as follows:
[0134] Step 701: Acquire the thermal infrared image of the scene to be detected.
[0135] Step 702: Obtain the corresponding temperature matrix based on the thermal infrared image, where each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image.
[0136] Step 703: Find the highest and lowest temperatures in the temperature matrix, calculate the difference between the highest and lowest temperatures, and determine whether the difference is greater than the preset first threshold. If it is greater, it is determined that there may be water leakage in the scene to be tested, and proceed to step 704.
[0137] If the difference is less than or equal to the preset first threshold, it is determined that there is no water leakage in the scene to be tested, and the process ends.
[0138] Generally, there is a temperature difference of 2 to 3 degrees Celsius or more between the leaking area and the surrounding area, which can be used to set the value of the first threshold.
[0139] Step 704: Remove temperatures that are less than the preset second threshold and greater than the preset third threshold from the temperature matrix, calculate the proportion of each temperature in the temperature matrix, remove temperatures whose proportion is less than the preset fourth threshold, and obtain the updated temperature matrix.
[0140] Step 705: Calculate the average temperature of the updated temperature matrix and find the highest and lowest temperatures in the updated temperature matrix.
[0141] Step 706: Determine if the following condition is met: the difference between the average temperature and the lowest temperature is greater than the difference between the highest temperature and the average temperature. If so, it is determined that there is a low-temperature water leakage in the scene to be tested, and proceed to step 708; otherwise, proceed to step 707.
[0142] Low-temperature leaks are generally caused by damage to pipes at room temperature or cold water, or by rainwater seepage, and often occur in kitchens, ceilings, or damaged parts of the building structure.
[0143] Step 707: Determine if the following condition is met: the difference between the highest temperature and the average temperature is greater than the difference between the average temperature and the lowest temperature. If so, it is determined that there is a high-temperature water leakage in the scene to be tested, and proceed to step 709; otherwise, end this process.
[0144] High-temperature leaks are usually caused by damage to hot water pipes, and often occur in places like bathrooms and underfloor heating systems.
[0145] Step 708: Use the lowest temperature of the temperature matrix as the lower limit of the low-temperature leakage area segmentation; calculate the upper limit of the low-temperature leakage area segmentation based on the lowest and average temperatures of the temperature matrix; find the connected region in the thermal infrared image whose temperature is between the lower limit and the upper limit of the low-temperature leakage area segmentation, and take this connected region as the low-temperature leakage area. This process ends.
[0146] In one optional embodiment, after finding a connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the low-temperature leakage region segmentation, and before designating that connected region as the low-temperature leakage region, the method further includes: for any found connected region, determining whether the area of the connected region is greater than a fifth threshold and less than a sixth threshold; if so, searching for sub-regions corresponding to each temperature level within the connected region; and if the area of any sub-region is less than a preset ninth threshold, considering that sub-region as noise; determining whether the number of non-noise sub-regions contained in the connected region is greater than a preset tenth threshold; if so, performing the action of designating the connected region as the low-temperature leakage region. Specifically, according to a preset segmentation level, the temperature between the lower and upper temperature limits of the low-temperature leakage region segmentation is divided into multiple temperature levels equal to the number of segmentation levels.
[0147] For any connected region found, if the area of the connected region is less than or equal to the fifth threshold or greater than or equal to the sixth threshold, the connected region is considered to be a noise point, that is, the connected region is definitely not a low-temperature leakage area, and the subsequent process is not performed on it.
[0148] In practical applications, after designating a connected region as a low-temperature leakage area, the process further includes: finding the lowest temperature point in the low-temperature leakage area, determining the lowest temperature point as the low-temperature leakage point, recording the location of the low-temperature leakage point, and indicating the location of the low-temperature leakage point to the user.
[0149] Step 709: Use the highest temperature in the temperature matrix as the upper limit of the temperature for segmenting the high-temperature leakage area; calculate the lower limit of the temperature for segmenting the high-temperature leakage area based on the highest and average temperatures in the temperature matrix; find a connected region in the thermal infrared image whose temperature is between the lower limit and the upper limit of the temperature for segmenting the high-temperature leakage area, and use this connected region as the high-temperature leakage area.
[0150] In one optional embodiment, after finding a connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before designating that connected region as the high-temperature leakage area, the method further includes: for any found connected region, determining whether the area of the connected region is greater than a seventh threshold and less than an eighth threshold; if so, searching for sub-regions corresponding to each temperature level within the connected region; and if the area of any sub-region is less than a preset eleventh threshold, considering that sub-region as noise; determining whether the number of non-noise sub-regions contained in the connected region is greater than a preset twelfth threshold; if so, performing the action of designating the connected region as the high-temperature leakage area. Specifically, according to a preset segmentation level, the temperature between the lower and upper temperature limits of the high-temperature leakage area segmentation is divided into multiple temperature levels equal to the segmentation level.
[0151] For any connected region found, if the area of the connected region is less than or equal to the seventh threshold or greater than or equal to the eighth threshold, the connected region is considered to be a noise point, that is, the connected region is definitely not a high-temperature water leakage area, and the subsequent process is not performed on it.
[0152] In practical applications, after designating a connected region as a high-temperature leakage area, the process further includes: finding the highest temperature point in the high-temperature leakage area, determining the highest temperature point as the high-temperature leakage point, recording the location of the high-temperature leakage point, and indicating the location of the high-temperature leakage point to the user.
[0153] This application also provides a method for detecting water leakage, including:
[0154] Step A: Obtain the thermal infrared image of the scene to be detected.
[0155] In one example, after obtaining the thermal infrared image, it can be first determined whether there is a leaking area. The highest and lowest temperatures of the pixels in the thermal infrared image are obtained, and a first highest temperature and a first lowest temperature are obtained respectively. It is determined whether the difference between the first highest temperature and the first lowest temperature is greater than a preset first threshold. If it is greater, step B is executed: determine the leaking area based on the temperature of each pixel in the thermal infrared image; otherwise, it is determined that there is no leaking area.
[0156] Step B: Determine the leakage area based on the temperature of each pixel in the thermal infrared image. The leakage area includes low-temperature leakage area or high-temperature leakage area. The temperature of the low-temperature leakage area gradually increases from the center to the edge, while the temperature of the high-temperature leakage area gradually decreases from the center to the edge.
[0157] In one example, the temperature of each pixel can be used to find areas in the scene to be detected where the temperature gradually increases from the center to the edge; if found, this area is identified as a low-temperature leaking area. Alternatively, the temperature of each pixel can be used to find areas in the scene to be detected where the temperature gradually decreases from the center to the edge; if found, this area is identified as a high-temperature leaking area. The temperature of each pixel in a thermal infrared image can be represented by a temperature matrix.
[0158] In one example, step B may include steps B1 and B2:
[0159] Step B1: Determine the type of leakage based on the temperature of each pixel in the thermal infrared image. The leakage types include low-temperature leakage and high-temperature leakage.
[0160] In one example, step B1 may include: Step B11, filtering out pixels in the thermal infrared image whose temperature is outside a preset temperature range to obtain filtered pixels, wherein the preset temperature threshold is set according to the temperature range of water. In another example, pixels corresponding to temperatures with a small percentage of total pixels may also be filtered out: calculating the percentage of pixels at each temperature relative to the total number of pixels, and filtering out pixels with a percentage below a preset fourth threshold. Step B12, calculating the average temperature of each filtered pixel, and obtaining the highest and lowest temperatures to obtain the second highest and second lowest temperatures. Step B13, if the first difference is greater than the second difference, a high-temperature leakage type is determined, wherein the first difference is the difference between the second highest temperature and the average temperature, and the second difference is the difference between the average temperature and the second lowest temperature. Step B14, if the second difference is greater than the first difference, a low-temperature leakage type is determined.
[0161] Step B2: Determine the leakage area based on the leakage type. For low-temperature leakage, the temperature gradually increases from the center to the edge of the low-temperature leakage area, while for high-temperature leakage, the temperature gradually decreases from the center to the edge of the high-temperature leakage area.
[0162] In one example, when the leakage type is low-temperature leakage, step B2 above includes steps B21, B22, and B23:
[0163] Step B21: Use the second lowest temperature as the lower limit of the low-temperature leakage area segmentation; calculate the upper limit of the low-temperature leakage area segmentation based on the second lowest temperature and the average temperature.
[0164] Step B22: In the thermal infrared image, determine the connected region between the lower temperature limit and the upper temperature limit of the low-temperature leakage area segmentation to obtain the first connected region.
[0165] In one example, the first connected regions with areas that are too large or too small can be filtered out: the first connected regions with areas that are not between the fifth threshold and the sixth threshold, where the sixth threshold is greater than the fifth threshold.
[0166] In one example, the first connected region can be further divided into sub-regions. For each first connected region, the following steps are performed: based on a preset division level, the temperature between the lower and upper temperature limits of the low-temperature leakage region is divided into multiple temperature levels equal to the division level; the sub-regions corresponding to each temperature level are determined in the first connected region; sub-regions with an area smaller than a preset ninth threshold are identified as noise points; it is determined whether the number of non-noise sub-regions contained in the first connected region is greater than a preset tenth threshold. If so, step B23 is executed: the first connected region is designated as a low-temperature leakage region; otherwise, the first connected region is filtered out.
[0167] In one example, the accuracy of detecting low-temperature leakage areas can be increased by detecting segments with continuously increasing temperatures. For each first connected region, the following steps are performed: determine the temperature curve from the lowest temperature point of the first connected region to the corner point of the outer rectangle of the first connected region to obtain a first temperature curve; determine whether there are segments with continuously increasing temperatures in the first temperature curve; if so, divide the temperature between the lower limit and the upper limit of the low-temperature leakage area into multiple temperature levels equal to the number of division levels according to a preset division level; if the number of temperature levels in the segments with continuously increasing temperatures is greater than a preset tenth threshold, then execute step B23: treat the first connected region as a low-temperature leakage area; otherwise, filter out the first connected region.
[0168] Step B23: Designate the first connected region as the low-temperature leakage region.
[0169] In the case of a high-temperature leakage, step B2 above includes steps B24, B25, and B26:
[0170] Step B24: Use the second highest temperature as the upper limit of the temperature for dividing the high-temperature leakage area; calculate the lower limit of the temperature for dividing the high-temperature leakage area based on the second highest temperature and the average temperature.
[0171] Step B25: In the thermal infrared image, determine the connected region between the lower and upper temperature limits of the high-temperature leakage area segmentation to obtain the second connected region.
[0172] In one example, second connected regions with areas that are too large or too small can be filtered out: second connected regions with areas that are not between the seventh threshold and the eighth threshold, where the eighth threshold is greater than the seventh threshold.
[0173] In one example, the second connected region can be further divided into sub-regions. For each pair of first connected regions, the following steps are performed: Before designating the second connected region as a high-temperature leakage region, the method further includes: dividing the temperature between the lower and upper temperature limits of the high-temperature leakage region into multiple temperature levels equal to the number of division levels, according to a preset division level; determining the sub-region corresponding to each temperature level in the second connected region; identifying sub-regions with an area smaller than a preset eleventh threshold as noise; determining whether the number of non-noise sub-regions contained in the second connected region is greater than a preset twelfth threshold; if so, executing step B26: designating the second connected region as a high-temperature leakage region; otherwise, filtering out the second connected region.
[0174] In one example, the accuracy of high-temperature leakage area detection can be increased by detecting segments with continuously decreasing temperatures. For each pair of first connected regions, the following steps are performed: determine the temperature curve from the highest temperature point of the second connected region to the corner point of the outer rectangle of the second connected region to obtain a second temperature curve; determine whether there are segments with continuously decreasing temperatures in the second temperature curve; if so, divide the temperature between the lower and upper temperature limits of the high-temperature leakage area into multiple temperature levels equal to the number of division levels according to a preset number of division levels; if the number of temperature levels in the segments with continuously decreasing temperatures is greater than a preset twelfth threshold, then the step is performed: the second connected region is regarded as a high-temperature leakage area.
[0175] Step B26: Designate the second connected region as the high-temperature leakage region.
[0176] In one example, the leakage area can also be displayed. The leakage detection method of this application embodiment further includes: step C1, displaying the leakage area in the image of the scene to be detected, wherein the leakage area displays multiple interconnected regions distributed in a nested manner, and different interconnected regions correspond to different temperature ranges.
[0177] The leakage area is displayed in the thermal infrared or visible light image of the scene to be detected, as shown in Figures 4a and 5a, for example.
[0178] In one example, the leakage area can also be displayed. The leakage detection method of this application embodiment further includes: step C2, displaying the leakage point of the leakage area in the image of the scene to be detected, wherein the leakage point of the low-temperature leakage area of the low-temperature leakage type is the lowest temperature point, and the leakage point of the high-temperature leakage area of the high-temperature leakage type is the highest temperature point.
[0179] The leakage point in the leakage area is displayed in the thermal infrared or visible light image of the scene to be detected, as shown in Figure 6.
[0180] In this embodiment, the type of leak (high-temperature or low-temperature) is determined based on the temperature of each pixel in the thermal infrared image. The leak area is then identified according to the leak type. For low-temperature leaks, the temperature gradually increases from the center to the edge; for high-temperature leaks, the temperature gradually decreases from the center to the edge. This approach does not simply identify areas with a temperature difference from the environment as leak areas. Instead, it detects low-temperature or high-temperature leaks based on the internal temperature variation patterns within the leak area, thus improving the accuracy of leak detection.
[0181] Figure 8 is a schematic diagram of a leakage detection device provided in an embodiment of this application. As shown in Figure 8, it mainly includes: a temperature data acquisition module 81 and a detection module 82, wherein:
[0182] The temperature data acquisition module 81 acquires the thermal infrared image of the scene to be detected and obtains the corresponding temperature matrix based on the thermal infrared image. Each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image.
[0183] The detection module 82 uses a temperature matrix to search for areas in the scene to be detected where the temperature gradually increases from the center to the edge. If such an area is found, it is determined to be a low-temperature leakage area. Alternatively, it uses a temperature matrix to search for areas in the scene to be detected where the temperature gradually decreases from the center to the edge. If such an area is found, it is determined to be a high-temperature leakage area.
[0184] In one optional embodiment, after the detection module 82 determines that the area is a low-temperature leakage area, it further includes: finding the lowest temperature point in the low-temperature leakage area and determining the lowest temperature point as the low-temperature leakage point; or, after determining that the area is a high-temperature leakage area, it further includes: finding the highest temperature point in the high-temperature leakage area and determining the highest temperature point as the high-temperature leakage point.
[0185] In one optional embodiment, after the detection module 82 obtains the corresponding temperature matrix based on the thermal infrared image, and before searching in the scene to be detected for either a region where the temperature gradually increases from the center to the edge, or a region where the temperature gradually decreases from the center to the edge, the method further includes: finding the highest and lowest temperatures in the temperature matrix, calculating the difference between the highest and lowest temperatures, determining whether the difference is greater than a preset first threshold, and if it is greater, determining that there may be a water leakage in the scene to be detected, and performing the action of searching in the scene to be detected for either a region where the temperature gradually increases from the center to the edge, or a region where the temperature gradually decreases from the center to the edge, using the temperature matrix.
[0186] In one optional embodiment, after the detection module 82 obtains the corresponding temperature matrix based on the thermal infrared image, and before searching in the scene to be detected for a region where the temperature gradually increases from the center to the edge, or searching in the scene to be detected for a region where the temperature gradually decreases from the center to the edge, the method further includes: calculating the average temperature of the temperature matrix, and searching for the highest and lowest temperatures in the temperature matrix; if the difference between the average temperature and the lowest temperature is greater than the difference between the highest temperature and the average temperature, then it is determined that there is a low-temperature water leakage phenomenon in the scene to be detected, and the action of searching in the scene to be detected for a region where the temperature gradually increases from the center to the edge is performed; if the difference between the highest temperature and the average temperature is greater than the difference between the average temperature and the lowest temperature, then it is determined that there is a high-temperature water leakage phenomenon in the scene to be detected, and the action of searching in the scene to be detected for a region where the temperature gradually decreases from the center to the edge is performed.
[0187] In one optional embodiment, after the detection module 82 obtains the corresponding temperature matrix based on the thermal infrared image and before calculating the average temperature of the temperature matrix, it further includes: removing temperatures that are less than a preset second threshold and greater than a preset third threshold from the temperature matrix to obtain an updated temperature matrix; or / and, based on the temperature matrix, calculating the proportion of each temperature in the temperature matrix, removing temperatures whose proportion is less than a preset fourth threshold from the temperature matrix to obtain an updated temperature matrix.
[0188] Furthermore, the detection module 82 calculates the average value of the temperature matrix and finds the highest and lowest temperatures in the temperature matrix, including: calculating the average value of the updated temperature matrix and finding the highest and lowest temperatures in the updated temperature matrix.
[0189] In one optional embodiment, the detection module 82 searches for regions in the scene to be detected by means of a temperature matrix, where the temperature gradually increases from the center to the edge. This includes: using the lowest temperature of the temperature matrix as the lower limit of the low-temperature leakage region segmentation; calculating the upper limit of the low-temperature leakage region segmentation based on the lowest temperature and the average temperature of the temperature matrix; and finding a connected region in the thermal infrared image whose temperature is between the lower limit and the upper limit of the low-temperature leakage region segmentation, and using this connected region as the low-temperature leakage region.
[0190] Alternatively, the detection module 82 can use the temperature matrix to find regions in the scene to be detected where the temperature gradually decreases from the center to the edge, including: using the highest temperature of the temperature matrix as the upper limit of the temperature for dividing the high-temperature leakage area; calculating the lower limit of the temperature for dividing the high-temperature leakage area based on the highest and average temperatures of the temperature matrix; and finding a connected region in the thermal infrared image where the temperature is between the lower and upper limits of the temperature for dividing the high-temperature leakage area, and using this connected region as the high-temperature leakage area.
[0191] In one optional embodiment, after the detection module 82 finds a connected region in the thermal infrared image whose temperature is located between the lower limit and the upper limit of the low-temperature leakage area segmentation, and before the connected region is designated as the low-temperature leakage area, the detection module 82 further includes: for any connected region found, determining whether the area of the connected region is greater than a fifth threshold and less than a sixth threshold; if so, then performing the action of designating the connected region as the low-temperature leakage area.
[0192] Alternatively, after the detection module 82 finds a connected region in the thermal infrared image whose temperature is located between the lower limit and the upper limit of the temperature in the high-temperature leakage area segmentation, and before identifying the connected region as the high-temperature leakage area, the detection module 82 further includes: for any connected region found, determining whether the area of the connected region is greater than the seventh threshold and less than the eighth threshold; if so, then performing the action of identifying the connected region as the high-temperature leakage area.
[0193] In one optional embodiment, after the detection module 82 finds a connected region in the thermal infrared image whose temperature is located between the lower limit and the upper limit of the low-temperature leakage region segmentation and before identifying the connected region as the low-temperature leakage region, the method further includes: dividing the temperature between the lower limit and the upper limit of the low-temperature leakage region segmentation into multiple temperature levels equal to the number of segmentation levels according to a preset number of segmentation levels; for each found connected region, searching for a sub-region corresponding to each temperature level in the connected region, and if the area of any sub-region is less than a preset ninth threshold, the sub-region is considered to be noise; determining whether the number of non-noise sub-regions contained in the connected region is greater than a preset tenth threshold; if so, then performing the action of identifying the connected region as the low-temperature leakage region.
[0194] Alternatively, after the detection module 82 finds a connected region in the thermal infrared image whose temperature is located between the lower and upper temperature limits of the high-temperature leakage area segmentation and before designating the connected region as the high-temperature leakage area, the process further includes: dividing the temperature between the lower and upper temperature limits of the high-temperature leakage area segmentation into multiple temperature levels equal to the number of segmentation levels, according to a preset number of segmentation levels; for any found connected region, searching for sub-regions corresponding to each temperature level within the connected region; and if the area of any sub-region is less than a preset eleventh threshold, then the sub-region is considered to be noise; determining whether the number of non-noise sub-regions contained in the connected region is greater than a preset twelfth threshold; if so, then performing the action of designating the connected region as the high-temperature leakage area.
[0195] This application also provides a non-transitory computer-readable storage medium that stores instructions that, when executed by a processor, cause the processor to perform the leakage detection method as described in any of the foregoing embodiments.
[0196] This application also provides an electronic device, which may be a camera, a hard disk recorder, or a personal computer. The electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0197] Memory, used to store computer programs;
[0198] The processor, when executing a program stored in memory, implements any of the water leakage detection methods described in this application.
[0199] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0200] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0201] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0202] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0203] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments and / or claims of this application can be combined and / or combined in various ways, and all such combinations and / or combinations fall within the scope of disclosure of this application.
[0204] This document uses specific embodiments to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for helping to understand the core ideas of this application and are not intended to limit this application. For those skilled in the art, changes can be made to the specific implementation methods and application scope based on the ideas, spirit and principles of this application. Any modifications, equivalent substitutions, improvements, etc., made should be included within the scope of protection of this application.
Claims
1. A method for detecting leaks, the method comprising: Acquire thermal infrared images of the scene to be detected; The corresponding temperature matrix is obtained from the thermal infrared image, where each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image. In the scene to be tested, the temperature matrix is used to search for areas where the temperature gradually increases from the center to the edge. If such areas are found, the area is identified as a low-temperature leakage area. Alternatively, the temperature matrix is used to search for areas where the temperature gradually decreases from the center to the edge. If such areas are found, the area is identified as a high-temperature leakage area.
2. The method according to claim 1, wherein, After determining that the area is a low-temperature leakage area, the method further includes: finding the lowest temperature point in the low-temperature leakage area and determining the lowest temperature point as the low-temperature leakage point; Alternatively, after identifying the area as a high-temperature leakage area, the process may further include: finding the highest temperature point within the high-temperature leakage area and identifying that point as the high-temperature leakage point.
3. The method according to claim 1, wherein, After obtaining the corresponding temperature matrix from the thermal infrared image, and before searching in the scene to be detected using the temperature matrix for regions where the temperature gradually increases from the center to the edge, or searching in the scene to be detected using the temperature matrix for regions where the temperature gradually decreases from the center to the edge, the process further includes: Find the highest and lowest temperatures in the temperature matrix, calculate the difference between the highest and lowest temperatures, and determine whether the difference is greater than a preset first threshold. If it is greater, it is determined that there may be water leakage in the scene to be detected, and then perform the action of finding, through the temperature matrix, a region in the scene to be detected where the temperature gradually increases from the center to the edge, or a region in the scene to be detected where the temperature gradually decreases from the center to the edge.
4. The method according to claim 3, wherein, After obtaining the corresponding temperature matrix from the thermal infrared image, and before searching in the scene to be detected using the temperature matrix for regions where the temperature gradually increases from the center to the edge, or searching in the scene to be detected using the temperature matrix for regions where the temperature gradually decreases from the center to the edge, the process further includes: Calculate the average temperature of the temperature matrix and find the highest and lowest temperatures in the temperature matrix. If the difference between the average temperature and the lowest temperature is greater than the difference between the highest temperature and the average temperature, it is determined that there is a low-temperature water leakage phenomenon in the scene to be detected. Then, perform the action of finding the area in the scene to be detected by the temperature matrix that gradually increases in temperature from the center to the edge. If the difference between the highest temperature and the average temperature is greater than the difference between the average temperature and the lowest temperature, it is determined that there is a high-temperature water leakage in the scene to be tested, and the action of searching for the area where the temperature gradually decreases from the center to the edge in the scene to be tested through the temperature matrix is performed.
5. The method according to claim 4, wherein, After obtaining the corresponding temperature matrix from the thermal infrared image and before calculating the average temperature of the temperature matrix, the process further includes: Temperatures below a preset second threshold and above a preset third threshold are removed from the temperature matrix to obtain an updated temperature matrix; or / and, the proportion of each temperature in the temperature matrix is calculated based on the temperature matrix, and temperatures with a proportion below a preset fourth threshold are removed from the temperature matrix to obtain an updated temperature matrix. Furthermore, the calculation of the average value of the temperature matrix and the search for the highest and lowest temperatures within the temperature matrix include: Calculate the average value of the updated temperature matrix, and then find the highest and lowest temperatures within the updated temperature matrix.
6. The method according to claim 4 or 5, wherein, The process of finding regions in the scene to be detected by using a temperature matrix, where the temperature gradually increases from the center to the edge, includes: The lowest temperature in the temperature matrix is used as the lower limit of the low-temperature leakage area segmentation; the upper limit of the low-temperature leakage area segmentation is calculated based on the lowest and average temperatures in the temperature matrix; a connected region with a temperature between the lower and upper limits of the low-temperature leakage area segmentation is found in the thermal infrared image, and this connected region is used as the low-temperature leakage area. Alternatively, the step of finding regions in the scene to be detected by means of a temperature matrix that gradually decreases in temperature from the center to the edge includes: taking the highest temperature of the temperature matrix as the upper limit of the temperature for dividing the high-temperature leakage region; calculating the lower limit of the temperature for dividing the high-temperature leakage region based on the highest temperature and the average temperature of the temperature matrix; and finding a connected region in the thermal infrared image whose temperature is between the lower limit and the upper limit of the temperature for dividing the high-temperature leakage region, and taking this connected region as the high-temperature leakage region.
7. The method according to claim 6, wherein, After finding the connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the low-temperature leakage area segmentation, and before defining this connected region as the low-temperature leakage area, the process further includes: For any connected region found, determine whether the area of the connected region is greater than the fifth threshold and less than the sixth threshold. If so, execute the action of treating the connected region as a low-temperature leakage area. Alternatively, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before identifying this connected region as the high-temperature leakage area, the process further includes: For any connected region found, determine whether the area of the connected region is greater than the seventh threshold and less than the eighth threshold. If so, execute the action of treating the connected region as a high-temperature leakage area.
8. The method according to claim 6, wherein, After finding the connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the low-temperature leakage area segmentation, and before defining this connected region as the low-temperature leakage area, the process further includes: According to the preset segmentation level, the temperature between the lower limit and the upper limit of the low temperature leakage area is divided into multiple temperature levels equal to the segmentation level; for each connected region found, the sub-regions corresponding to each temperature level are searched in the connected region, and if the area of any sub-region is less than the preset ninth threshold, the sub-region is considered to be noise. It is determined whether the number of non-noise sub-regions contained in the connected region is greater than the preset tenth threshold. If so, the action of treating the connected region as a low temperature leakage area is performed. Alternatively, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before identifying this connected region as the high-temperature leakage area, the process further includes: According to the preset segmentation level, the temperature between the lower and upper temperature limits of the high-temperature leakage area is divided into multiple temperature levels equal to the segmentation level. For any connected region found, a sub-region corresponding to each temperature level is searched within the connected region. If the area of any sub-region is less than the preset eleventh threshold, the sub-region is considered to be noise. It is then determined whether the number of non-noise sub-regions contained in the connected region is greater than the preset twelfth threshold. If so, the action of treating the connected region as a high-temperature leakage area is performed.
9. The method according to claim 6, wherein, After finding the connected region in the thermal infrared image whose temperature falls between the lower and upper temperature limits of the low-temperature leakage area segmentation, and before defining this connected region as the low-temperature leakage area, the process further includes: Determine the temperature curve from the lowest temperature point of the connected region to the corner point of the outer rectangle of the connected region; determine whether there are segments with continuously increasing temperature in the temperature curve of the connected region; if so, divide the temperature between the lower limit and the upper limit of the low temperature leakage area into multiple temperature levels equal to the number of division levels according to the preset division level; if the number of temperature levels in the segments with continuously increasing temperature is greater than the preset tenth threshold, then execute the action of treating the connected region as a low temperature leakage area. Alternatively, after finding a connected region in the thermal infrared image whose temperature lies between the lower and upper temperature limits of the high-temperature leakage area segmentation, and before identifying this connected region as the high-temperature leakage area, the process further includes: Determine the temperature curve from the highest temperature point in the connected region to the corner point of the outer rectangle of the connected region; determine whether there are segments in the temperature curve of the connected region where the temperature continuously decreases; if so, divide the temperature between the lower and upper temperature limits of the high-temperature leakage area into multiple temperature levels equal to the number of division levels, according to the preset division level; if the number of temperature levels in the segment where the temperature continuously decreases is greater than the preset twelfth threshold, then execute the action of treating the connected region as a high-temperature leakage area.
10. A leak detection device, the device comprising: The temperature data acquisition module acquires the thermal infrared image of the scene to be detected and obtains the corresponding temperature matrix based on the thermal infrared image. Each temperature data in the temperature matrix corresponds to the temperature of a pixel in the thermal infrared image. The detection module uses a temperature matrix to search for areas in the scene to be tested where the temperature gradually increases from the center to the edge. If such an area is found, it is determined to be a low-temperature leakage area. Alternatively, it uses a temperature matrix to search for areas in the scene to be tested where the temperature gradually decreases from the center to the edge. If such an area is found, it is determined to be a high-temperature leakage area.
11. A method for detecting leaks, the method comprising: Acquire thermal infrared images of the scene to be detected; Based on the temperature of each pixel in the thermal infrared image, the leakage area is determined, wherein the leakage area includes a low-temperature leakage area or a high-temperature leakage area. The temperature of the low-temperature leakage area gradually increases from the center to the edge, and the temperature of the high-temperature leakage area gradually decreases from the center to the edge.
12. The method according to claim 11, wherein, The method further includes: The leaking area is displayed in the image of the scene to be detected. The leaking area shows multiple interconnected regions distributed in a nested manner, and different interconnected regions correspond to different temperature ranges.
13. The method according to claim 11, wherein, The method further includes: The leakage points of the leakage area are displayed in the image of the scene to be detected. The leakage points of the low-temperature leakage area of the low-temperature leakage type are the lowest temperature points, and the leakage points of the high-temperature leakage area of the high-temperature leakage type are the highest temperature points.
14. The method according to claim 11, wherein, Before determining the leakage area based on the temperature of each pixel in the thermal infrared image, the method further includes: The highest and lowest temperatures in the thermal infrared image are obtained, and the first highest temperature and the first lowest temperature are obtained respectively. Determine whether the difference between the first highest temperature and the first lowest temperature is greater than a preset first threshold. If it is greater, proceed to step: determine the leakage area based on the temperature of each pixel in the thermal infrared image; otherwise, determine that there is no leakage area.
15. The method according to claim 11, wherein, The step of determining the leakage area based on the temperature of each pixel in the thermal infrared image includes: Pixels in the thermal infrared image whose temperature is outside the preset temperature range are filtered out to obtain the filtered pixels. The preset temperature threshold is set according to the temperature range of the water. Calculate the average temperature of each pixel after filtering, and obtain the highest and lowest temperatures to get the second highest and second lowest temperatures; If the first difference is greater than the second difference, it is determined that there is a high-temperature leakage type, wherein the first difference is the difference between the second highest temperature and the average temperature, and the second difference is the difference between the average temperature and the second lowest temperature. If the second difference is greater than the first difference, then it is determined that there is a low-temperature leakage type. Determine the area of leakage based on the type of leakage.
16. The method according to claim 15, wherein, Before calculating the average temperature of each of the filtered pixels and obtaining the highest and lowest temperatures to obtain the second highest and second lowest temperatures, the method further includes: Calculate the percentage of pixels at each temperature in the total number of pixels, and filter out pixels with a percentage lower than the preset fourth threshold.
17. The method according to claim 15, wherein, The process of determining the leakage area based on the type of leakage includes: In the case where the leakage type is low-temperature leakage, the second lowest temperature is used as the lower limit of the low-temperature leakage area segmentation; the upper limit of the low-temperature leakage area segmentation is calculated based on the second lowest temperature and the average temperature; a connected region with a temperature between the lower limit and the upper limit of the low-temperature leakage area segmentation is determined in the thermal infrared image to obtain a first connected region; the first connected region is used as the low-temperature leakage area. Alternatively, if the leakage type is a high-temperature leakage type, the second highest temperature is used as the upper temperature limit for dividing the high-temperature leakage area; the lower temperature limit for dividing the high-temperature leakage area is calculated based on the second highest temperature and the average temperature; a connected region with a temperature between the lower temperature limit and the upper temperature limit of the high-temperature leakage area is determined in the thermal infrared image to obtain a second connected region; the second connected region is used as the high-temperature leakage area.
18. The method according to claim 17, wherein, Before identifying the first connected region as a low-temperature leakage region, the method further includes: filtering out the first connected region whose area is not between a fifth threshold and a sixth threshold, wherein the sixth threshold is greater than the fifth threshold; Alternatively, before identifying the second connected region as a high-temperature leakage region, the method further includes filtering out the second connected region whose area is not between the seventh threshold and the eighth threshold, wherein the eighth threshold is greater than the seventh threshold.
19. The method of claim 17, wherein, Before designating the first connected region as a low-temperature leakage region, the method further includes: dividing the temperature between the lower limit and the upper limit of the low-temperature leakage region into multiple temperature levels equal to the number of division levels according to a preset division level; determining a sub-region corresponding to each temperature level in the first connected region; identifying sub-regions with an area smaller than a preset ninth threshold as noise points; determining whether the number of non-noise sub-regions contained in the first connected region is greater than a preset tenth threshold; if so, then executing the step: designating the first connected region as a low-temperature leakage region. Alternatively, before designating the second connected region as a high-temperature leakage region, the method further includes: dividing the temperature between the lower and upper temperature limits of the high-temperature leakage region into multiple temperature levels equal to the number of division levels, according to a preset division level; determining a sub-region corresponding to each temperature level in the second connected region; identifying sub-regions with an area smaller than a preset eleventh threshold as noise points; determining whether the number of non-noise sub-regions contained in the second connected region is greater than a preset twelfth threshold; if so, then executing the step: designating the second connected region as a high-temperature leakage region.
20. The method of claim 17, wherein, Before designating the first connected region as a low-temperature leakage region, the method further includes: determining a temperature curve from the lowest temperature point of the first connected region to the corner point of the outer rectangle of the first connected region to obtain a first temperature curve; determining whether there are segments with continuously increasing temperatures in the first temperature curve; if so, dividing the temperature between the lower limit and the upper limit of the low-temperature leakage region into multiple temperature levels equal to the number of division levels according to a preset division level; if the number of temperature levels in the segments with continuously increasing temperatures is greater than a preset tenth threshold, then the step of designating the first connected region as a low-temperature leakage region is executed. Alternatively, before designating the second connected region as a high-temperature leakage region, the method further includes: determining a temperature curve from the highest temperature point of the second connected region to the corner point of the outer rectangle of the second connected region to obtain a second temperature curve; determining whether there are segments in the second temperature curve where the temperature continuously decreases; if so, dividing the temperature between the lower limit and the upper limit of the high-temperature leakage region into multiple temperature levels equal to the number of division levels according to a preset division level; if the number of temperature levels in the segments where the temperature continuously decreases is greater than a preset twelfth threshold, then the step of designating the second connected region as a high-temperature leakage region is executed.
21. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the leakage detection method as described in any one of claims 1-9 or 11-20.
22. An electronic device comprising a processor, a communication interface, a memory, and a communication bus, wherein, The processor, communication interface, and memory communicate with each other through a communication bus; Memory, used to store computer programs; The processor, when executing a program stored in memory, implements the leakage detection method according to any one of claims 1-9 or 11-20.