A method for detecting tiny gas leaks based on infrared visual image target detection
Through the guide filter and visual background extractor based on infrared visual image, the problem of difficulty in positioning gas leakage in traditional contact sensors is solved, and accurate detection and visual monitoring of micro gas leakage is achieved.
Patent Information
- Application Number
- CN202310315541.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2043-03-28
AI Technical Summary
Traditional contact sensors are difficult to quickly locate the gas leakage location and pose a threat to the personal safety of technicians. Non-contact gas leakage detection technology is still in a stage of urgent development.
The micro-gas leakage detection method based on infrared visual image object detection is adopted, and the infrared image gas enhancement process is performed through the guide filter, and the gas target detection is performed using a visual background extractor.
It realizes accurate detection of micro gas leakage and can provide wide applications in the fields of gas transportation pipeline maintenance, safe storage of chemical raw materials, and gas emission detection.
Smart Images

Figure CN116429720B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of infrared visual image target detection, and in particular relates to a tiny gas leakage detection method based on infrared visual image target detection. Background Art
[0002] With the rapid development of the petrochemical industry, a large amount of gas is widely used in the chemical production process as raw materials and products. Most industrial raw materials are flammable, explosive and toxic gases. The storage safety of gas raw materials has become an urgent problem that enterprises and governments need to solve.
[0003] Traditional contact sensor detection technology must be in contact with or close to the gas, so it can only search in a small area. It is difficult to quickly locate the gas leak and poses a threat to the personal safety of technicians. Non-contact gas leak detection and location technology is still in urgent need. Therefore, the development of a large-scale, high-efficiency, visual and all-day real-time monitoring gas detection technology has become an urgent problem to be solved. Summary of the invention
[0004] The purpose of the present invention is to provide a method for detecting small gas leaks based on infrared visual image target detection to solve the above-mentioned technical problems.
[0005] In order to solve the above technical problems, the specific technical solution of a method for detecting small gas leaks based on infrared visual image target detection of the present invention is as follows:
[0006] A method for detecting small gas leaks based on infrared visual image target detection comprises the following steps:
[0007] Step S1: performing infrared image gas enhancement processing based on a guided filter on the collected infrared video;
[0008] Step S2, detecting gas targets based on a visual background extractor on the enhanced video. Further, the step S1 includes the following specific steps:
[0009] Step S11, performing preprocessing operations on the collected infrared video;
[0010] Step S12, obtaining a filtered image;
[0011] Step S13, obtaining an edge image;
[0012] Step S14, obtaining a basic image;
[0013] Step S15, acquiring a gas-enhanced image.
[0014] Furthermore, it is characterized in that the step S11 includes the following specific steps:
[0015] First, the captured infrared video is frame-intercepted to generate a series of infrared images, and the original image and the guide image are selected from the generated infrared images according to a fixed frame difference as the input of the guided filtering. Further, it is characterized in that the step S12 includes the following specific steps:
[0016] Step S121, downsampling the original image and the guide image:
[0017] Set the input original image I_origin, guide image I_guide, filter kernel window K_(n×n), gradient factor ε, sampling coefficient s, and number of frames f_nums, where the sampling coefficient is proportional to the algorithm running time:
[0018] T algorithm ∝1 / ε (1)
[0019] Select the original image, get the width and height of the original image, and reset the image area S according to the size of the sampling coefficient and the size of the original image. image :
[0020] S image =(w origin *s,h origin *s) (2)
[0021] Down-sampling the original image and the guide image respectively according to the reset image area, and making the sampled image areas consistent;
[0022] Step S122, performing mean filtering on the downsampled image:
[0023] Re-adjust the size of the filter kernel window according to the sampling coefficient s, and use the adjusted filter kernel window to perform mean filtering on the down-sampled original image and the guide image respectively;
[0024] Step S123, solving the variance and covariance of the downsampled image:
[0025] First, the variance of the downsampled original image is calculated, and then the covariance of the downsampled original image and the guide image is solved;
[0026] Step S124, calculate the linear correlation factor a within the filter kernel window k 、b k , and perform mean filtering on it:
[0027] In the filter kernel window, due to the existence of linear correlation factors, the pixel p of the downsampled filtered image ij and the pixels g of the downsampled guidance image ijSatisfies the linear relationship expressed by the following formula:
[0028] p ij =a k g ij +b k (3)
[0029] Step S125, calculate the output filtered image:
[0030] According to the original width and height of the original image, the linear correlation factors a and b after mean filtering are upsampled to obtain a mean_us , b mean_us , and then the filtered image I is calculated based on the up-sampled linear correlation factor gf , the specific calculation method is shown in the following formula:
[0031] I gf =a mean_us *I guide +b mean_us (4)
[0032] Furthermore, the step S13 includes the following specific steps:
[0033] A difference operation is performed between the guide image and the filtered image obtained in step S12 to obtain an edge image that does not contain internal texture information.
[0034] Furthermore, the step S14 obtains the dynamic range of the original image, compresses it into a smaller range and establishes a transformation matrix of the two ranges, and applies the transformation matrix to the base image to achieve dynamic compression of the background image, including the following specific steps:
[0035] Step S141, solving the background dynamic range [C, D] of the original image;
[0036] Step S142, compressing the background dynamic range of the original image to [c, d], and satisfying the following relationship:
[0037]
[0038] Step S143, calculate the transformation matrix from [C, D] to [c, d], and apply it to the next image.
[0039] Furthermore, the step S15 includes the following specific steps:
[0040] The magnification factor m is set, and the acquired edge image is magnified based on the magnification factor and fused with the base layer image to obtain the enhanced infrared gas image. The specific fusion method is shown in the following formula:
[0041] I output=I fd + m *I ed (6)
[0042] Among them, I output is the enhanced infrared gas image, I fd As the base image, I ed is the edge image.
[0043] Furthermore, the step S2 includes the following specific steps:
[0044] Step S21, obtaining a grayscale image containing only the gas area:
[0045] First, the infrared gas enhanced image obtained in the above step S1 is input, and then the gas mask is obtained based on the visual background extractor, and then the obtained gas area mask is ANDed with the input enhanced image to obtain a grayscale image containing only the gas part;
[0046] Step S22, obtaining other grayscale images that do not contain gas areas:
[0047] By inverting the gas mask obtained in step S21 and performing an AND operation on the gas mask and the input enhanced image, a grayscale image of other regions not containing gas is obtained;
[0048] Step S23, obtaining the final gas detection image:
[0049] The grayscale image of the gas region obtained in step S21 is pseudo-colored and fused with the grayscale images of other regions to obtain the final gas detection image.
[0050] The present invention provides a method for detecting tiny gas leaks based on infrared visual image target detection, which has the following advantages: Aiming at the problem that tiny leaks of colorless gas are difficult to detect, a tiny gas leak detection algorithm based on an improved guided filter and a visual background extractor is proposed, and infrared visual images are used as the basis for gas detection, and gas detection is finally achieved through the enhancement of gas features and the extraction of moving targets. First, the input video is intercepted frame by frame, and then an image with a suitable frame difference is selected as the input of the guided filter; the base layer image is obtained by reconstructing the selected image by histogram, and the image with enhanced gas features is obtained by merging the obtained edge layer image with the base layer; the enhanced image is synthesized into a video frame by frame, and finally, the diffused gas part image and other grayscale images are obtained based on the visual background extractor to detect the gas part. The present invention can accurately detect tiny leaked gas, and has broad application prospects in the fields of gas transportation pipeline maintenance, safe storage of chemical raw materials, and gas pollution detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a flow chart of a method for detecting tiny gas leaks based on infrared visual image target detection of the present invention.
[0052] Figure 2 Schematic diagram of the original image and the guide image selected in the embodiment of the present invention.
[0053] Figure 3 Schematic diagram of a basic image and an edge image obtained in an embodiment of the present invention.
[0054] Figure 4 Schematic diagram of a gas enhancement image obtained in an embodiment of the present invention.
[0055] Figure 5 Schematic diagram of a gas region mask and a gas region grayscale image obtained in an embodiment of the present invention.
[0056] Figure 6 It is a schematic diagram of a pseudo-color image of a gas region and grayscale images of other regions obtained in an embodiment of the present invention.
[0057] Figure 7 It is a diagram of the final gas detection result in the embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to better understand the purpose, structure and function of the present invention, the following is a further detailed description of a method for detecting small gas leaks based on infrared visual image target detection of the present invention in conjunction with the accompanying drawings.
[0059] like Figure 1 As shown, a method for detecting small gas leaks based on infrared visual image target detection of the present invention comprises the following steps:
[0060] Step S1: performing infrared image gas enhancement processing based on a guided filter on the collected infrared video.
[0061] Step S11, preprocessing the collected infrared video:
[0062] like Figure 2 As shown, the captured infrared video is firstly intercepted frame by frame to generate a series of infrared images, and the original image and the guide image are selected according to a fixed frame difference for the generated infrared images as the input of the guided filter. The frame difference can be set as needed, generally set to 5 frames.
[0063] Step S12, obtaining a filtered image:
[0064] Step S121, downsampling the original image and the guide image:
[0065] Set the input original image I_origin, guide image I_guide, filter kernel window K_(7×7), gradient factor ε=0.2, sampling coefficient s=0.5, and number of frames f_nums=31, where the sampling coefficient is proportional to the algorithm running time:
[0066] T algorithm ∝1 / ε (1)
[0067] Select the original image, get the width and height of the original image, and reset the image area S according to the size of the sampling coefficient and the size of the original image. image :
[0068] S image =(w origin *s,h origin *s) (2)
[0069] The original image and the guide image are downsampled respectively according to the reset image area, and the image areas after sampling are kept consistent.
[0070] Step S122, performing mean filtering on the downsampled image:
[0071] The size of the filter kernel window is readjusted according to the sampling coefficient s, and the adjusted filter kernel window is used to perform mean filtering on the downsampled original image and the guide image respectively.
[0072] Step S123, solving the variance and covariance of the downsampled image:
[0073] First, the variance of the downsampled original image is calculated, and then the covariance of the downsampled original image and the guide image is solved.
[0074] Step S124, calculate the linear correlation factor a within the filter kernel window k , b k , and perform mean filtering on it:
[0075] In the filter kernel window, due to the existence of linear correlation factors, the pixel p of the downsampled filtered image ij and the pixels g of the downsampled guidance image ij Satisfies the linear relationship expressed by the following formula:
[0076] p ij =a k g ij +b k (3)
[0077] Step S125, calculate the output filtered image:
[0078] According to the original width and height of the original image, the linear correlation factors a and b after mean filtering are upsampled to obtain a mean_us 、b mean_us , and then calculate the filtered image I according to the linear correlation factor after upsampling gf , the specific calculation method is shown in the following formula:
[0079] I gf =a mean_us *I guide +b mean_us (4)
[0080] Step S13, obtaining edge image:
[0081] like Figure 3 As shown, by performing a difference operation between the guide image and the filtered image obtained in step S12, an edge image that does not contain internal texture information can be obtained.
[0082] Step S14, obtaining a basic image:
[0083] like Figure 3 As shown, the dynamic range of the original image is obtained, compressed into a smaller range and a transformation matrix of two ranges is established, and the transformation matrix is applied to the base image to achieve dynamic compression of the background image. The specific steps are as follows:
[0084] Step S141, solving the background dynamic range [C, D] of the original image;
[0085] Step S142, compressing the background dynamic range of the original image to [c, d], and satisfying the following relationship:
[0086]
[0087] Step S143, calculate the transformation matrix from [C, D] to [c, d], and apply it to the next image.
[0088] Step S15, obtaining a gas enhanced image:
[0089] like Figure 4 As shown, the magnification factor m=2 is set, and the acquired edge image is magnified based on the magnification factor and fused with the base layer image to obtain an enhanced infrared gas image. The specific fusion method is shown in the following formula.
[0090] I output = I fd + m * I ed (6)
[0091] Among them, I output is the enhanced infrared gas image, Ifd As the base image, I ed is the edge image.
[0092] Step S2, detecting gas targets based on a visual background extractor on the enhanced video.
[0093] Step S21, obtaining a grayscale image containing only the gas area:
[0094] like Figure 5 As shown, the infrared gas enhanced image obtained in the above step S1 is first input, and then the gas mask is obtained based on the visual background extractor. Then, the obtained gas area mask is ANDed with the input enhanced image to obtain a grayscale image containing only the gas part.
[0095] Step S22, obtaining other grayscale images that do not contain gas areas:
[0096] like Figure 6 As shown, by inverting the gas mask obtained in the above step S21 and performing an AND operation on it and the input enhanced image, a grayscale image of other areas not containing gas can be obtained.
[0097] Step S23, obtaining the final gas detection image:
[0098] like Figure 7 As shown, the grayscale image of the gas region obtained in the above step S21 is pseudo-colored and fused with the grayscale images of other regions to obtain the final gas detection image.
[0099] It is to be understood that the present invention is described by some embodiments, and it is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the scope of protection of the present invention.
Claims
1. A method for detecting small gas leaks based on infrared visual image target detection. It is characterized in that The following steps are involved: Step S1: performing infrared image gas enhancement processing based on a guided filter on the collected infrared video; Step S11, performing preprocessing operations on the collected infrared video; Step S12, obtaining a filtered image; Step S121, downsampling the original image and the guide image: Set the input original image I_origin, guide image I_guide, filter kernel window K_(n×n), gradient factor ε, sampling coefficient s, and number of frames f_nums, where the sampling coefficient is proportional to the algorithm running time: T algorithm ∝1 / ε (1) Select the original image, get the width and height of the original image, and reset the image area S according to the size of the sampling coefficient and the size of the original image. image : S image =(w origin *s,h origin *s) (2) Down-sampling the original image and the guide image respectively according to the reset image area, and making the sampled image areas consistent; Step S122, performing mean filtering on the downsampled image: Re-adjust the size of the filter kernel window according to the sampling coefficient s, and use the adjusted filter kernel window to perform mean filtering on the down-sampled original image and the guide image respectively; Step S123, solving the variance and covariance of the downsampled image: First, the variance of the downsampled original image is calculated, and then the covariance of the downsampled original image and the guide image is solved; Step S124, calculate the linear correlation factor a within the filter kernel window k 、b k , and perform mean filtering on it: In the filter kernel window, due to the existence of linear correlation factors, the pixel p of the downsampled filtered image ij and the pixels g of the downsampled guidance image ij Satisfies the linear relationship expressed by the following formula: p ij =a k g ij +b k (3) Step S125, calculate the output filtered image: According to the original width and height of the original image, the linear correlation factors a and b after mean filtering are upsampled to obtain a mean_us 、b mean_us , and then calculate the filtered image I according to the linear correlation factor after upsampling gf , the specific calculation method is shown in the following formula: I gf =a mean_us *I guide +b mean_us ; (4) Step S13, obtaining an edge image; Step S14, obtaining a basic image; Step S15, acquiring a gas enhanced image; Step S2, detecting gas targets based on a visual background extractor on the enhanced video.
2. According to claim 1, the method for detecting small gas leaks based on infrared visual image target detection, It is characterized in that The step S11 includes the following specific steps: Firstly, the collected infrared video is intercepted frame by frame to generate a series of infrared images, and the original image and the guide image are selected according to a fixed frame difference from the generated infrared images as the input of the guided filtering.
3. According to claim 1, the method for detecting small gas leaks based on infrared visual image target detection, It is characterized in that The step S13 includes the following specific steps: A difference operation is performed between the guide image and the filtered image obtained in step S12 to obtain an edge image that does not contain internal texture information.
4. According to claim 1, the method for detecting small gas leaks based on infrared visual image target detection, It is characterized in that The step S14 obtains the dynamic range of the original image, compresses it into a smaller range and establishes a transformation matrix of the two ranges, and applies the transformation matrix to the base image to achieve dynamic compression of the background image, including the following specific steps: Step S141, solving the background dynamic range [C, D] of the original image; Step S142, compressing the background dynamic range of the original image to [c, d], and satisfying the following relationship: Step S143, calculate the transformation matrix from [C, D] to [c, d], and apply it to the next image.
5. The method for detecting small gas leaks based on infrared visual image target detection according to claim 1, It is characterized in that The step S15 includes the following specific steps: The magnification factor m is set, and the acquired edge image is magnified based on the magnification factor and fused with the base layer image to obtain the enhanced infrared gas image. The specific fusion method is shown in the following formula: I output =I fd +m*I ed (6) Among them, I output is the enhanced infrared gas image, I fd As the base image, I ed is the edge image.
6. The method for detecting small gas leaks based on infrared visual image target detection according to claim 1, It is characterized in that The step S2 comprises the following specific steps: Step S21, obtaining a grayscale image containing only the gas area: First, the infrared gas enhanced image obtained in the above step S1 is input, and then the gas mask is obtained based on the visual background extractor, and then the obtained gas area mask is ANDed with the input enhanced image to obtain a grayscale image containing only the gas part; Step S22, obtaining other grayscale images that do not contain gas areas: By inverting the gas mask obtained in step S21 and performing an AND operation on the gas mask and the input enhanced image, a grayscale image of other regions not containing gas is obtained; Step S23, obtaining the final gas detection image: The grayscale image of the gas region obtained in step S21 is pseudo-colored and fused with the grayscale images of other regions to obtain the final gas detection image.
Citation Information
Patent Citations
Infrared video detection method for dangerous gas leakage under moving target low contrast
CN108921878A
Thermal infrared gas leakage detection method, detection device and detection system based on YOLOV5
CN114298989A