Infrared gas shape leakage detection method based on anisotropic diffusion and contour clustering
Through the infrared gas shape leakage detection method based on anisotropic diffusion and contour clustering, the problem of insufficient detection accuracy and response speed in the prior art is solved, and the accurate detection and labeling of gas leakage areas is realized, which is suitable for gas pipelines Maintenance and safe storage of chemical raw materials.
Patent Information
- Application Number
- CN202411190419.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art has insufficient detection accuracy and response speed in gas leakage detection, making it difficult to cope with complex environments and variable situations of gas leakage, and the generalization ability of deep learning technology in different scenarios is unstable.
The infrared gas shape leakage detection method based on anisotropic diffusion and contour clustering is adopted to achieve the accuracy of the gas leakage area through background subtraction and morphological fusion, filtering processing, edge feature extraction, binarization and clustering analysis of infrared video. Detection and labeling.
It improves the accuracy and real-time nature of gas leakage detection, enhances the ability to respond to complex backgrounds and variable environments, and improves the reliability and practicality of detection.
Smart Images

Figure CN119131655A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of infrared visual image target detection, and in particular relates to an infrared gas shape leakage detection method based on anisotropic diffusion and contour clustering. Background Art
[0002] With the rapid development of the petrochemical industry, a large amount of gas is used as raw materials and products in the chemical production process. Most industrial raw materials are flammable, explosive and toxic gases, so the safe storage of gas raw materials has become a problem that companies and governments urgently need to solve. Traditional non-contact gas detection technology requires contact or proximity to the gas, so its detection range is small, making it difficult to quickly determine the location of the leak point, and there are also hidden dangers to the personal safety of technicians. In contrast, gas detection technology based on infrared imaging can visualize and monitor leaking gas at a long distance and over a large area, which is suitable for wide-area monitoring and easy to trace and analyze.
[0003] Research on gas leak detection is divided into traditional methods and methods based on deep learning. Traditional detection methods rely on image processing technology and feature extraction. Image preprocessing uses methods such as filtering, binarization and morphological operations to remove noise to improve image quality; foreground extraction uses Gaussian mixture models, background restoration and frame difference variance to separate foreground and background; feature screening is based on motion, shape and texture features, using directional gradient histogram (HOG), support vector machine (SVM) and scale-invariant feature transform (SIFT) to detect gas leaks. However, traditional technologies have challenges in detection accuracy, false recognition rate and response speed, and are difficult to cope with complex environments and changing gas leaks.
[0004] The deep learning detection method does not require manual feature extraction and can directly detect and locate images or videos. Models such as convolutional neural networks (CNN), generative adversarial networks (GAN) and U-net have shown good detection accuracy and generalization performance in gas leak detection. For example, in terms of gas leak video detection, GasNet and VideoGasNet performed well, while YOLOv4 also had obvious advantages in detection accuracy and response speed. However, deep learning technology requires a large amount of training data, and its generalization ability in different scenarios is not stable.
[0005] Therefore, developing a technology that can improve detection accuracy and real-time performance, effectively cope with complex backgrounds and changing environments, and improve the reliability and practicality of gas leak detection has become an urgent problem to be solved. Summary of the invention
[0006] The object of the present invention is to provide an infrared gas shape leak detection method based on anisotropic diffusion and contour clustering to solve the above-mentioned technical problems.
[0007] In order to solve the above technical problems, the present invention provides an infrared gas shape leak detection method based on anisotropic diffusion and contour clustering, and the specific technical solution is as follows:
[0008] An infrared gas shape leak detection method based on anisotropic diffusion and contour clustering, characterized in that it specifically includes the following steps:
[0009] Step S1, performing background subtraction and morphological fusion on the collected infrared video, and performing enhancement processing to obtain a gas enhanced image;
[0010] Step S2: Perform visual contour area delineation and annotation on the enhanced gas-enhanced image based on contour analysis and clustering.
[0011] The step S1 specifically includes the following steps:
[0012] Step S11, performing preprocessing operations on the collected infrared video;
[0013] Step S12, filtering the grayscale processed image to obtain a filtered image;
[0014] Step S13, extracting edge features to obtain edge images;
[0015] Step S14, generating a binary image using a binarization method;
[0016] Step S15, fusing the images to obtain a gas-enhanced image.
[0017] The step S11 specifically includes the following steps:
[0018] First, the acquired infrared video is read frame by frame, and each frame is grayscaled and histogram equalized as the input of anisotropic filtering.
[0019] The step S12 specifically includes the following steps:
[0020] Step S121, image data type conversion:
[0021] Convert the input infrared image data from raw format to a floating point matrix. This conversion normalizes the image data into a format suitable for precise mathematical operations:
[0022] I (0) =I origin (1)
[0023] I (0) Represents infrared image data converted into matrix format, I origin Indicates original red
[0024] External image data;
[0025] Step S122, image gradient calculation and diffusion coefficient adjustment:
[0026] Perform iterative calculations on floating-point matrices. Each iteration consists of the following operations:
[0027] c) Gradient calculation: Calculate the gradient of the image in the horizontal and vertical directions to capture the changes in the image;
[0028] The gradient calculation formula is as follows:
[0029]
[0030]
[0031] in, and Respectively represent the gradient of the image in the horizontal and vertical directions, i represents the i-th row of the image, j represents the j-th column of the image, I(i, j) represents the grayscale value of the pixel in the i-th row and j-th column of the image, and the modulus length of the image gradient is calculated as:
[0032]
[0033] d) Diffusion coefficient adjustment: adjust the diffusion coefficient according to the calculated image gradient modulus. The diffusion coefficient calculation formula is:
[0034]
[0035] in, Represents the modulus of the image gradient, K is the constant of the diffusion coefficient, and this adjustment coefficient is used to balance the smoothness of the image and the retention of edge details;
[0036] Step S123, iterative update and image smoothing:
[0037] Through continuous iterative updates, a smooth image with edge details preserved is obtained;
[0038] d) Gradient difference calculation: Calculate the image gradient difference in the north, south, east and west directions:
[0039]
[0040] e ) Calculate the diffusion coefficient: Calculate the diffusion coefficient in each direction based on the gradient difference:
[0041]
[0042] f) Image update: Apply the diffusion coefficient to update the image to smooth the image and preserve edge details.
[0043] The update formula is:
[0044]
[0045] in: Respectively represent the gradient differences in the north, south, east, and west directions, c N 、c S 、c E 、c W is the diffusion coefficient in the corresponding direction, and λ is the time step.
[0046] The step S13 specifically includes the following steps:
[0047] The filtered image obtained in step S12 is used as input, and edge information in the image is extracted through a frame difference operation. The frame difference operation generates an image highlighting the edge area by calculating the pixel differences between adjacent frames, while removing irrelevant internal texture information.
[0048] The step S14 obtains the binarized image after the adaptive threshold processing, which specifically includes the following steps:
[0049] Threshold processing is performed on the grayscale image to convert it into a binary image. By setting an appropriate threshold, pixels above the threshold are set to white to represent possible smoke areas, and pixels below the threshold are set to black to represent the background.
[0050] The step S15 specifically includes the following steps:
[0051] The weights α and β are set, and the edge image obtained by anisotropic filtering is fused with the binary image obtained by threshold processing to obtain the enhanced infrared gas image. The specific fusion method is shown in the following formula:
[0052] I enhanced (x, y) = α·I aniso (x, y)+β·I binary (x,y) (9)
[0053] Among them, I enhanced is the enhanced infrared gas image, I aniso is the edge image, I binary is a binary image.
[0054] The step S2 specifically includes the following steps:
[0055] Step S21, obtaining a grayscale image of the main motion area:
[0056] Input the infrared gas enhanced image obtained in step S1, apply a background subtraction operation, and then perform dilation and erosion processing on the foreground mask image to extract a grayscale image of the main motion area;
[0057] Step S22, clustering and distinguishing the grayscale images of gas and non-gas regions:
[0058] Perform cluster analysis on the grayscale image of the main motion area obtained in step S21 to distinguish between gas areas and non-gas areas;
[0059] Step S23, obtaining the final gas detection image:
[0060] Irregularity determination and time weight analysis are performed on the gas area and non-gas area distinguished in step S22, and the interference of the non-gas area is eliminated, and the gas area is identified and marked, so as to finally generate a gas detection image.
[0061] The advantages of the present invention are: the present invention can accurately realize precise detection and marking of gas leakage areas, improve the reliability and practicality of traditional gas leakage detection methods, can effectively cope with complex backgrounds and changing environments, and is suitable for gas pipeline maintenance, safe storage of chemical raw materials, gas emission detection and other fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a flow chart of the infrared gas shape leak detection method based on anisotropic diffusion and contour clustering of the present invention;
[0063] Figure 2 is a schematic diagram of an original grayscale image and a filtered image selected in an embodiment of the present invention (the left figure is the original grayscale image, and the right figure is the filtered image);
[0064] Figure 3 Schematic diagram of an edge image and a binarized image obtained in an embodiment of the present invention (the left figure is an edge image, and the right figure is a binarized image);
[0065] Figure 4 is a schematic diagram of a gas enhancement image obtained in an embodiment of the present invention;
[0066] Figure 5 is a schematic diagram of a grayscale image of a main motion area obtained in an embodiment of the present invention;
[0067] Figure 6 is a schematic diagram of a grayscale image of a main motion area obtained in an embodiment of the present invention after being divided into clusters;
[0068] Figure 7 It is a diagram of the final gas detection result in the embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to better understand the purpose, structure and function of the present invention, the following is a further detailed description of the infrared gas shape leak detection method based on anisotropic diffusion and contour clustering of the present invention in conjunction with the accompanying drawings.
[0070] like Figure 1 As shown, the infrared gas shape leakage detection method based on anisotropic diffusion and contour clustering of the present invention comprises the following steps:
[0071] Step S1: performing background subtraction and morphological fusion on the collected infrared video, and performing enhancement processing to obtain a gas enhanced image;
[0072] Step S11, preprocessing the captured infrared video to improve image contrast and details:
[0073] like Figure 2 As shown, the captured infrared video is first read frame by frame, and each frame is grayed and histogram equalized to improve image contrast and details as the input of anisotropic filtering;
[0074] Step S12, filtering the grayscale processed image to obtain a filtered image:
[0075] Step S121, image data type conversion:
[0076] Convert the input infrared image data from raw format to a floating point matrix for subsequent gradient calculation and anisotropic diffusion operations. Through this conversion, the image data is normalized into a format suitable for precise mathematical operations:
[0077] I (0) =I origin (1)
[0078] Step S122, image gradient calculation and diffusion coefficient adjustment:
[0079] Perform iterative calculations on floating-point matrices. Each iteration consists of the following operations:
[0080] a) Gradient calculation: Calculate the gradient of the image in the horizontal and vertical directions to capture the changes in the image. The gradient calculation formula is as follows:
[0081]
[0082]
[0083] in, and Represent the gradient of the image in the horizontal and vertical directions respectively. The modulus of the image gradient is calculated as:
[0084]
[0085] b) Diffusion coefficient adjustment: According to the calculated image gradient modulus, the diffusion coefficient is adjusted to control the image smoothing process and retain edge features. The diffusion coefficient calculation formula is:
[0086]
[0087] in, Represents the modulus of the image gradient, and K is the constant of the diffusion coefficient. This adjustment coefficient is used to balance the smoothness of the image and the retention of edge details;
[0088] Step S123, iterative update and image smoothing:
[0089] Through continuous iterative updates, a smooth image with edge details preserved is obtained;
[0090] a) Gradient difference calculation: Calculate the image gradient difference in each direction (north, south, east, west):
[0091]
[0092] b) Calculate the diffusion coefficient: Calculate the diffusion coefficient in each direction based on the gradient difference:
[0093]
[0094] c) Image update: Apply the diffusion coefficient to update the image to smooth the image and retain edge details. The update formula is:
[0095]
[0096] in: Respectively represent the gradient differences in the north, south, east, and west directions, c N 、c S 、c E 、c W is the diffusion coefficient in the corresponding direction, and λ is the time step.
[0097] Step S13, extract edge features to obtain edge images:
[0098] like Figure 3 As shown, the filtered image obtained in step S12 is used as input, and the edge information in the image is extracted by frame difference operation to exclude internal texture features. The frame difference operation generates an image that highlights the edge area by calculating the pixel differences between adjacent frames, while effectively removing irrelevant internal texture information and enhancing the visibility of the edge contour.
[0099] Step S14, generating a binary image using a binarization method,
[0100] like Figure 3 As shown in the figure, the grayscale image is thresholded and converted into a binary image to highlight the potential smoke area. This step sets the pixels above the threshold to white (indicating the possible smoke area) and the pixels below the threshold to black (indicating the background) by setting an appropriate threshold. The resulting binary image significantly enhances the possible smoke area and provides a clear target area for subsequent image fusion and morphological processing.
[0101] Step S15, fusing the images to obtain a gas-enhanced image:
[0102] like Figure 4 As shown, weights α and β are set, and the edge image obtained by anisotropic filtering is fused with the binary image obtained by threshold processing to obtain an enhanced infrared gas image. The specific fusion method is shown in the following formula:
[0103] I enhanced (x, y) = α·I aniso (x, y)+β·I binary (x,y) (9)
[0104] Among them, I enhanced is the enhanced infrared gas image, I aniso is the edge image, I binary is a binary image.
[0105] Step S2, performing visual contour area delineation and annotation on the enhanced gas-enhanced image based on contour analysis and clustering.
[0106] Step S21, obtaining a grayscale image of the main motion area:
[0107] like Figure 5 As shown, the infrared gas enhanced image obtained by step S1 is input and the background subtraction operation is applied. Then, the foreground mask image is dilated and eroded to extract the grayscale image of the main motion area;
[0108] Step S22, clustering and distinguishing the grayscale images of gas and non-gas regions:
[0109] like Figure 6 As shown, the grayscale image of the main motion area obtained in step S21 is clustered to distinguish the gas area from the non-gas area. The clustering method is used to divide the motion area into different categories, which is convenient for the subsequent accurate identification of the gas diffusion area;
[0110] Step S23, obtaining the final gas detection image:
[0111] like Figure 7As shown, irregularity determination and time weight analysis are performed on the gas area and non-gas area distinguished in step S22. By eliminating interference from the non-gas area and identifying and marking the gas area, a gas detection image is finally generated.
[0112] It can be understood that the present invention is described in detail through several embodiments, and those skilled in the art can make various changes or equivalent substitutions to these features and embodiments without departing from the basic spirit and scope of the present invention. In addition, according to the guidance of the present invention, technicians can modify these features and embodiments according to specific circumstances without departing from the core idea of the present invention. Therefore, the protection scope of the present invention is not limited to the specific embodiments, and all implementation schemes that meet the scope of the claims of this application belong to the protection scope of the present invention. All technical contents requested for protection have been described in detail in the claims. Within the scope of the technical concept of the present invention, any modification and improvement of the technical solution of the present invention should be deemed to be within the protection scope of the present invention.
Claims
1. An infrared gas shape leak detection method based on anisotropic diffusion and contour clustering, characterized in that: The specific steps include: Step S1, performing background subtraction and morphological fusion on the collected infrared video, and performing enhancement processing to obtain a gas enhanced image; Step S2: Perform visual contour area delineation and annotation on the enhanced gas-enhanced image based on contour analysis and clustering.
2. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 1 is characterized in that: The step S1 specifically includes the following steps: Step S11, performing preprocessing operations on the collected infrared video; Step S12, filtering the grayscale processed image to obtain a filtered image; Step S13, extracting edge features to obtain edge images; Step S14, generating a binary image using a binarization method; Step S15, fusing the images to obtain a gas-enhanced image.
3. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 2 is characterized in that: The step S11 specifically includes the following steps: First, the acquired infrared video is read frame by frame, and each frame is grayscaled and histogram equalized as the input of anisotropic filtering.
4. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 2 is characterized in that: The step S12 specifically includes the following steps: Step S121, image data type conversion: Convert the input infrared image data from raw format to a floating point matrix. This conversion normalizes the image data into a format suitable for precise mathematical operations: I (0) =I origin (1) I (0) Represents infrared image data converted into matrix format, I origin Represents the raw infrared image data; Step S122, image gradient calculation and diffusion coefficient adjustment: Perform iterative calculations on floating-point matrices. Each iteration consists of the following operations: a) Gradient calculation: Calculate the gradient of the image in the horizontal and vertical directions to capture the changes in the image; The gradient calculation formula is as follows: in, and Respectively represent the gradients of the image in the horizontal and vertical directions, i represents the i-th row of the image, j represents the j-th column of the image, I(i,j) represents the grayscale value of the pixel in the i-th row and j-th column of the image, and the modulus length of the image gradient is calculated as: b) Diffusion coefficient adjustment: According to the calculated image gradient modulus, the diffusion coefficient is adjusted. The diffusion coefficient calculation formula is: in, Represents the modulus of the image gradient, K is the constant of the diffusion coefficient, and this adjustment coefficient is used to balance the smoothness of the image and the retention of edge details; Step S123, iterative update and image smoothing: Through continuous iterative updates, a smooth image with edge details preserved is obtained; a) Gradient difference calculation: Calculate the image gradient difference in the north, south, east and west directions: b) Calculate the diffusion coefficient: Calculate the diffusion coefficient in each direction based on the gradient difference: c) Image update: Apply the diffusion coefficient to update the image to smooth the image and preserve edge details. The update formula is: in: Respectively represent the gradient differences in the north, south, east, and west directions, c N 、c S 、c E 、c W is the diffusion coefficient in the corresponding direction, and λ is the time step.
5. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 2 is characterized in that: The step S13 specifically includes the following steps: The filtered image obtained in step S12 is used as input, and edge information in the image is extracted through a frame difference operation. The frame difference operation generates an image highlighting the edge area by calculating the pixel differences between adjacent frames, while removing irrelevant internal texture information.
6. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 2 is characterized in that: The step S14 obtains the binarized image after the adaptive threshold processing, which specifically includes the following steps: Threshold processing is performed on the grayscale image to convert it into a binary image. By setting an appropriate threshold, pixels above the threshold are set to white to represent possible smoke areas, and pixels below the threshold are set to black to represent the background.
7. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 2 is characterized in that: The step S15 specifically includes the following steps: The weights α and β are set, and the edge image obtained by anisotropic filtering is fused with the binary image obtained by threshold processing to obtain the enhanced infrared gas image. The specific fusion method is shown in the following formula: I enhanced (x,y)=α·I aniso (x,y)+β·I binary (x,y) (9) Among them, I enhanced is the enhanced infrared gas image, I aniso is the edge image, I binary is a binary image.
8. The infrared gas shape leak detection method based on anisotropic diffusion and contour clustering according to claim 1 is characterized in that: The step S2 specifically includes the following steps: Step S21, obtaining a grayscale image of the main motion area: Input the infrared gas enhanced image obtained in step S1, apply a background subtraction operation, and then perform dilation and erosion processing on the foreground mask image to extract a grayscale image of the main motion area; Step S22, clustering and distinguishing the grayscale images of gas and non-gas regions: Perform cluster analysis on the grayscale image of the main motion area obtained in step S21 to distinguish between gas areas and non-gas areas; Step S23, obtaining the final gas detection image: Irregularity determination and time weight analysis are performed on the gas area and non-gas area distinguished in step S22, and the interference of the non-gas area is eliminated, and the gas area is identified and marked, so as to finally generate a gas detection image.
Citation Information
Patent Citations
Gas infrared image enhancing method based on anisotropic diffusion
CN102609906A
Infrared video detection method for dangerous gas leakage under moving target low contrast
CN108921878A
Gas infrared video enhancement method and device and storage medium
CN109727202A
System and method for quantifying a gas leak
CN111033231A
Gas leakage detection method and system based on infrared thermal imaging
CN111325721A
