Smoke detection methods, apparatuses, media, and devices
By setting a background image in the video stream information and calculating the energy ratio and the average value of the three primary color pixels, the problems of small detection range, high false detection rate and high false detection rate in existing smoke detection technologies are solved, and more efficient smoke detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU GOSUNCN ROBOTICS CO LTD
- Filing Date
- 2023-07-25
- Publication Date
- 2026-06-23
Smart Images

Figure CN116977898B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to smoke detection methods, devices, media, and equipment. Background Technology
[0002] In the early stages of a fire, there are usually not large flames, making it difficult for people to notice and escape in time. However, there will be a lot of smoke. If fires can be detected and extinguished in time through smoke detection, it will help reduce the loss of life and property caused by fires.
[0003] Current technologies primarily use smoke sensors to detect smoke. However, due to limitations in the sensor's installation location, they can only detect areas near the sensor, making it difficult to detect areas farther away. Furthermore, a certain amount of smoke is required to trigger the sensor, hindering early smoke detection. Alternatively, deep learning-based object detection algorithms can be used for visual smoke detection. However, the highly variable morphology and density of smoke lead to a large workload for labeling, making data collection difficult. Sparse smoke results in a high false negative rate, and the presence of many objects resembling smoke, such as clouds or white clumps created by light reflections on smooth surfaces, further contributes to the high false positive rate. Summary of the Invention
[0004] This invention provides a smoke detection method, apparatus, medium, and equipment to solve the problems of small detection range, high false negative and false positive rates, and insufficient timely warning in existing smoke detection technologies.
[0005] A smoke detection method, the method comprising:
[0006] Obtain the video stream information to be detected, wherein the video stream information includes several image frames;
[0007] Set the background image of the video stream information, and extract the suspected smoke area based on the background image and the non-background image in the video stream information;
[0008] Obtain the average values of the three primary color pixels in the suspected smoke area of the non-background image;
[0009] Obtain the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region in the background image;
[0010] Based on the energy ratio and the average values of the three primary color pixels in the suspected smoke area in the non-background image, it is determined whether the suspected smoke area is a smoke area.
[0011] Optionally, setting the background image of the video stream information and extracting the suspected smoke region based on the background image and the non-background image in the video stream information includes:
[0012] The first image frame in the video stream information is used as the background image, and the remaining image frames are used as non-background images.
[0013] For each non-background image in the video stream information, visual saliency detection is performed in conjunction with the background image to extract the suspected smoke region in the non-background image.
[0014] Optionally, for each non-background image in the video stream information, performing visual saliency detection in conjunction with the background image to extract the suspected smoke region in the non-background image includes:
[0015] Adjust the contrast of the non-background image;
[0016] Calculate the saliency map of the non-background image;
[0017] Extract the preset color channels of the saliency map and perform thresholding processing;
[0018] The region with the largest area in the thresholded saliency map is taken as the suspected smoke region in the non-background image;
[0019] Wavelet transform processing is performed on the suspected smoke region in the non-background image.
[0020] Optionally, the preset color channel is the blue channel of the RGB three primary colors.
[0021] Optionally, obtaining the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region on the background image includes:
[0022] Extract the preset color channels of the non-background image and the background image respectively;
[0023] Perform wavelet transform on the suspected smoke region in the preset color channel of the non-background image, and calculate the energy value of the suspected smoke region on the non-background image based on the component of the wavelet transform.
[0024] Perform wavelet transform on the non-smoke regions in the preset color channel of the background image, and calculate the energy value of the non-smoke regions on the background image based on the component elements of the wavelet transform.
[0025] Calculate the ratio between the energy value of the suspected smoke region on the non-background image and the energy value of the non-suspected smoke region on the background image.
[0026] Optionally, the formula for calculating the energy value is:
[0027]
[0028] Where E(I) represents the energy value of image I, cH represents the horizontal detail component, cV represents the vertical detail component, cD represents the diagonal detail component, and I(i,j) represents a pixel in image I.
[0029] Optionally, determining whether the suspected smoke region is a smoke region based on the energy ratio and the average values of the three primary color pixels in the suspected smoke region of the non-background image includes:
[0030] Calculate the differences between the average values of the blue channel pixels and the green channel pixels, the differences between the average values of the green channel pixels and the red channel pixels, and the differences between the average values of the blue channel pixels and the red channel pixels, respectively, based on the average values of the three primary color pixels in the suspected smoke area of the image frame.
[0031] The energy ratio is compared with a preset energy threshold, the difference between the average value of the blue channel pixels and the average value of the green channel pixels is compared with a first comparison threshold, the difference between the average value of the green channel pixels and the average value of the red channel pixels is compared with a second comparison threshold, and the difference between the average value of the blue channel pixels and the average value of the red channel pixels is compared with a third comparison threshold.
[0032] If the energy ratio is less than a preset energy threshold, the difference between the average pixel value of the blue channel and the average pixel value of the green channel is greater than a first comparison threshold, the difference between the average pixel value of the green channel and the average pixel value of the red channel is greater than a second comparison threshold, and the difference between the average pixel value of the blue channel and the average pixel value of the red channel is greater than a third comparison threshold, then the suspected smoke area is a smoke area.
[0033] A smoke detection method, the device comprising:
[0034] The acquisition module is used to acquire the video stream information to be detected, wherein the video stream information includes several image frames;
[0035] The extraction module is used to set the background image of the video stream information and extract the suspected smoke area based on the background image and the non-background image in the video stream information;
[0036] The pixel acquisition module is used to acquire the average value of the three primary color pixels in the suspected smoke area in the non-background image;
[0037] The ratio acquisition module is used to acquire the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region on the background image;
[0038] The judgment module is used to determine whether the suspected smoke area is a smoke area based on the energy ratio and the average value of the three primary color pixels in the suspected smoke area in the non-background image.
[0039] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the smoke detection method described above.
[0040] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the smoke detection method as described above.
[0041] This invention provides a novel smoke detection method by acquiring video stream information to be detected, which includes several image frames; then setting a background image for the video stream information; extracting suspected smoke regions from the image frames; obtaining the average values of the three primary colors of the suspected smoke regions in the image frames; obtaining the energy ratio of the suspected smoke regions on the image frames relative to the non-suspected smoke regions on the background image; and determining whether the suspected smoke regions are smoke regions based on the energy ratio and the average values of the three primary colors of the suspected smoke regions in the image frames. This method effectively improves the detection range, reduces the false negative and false positive rates, achieves a balance between accuracy and speed in smoke detection, and improves the warning speed. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart of a smoke detection method provided in an embodiment of the present invention;
[0044] Figure 2 This is a schematic diagram of experimental results provided in an embodiment of the present invention;
[0045] Figure 3 This is a schematic diagram of the structure of a smoke detection device provided in an embodiment of the present invention;
[0046] Figure 4 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] The smoke detection method provided in this invention overcomes the shortcomings of small detection range of smoke sensors and large workload of deep learning methods in creating datasets by locating the smoke position in the image and determining whether it is smoke. It effectively improves the detection range, reduces the false negative rate and false positive rate, and achieves the goal of detecting smoke in the image with a balance between accuracy and speed, thereby improving the warning speed.
[0049] The smoke detection method provided in this embodiment is described in detail below, such as Figure 1 As shown, the smoke detection method includes:
[0050] Step S101: Obtain the video stream information to be detected, wherein the video stream information includes several image frames;
[0051] Step S102: Set the background image of the video stream information, and extract the suspected smoke area based on the background image and the non-background image in the video stream information;
[0052] Step S103: Obtain the average value of the three primary color pixels in the suspected smoke area in the non-background image;
[0053] Step S104: Obtain the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region on the background image;
[0054] Step S105: Based on the energy ratio and the average value of the three primary color pixels in the suspected smoke area in the non-background image, determine whether the suspected smoke area is a smoke area.
[0055] In step S101, as an example, a patrol robot can be used to patrol pre-defined scenarios such as buildings and shopping malls, capturing real-time images during the patrol to obtain video stream information of the patrol scene. Optionally, the camera is mounted on the head of the patrol robot. Alternatively, in another example, a camera can be installed in a fire-prone area to obtain video stream information. The video stream information includes several image frames.
[0056] In step S102, this embodiment locates the suspected smoke area based on the video stream information. First, a background image is set for the video stream information. Then, the suspected smoke area is extracted by combining the background image and non-background images in the video stream information. It should be understood that the background image refers to an image frame without smoke. Since the video stream information includes at least one non-background image, this embodiment iterates through each non-background image and extracts the non-background image containing the suspected smoke area and the suspected smoke area by combining the background image.
[0057] In step S103, for a non-background image containing a suspected smoke area, this embodiment obtains the average value of the three primary color pixels of the suspected smoke area in the non-background image.
[0058] In step S104, this embodiment maps the suspected smoke region on the non-background image onto the background image. For ease of description, the region mapped from the suspected smoke region to the background image is denoted as the non-suspected smoke region. The energy values of the suspected smoke region on the non-background image and the non-suspected smoke region on the background image are calculated based on a two-dimensional wavelet transform of the image. Then, the ratio of these two values is obtained to obtain the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region on the background image.
[0059] In step S105, the energy ratio reflects the energy value relationship between the suspected smoke region and the background image (non-background image), and the three primary color pixel values reflect the pixel characteristics of different objects. Experiments have shown that for a real smoke region, its energy value is lower than that of the non-smoke region in the background image, and the three primary color pixels in the smoke region exhibit a certain relationship. Therefore, this embodiment uses the energy ratio and the average value of the three primary color pixels in the suspected smoke region of the non-background image as a preset judgment criterion. When the energy ratio and the three primary color pixel values meet the judgment criterion, the suspected smoke region is determined to be a smoke region.
[0060] As can be seen, this embodiment provides a new smoke detection method. By initially locating suspected smoke areas, and then combining the energy ratio of the suspected smoke areas with the average value of the three primary color pixels, the smoke areas are confirmed. It is applicable not only to cameras in fixed positions but also to moving cameras, effectively expanding the detection range. It has a high degree of interpretability for smoke detection, does not rely on algorithms, and does not require labeling or algorithm training, making it easier to implement. It effectively reduces the false negative rate and the false positive rate, achieving a balance between accuracy and speed in smoke detection and improving the warning speed.
[0061] Optionally, as a preferred example of the present invention, step S102, which involves setting the background image of the video stream information and extracting the suspected smoke region based on the background image and the non-background image in the video stream information, includes:
[0062] Step S1021: Obtain the first image frame in the video stream information as the background image, and the remaining image frames as non-background images;
[0063] Step S1022: For each non-background image in the video stream information, perform visual saliency detection in conjunction with the background image to extract the suspected smoke region in the non-background image.
[0064] Here, visual saliency detection refers to using intelligent algorithms to simulate human visual characteristics and extract salient regions in an image, i.e., regions of interest to humans. In this embodiment, smoke typically appears as large white or black blobs in an image, making it highly conspicuous. Therefore, this embodiment employs a visual saliency detection algorithm to detect smoke and extract suspected smoke regions from the non-background image. Optionally, this embodiment uses the first image frame in the video stream as the background image, and then uses the second image frame onwards as the non-background image for visual saliency detection.
[0065] Optionally, as a preferred embodiment of the present invention, step S1022, which involves performing visual saliency detection in conjunction with the background image for each non-background image in the video stream information and extracting the suspected smoke region in the non-background image, includes:
[0066] Step S301: Adjust the contrast of the non-background image; Step S302: Calculate the saliency map of the non-background image;
[0067] Step S303: Extract the preset color channels of the saliency map and perform thresholding processing;
[0068] Step S304: Obtain the region with the largest area in the thresholded saliency map as the suspected smoke region of the non-background image;
[0069] Step S305: Perform wavelet transform processing on the suspected smoke region in the non-background image.
[0070] Here, this embodiment first preprocesses the non-background image. Preprocessing includes contrast adjustment, grayscale conversion, and saliency map calculation. Optionally, this embodiment uses Gamma transform to adjust the contrast of the non-background image to enhance the smoke characteristics and reduce the impact of lighting on the image. This embodiment uses grayscale conversion to prepare for wavelet transform and uses Gaussian blurring to calculate the saliency map. Gamma transform, also known as the gamma transformation, performs a non-linear operation on the grayscale values of the input image, making the grayscale values of the output image exponentially related to the grayscale values of the input image; this exponent is Gamma. Gaussian blurring, also known as Gaussian blurring, is used to reduce image noise and reduce detail levels; it uses a Gaussian distribution as the pixel smoothing method for the convolution weight table.
[0071] Wavelet transform is a transform analysis method that inherits and develops the localization idea of short-time Fourier transform while overcoming the drawback of window size not changing with frequency. It provides a frequency-varying "time-frequency" window, making it an ideal tool for signal and video analysis and processing. Two-dimensional wavelet transform can decompose an image into four different parts: approximate components, horizontal detail components, vertical detail components, and diagonal detail components. These components can be further processed and information extracted. The approximate components are also known as low-frequency components. Smoke of varying density all exhibit a high low-frequency content.
[0072] The calculated saliency map highlights the smoke area and makes the background area darker. Since the blue channel (B channel) of smoke is more prominent than the green and red channels, this embodiment uses the blue channel of the RGB primary colors as the preset color channel. By thresholding the blue channel, the contour with the largest area is found, and the objects enclosed within the contour are considered the suspected smoke area of the non-background image. Alternatively, in another embodiment, the bounding rectangle can be obtained based on the contour as the suspected smoke area of the non-background image.
[0073] To determine whether a suspected smoke area is a real smoke area, this embodiment uses wavelet transform and the characteristics of the relationship between smoke RGB pixel values for comprehensive judgment.
[0074] For genuine smoke regions, given that smoke appears smoother in an image, the low-frequency content of the image will increase, and the image energy will decrease. Therefore, this embodiment uses the energy values of suspected smoke regions in the non-background image and their mapped energy values in the background image as a criterion for determining genuine smoke regions.
[0075] As a preferred example of the present invention, step S104, obtaining the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region in the background image, includes:
[0076] Step S401: Extract the preset color channels of the non-background image and the background image respectively;
[0077] Step S402: Perform wavelet transform on the suspected smoke region in the preset color channel of the non-background image, and calculate the energy value of the suspected smoke region on the non-background image based on the component of the wavelet transform.
[0078] Step S403: Perform wavelet transform on the non-smoke regions in the preset color channel of the background image, and calculate the energy value of the non-smoke regions on the background image based on the component of the wavelet transform.
[0079] Step S404: Calculate the ratio between the energy value of the suspected smoke region on the non-background image and the energy value of the non-suspected smoke region on the background image.
[0080] As mentioned earlier, since the blue channel (B channel) of smoke has more pronounced characteristics compared to the green and red channels, this embodiment uses the blue channel of the RGB three primary colors as the preset color channel. Wavelet transforms are performed on the suspected smoke regions in the preset color channels of the non-background image and the background image, respectively, to obtain horizontal detail components, vertical detail components, and diagonal detail components. Then, the energy value of the suspected smoke region in the non-background image is calculated according to the following formula:
[0081]
[0082] Where E(I) represents the energy value of image I, cH represents the horizontal detail component, cV represents the vertical detail component, cD represents the diagonal detail component, and I(i,j) represents a pixel in image I.
[0083] The formula for calculating the energy ratio is: Wherein, ρ represents the energy ratio, and E t (I) represents the energy value of the suspected smoke area on the non-background image, E tB (I) The energy value of the non-smoke area on the background image.
[0084] Because the non-background image containing smoke contains more low-frequency components, the horizontal, vertical, and diagonal detail components will be fewer, resulting in a decrease in the image's energy value. Therefore, if the energy value of a suspected smoke region in the non-background image is smaller than the energy value of a non-suspected smoke region in the background image, that is... The suspected smoke area on the non-background image may contain smoke.
[0085] Even if the energy value of a suspected smoke region on a non-background image is smaller than the energy value of a non-suspected smoke region on the background image, it cannot be definitively determined that smoke exists in the non-background image; further information is needed. This embodiment uses the relationship between RGB pixel values for judgment. Experiments have shown that for real smoke, the corresponding RGB pixel values satisfy the relationship B>G>R. This embodiment further utilizes this relationship to determine smoke.
[0086] Step S105, which involves determining whether the suspected smoke region is a smoke region based on the energy ratio and the average values of the three primary color pixels in the suspected smoke region of the non-background image, includes:
[0087] Step S501: Calculate the differences between the average values of the blue channel pixels and the green channel pixels, the differences between the average values of the green channel pixels and the red channel pixels, and the differences between the average values of the blue channel pixels and the red channel pixels, respectively, based on the average values of the three primary color pixels in the suspected smoke area of the image frame.
[0088] Step S502: Compare the energy ratio with a preset energy threshold, compare the difference between the average value of the blue channel pixels and the average value of the green channel pixels with a first comparison threshold, compare the difference between the average value of the green channel pixels and the average value of the red channel pixels with a second comparison threshold, and compare the difference between the average value of the blue channel pixels and the average value of the red channel pixels with a third comparison threshold.
[0089] Step S503: If the energy ratio is less than a preset energy threshold, the difference between the average value of the blue channel pixels and the average value of the green channel pixels is greater than a first comparison threshold, the difference between the average value of the green channel pixels and the average value of the red channel pixels is greater than a second comparison threshold, and the difference between the average value of the blue channel pixels and the average value of the red channel pixels is greater than a third comparison threshold, then the suspected smoke area is a smoke area.
[0090] Based on the RGB pixel value relationship of real smoke satisfying B>G>R, this embodiment pre-sets comparison thresholds for the three primary color pixel values, namely a first comparison threshold δ1, a second comparison threshold δ2, and a third comparison threshold δ3, where δ2≤-2δ1. Specifically, the first comparison threshold δ1 is used to measure the difference between the average pixel value of the blue channel and the average pixel value of the green channel; the second comparison threshold δ2 is used to measure the difference between the average pixel value of the green channel and the average pixel value of the red channel; and the third comparison threshold δ3 is used to determine the difference between the average pixel value of the blue channel and the average pixel value of the red channel. After obtaining the average pixel values of the three primary colors in the suspected smoke area in the non-background image through step S103, this embodiment calculates the average pixel value of the blue channel. Compared with the average pixel value of the green channel Difference, mean pixel value of green channel With the average pixel value of the red channel Difference, mean value of blue channel pixels With the average pixel value of the red channel The difference is compared by comparing the energy ratio with a preset energy threshold and by comparing the average value of the blue channel pixels. Compared with the average pixel value of the green channel The difference is compared with the first comparison threshold and the average value of the green channel pixels. With the average pixel value of the red channel The difference is compared with the second comparison threshold, and the average value of the blue channel pixels is compared. With the average pixel value of the red channel The difference is compared with the third comparison threshold.
[0091] If the energy ratio is less than a preset energy threshold, the average pixel value of the blue channel... Compared with the average pixel value of the green channel The difference is greater than the first comparison threshold and the average value of the green channel pixels. With the average pixel value of the red channel The difference is greater than the second comparison threshold and the average pixel value of the blue channel. With the average pixel value of the red channel If the difference is greater than the third comparison threshold, then the suspected smoke area is a smoke area, that is, it satisfies:
[0092]
[0093]
[0094]
[0095]
[0096] Therefore, it can be determined that the suspected smoke area contains smoke and is a smoke area.
[0097] Optionally, as a preferred embodiment of the present invention, the first comparison threshold δ1 is preferably 10, the second comparison threshold δ2 is preferably -20, and the third comparison threshold δ3 is preferably 10.
[0098] For ease of understanding, Figure 2 This is a schematic diagram of the experimental results provided in an embodiment of the present invention. The experimental results diagram includes three non-background images, divided into 5 columns. The first column is the original non-background image, the second column is the saliency map, the third column is the image after thresholding the saliency map, the fourth column consists of 4 images (the upper left corner is the suspected smoke area, the upper right corner is the horizontal detail component of the wavelet transform, the lower left corner is the vertical detail component of the wavelet transform, and the lower right corner is the diagonal detail component of the wavelet transform), and the fifth column is the original image with visualization results. Taking the first row as an example: In the original non-background image, there is a white smoke cloud in the right half. The saliency map calculated by visual saliency detection essentially turns the background area black, highlighting the smoke area. Then, the blue channel (B channel) of the saliency map is extracted and thresholded. For the thresholded saliency map, the largest area is the smoke area. Its bounding rectangle is obtained, and this part is the suspected smoke area. Wavelet transform is performed on the suspected smoke area, and the energy value is calculated to be 4.60. The energy value of the corresponding area of the blue channel in the background image calculated by wavelet transform is 63.16, and the ratio ρ is 0.07. The average pixel value of the blue channel of the suspected smoke area in the non-background image is... The average pixel value of the green channel is 191.13. The average pixel value of the red channel is 142.85. The value is 120.34, which meets the conditions. Therefore, it can be determined that there is smoke in the suspected smoke area. Drawing the target box indicates that smoke has been detected.
[0099] The smoke detection method provided in this invention locates the position of smoke in an image and determines whether it is smoke. It offers high interpretability for smoke detection and, unlike deep learning object detection algorithms and SVM algorithms, requires no labeling or training, making it easier to implement. This invention offers higher detection accuracy and a lower false alarm rate, especially for white smoke. It is applicable not only to fixed-position cameras but also to moving cameras, effectively increasing the detection range while saving hardware costs.
[0100] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0101] In one embodiment, the present invention also provides a smoke detection device, which corresponds one-to-one with the smoke detection method described in the above embodiments. For example... Figure 3 As shown, the smoke detection device includes an acquisition module 31, an extraction module 32, a pixel acquisition module 33, a ratio acquisition module 34, and a judgment module 35. Detailed descriptions of each functional module are as follows:
[0102] The acquisition module 31 is used to acquire the video stream information to be detected, wherein the video stream information includes a number of image frames;
[0103] Extraction module 32 is used to set the background image of the video stream information and extract the suspected smoke area based on the background image and the non-background image in the video stream information;
[0104] Pixel acquisition module 33 is used to acquire the average value of the three primary color pixels in the suspected smoke area in the non-background image;
[0105] The ratio acquisition module 34 is used to acquire the energy ratio of the suspected smoke area on the non-background image to the non-suspected smoke area on the background image;
[0106] The judgment module 35 is used to determine whether the suspected smoke area is a smoke area based on the energy ratio and the average value of the three primary color pixels in the suspected smoke area in the non-background image.
[0107] Optionally, the extraction module 32 includes:
[0108] The acquisition unit is used to acquire the first image frame in the video stream information as the background image and the remaining image frames as non-background images.
[0109] The detection unit is used to perform visual saliency detection on each non-background image in the video stream information in conjunction with the background image, and extract the suspected smoke region in the non-background image.
[0110] Optionally, the detection unit includes:
[0111] An adjustment subunit is used to adjust the contrast of the non-background image;
[0112] A computational subunit is used to calculate the saliency map of the non-background image;
[0113] An extraction subunit is used to extract a preset color channel of the saliency map and perform thresholding processing;
[0114] A sub-unit is obtained to obtain the region with the largest area in the thresholded saliency map, which is used as the suspected smoke region in the non-background image;
[0115] The transform submodule is used to perform wavelet transform processing on the suspected smoke region in the non-background image.
[0116] Optionally, the preset color channel is the blue channel of the RGB three primary colors.
[0117] Optionally, the ratio acquisition module 34 includes:
[0118] An extraction unit is used to extract preset color channels of the non-background image and the background image respectively;
[0119] The first energy calculation unit is used to perform wavelet transform on the suspected smoke region in the preset color channel of the non-background image, and calculate the energy value of the suspected smoke region on the non-background image according to the component of the wavelet transform.
[0120] The second energy calculation unit is used to perform wavelet transform on the non-smoke regions in the preset color channel of the background image, and calculate the energy value of the non-smoke regions on the background image based on the component of the wavelet transform.
[0121] The calculation unit is used to calculate the ratio between the energy value of the suspected smoke region on the non-background image and the energy value of the non-suspected smoke region on the background image.
[0122] Optionally, the formula for calculating the energy value is:
[0123]
[0124] Where E(I) represents the energy value of image I, cH represents the horizontal detail component, cV represents the vertical detail component, cD represents the diagonal detail component, and I(i,j) represents a pixel in image I.
[0125] Optionally, the determination module 35 includes:
[0126] The difference calculation unit is used to calculate the difference between the average value of the blue channel pixels and the average value of the green channel pixels, the difference between the average value of the green channel pixels and the average value of the red channel pixels, and the difference between the average value of the blue channel pixels and the average value of the red channel pixels, respectively, based on the average values of the three primary color pixels in the suspected smoke area in the image frame.
[0127] The comparison unit is used to compare the energy ratio with a preset energy threshold, compare the difference between the average value of the blue channel pixels and the average value of the green channel pixels with a first comparison threshold, compare the difference between the average value of the green channel pixels and the average value of the red channel pixels with a second comparison threshold, and compare the difference between the average value of the blue channel pixels and the average value of the red channel pixels with a third comparison threshold.
[0128] The judgment unit is configured to determine if the suspected smoke area is a smoke area if the energy ratio is less than a preset energy threshold, the difference between the average pixel value of the blue channel and the average pixel value of the green channel is greater than a first comparison threshold, the difference between the average pixel value of the green channel and the average pixel value of the red channel is greater than a second comparison threshold, and the difference between the average pixel value of the blue channel and the average pixel value of the red channel is greater than a third comparison threshold.
[0129] Specific limitations regarding the smoke detection device can be found in the limitations of the smoke detection method described above, and will not be repeated here. Each module in the aforementioned smoke detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independent of the processor in a computer device, or stored in memory as software, so that the processor can call and execute the corresponding operations of each module.
[0130] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a smoke detection method.
[0131] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0132] Obtain the video stream information to be detected, wherein the video stream information includes several image frames;
[0133] Set the background image of the video stream information, and extract the suspected smoke area based on the background image and the non-background image in the video stream information;
[0134] Obtain the average values of the three primary color pixels in the suspected smoke area of the non-background image;
[0135] Obtain the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region in the background image;
[0136] Based on the energy ratio and the average values of the three primary color pixels in the suspected smoke area in the non-background image, it is determined whether the suspected smoke area is a smoke area.
[0137] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0139] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A smoke detection method, characterized in that, include: Obtain the video stream information to be detected, wherein the video stream information includes several image frames; Set the background image of the video stream information, and extract the suspected smoke area based on the background image and the non-background image in the video stream information; Obtain the average values of the three primary color pixels in the suspected smoke area of the non-background image; Obtain the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region in the background image; Based on the energy ratio and the average values of the three primary color pixels in the suspected smoke area of the non-background image, it is determined whether the suspected smoke area is a smoke area. Specifically, this involves: calculating the differences between the average values of the blue channel pixels and the average values of the green channel pixels, the differences between the average values of the green channel pixels and the average values of the red channel pixels, and the differences between the average values of the blue channel pixels and the average values of the red channel pixels, respectively, based on the average values of the three primary color pixels in the suspected smoke area of the non-background image; comparing the energy ratio with a preset energy threshold, comparing the differences between the average values of the blue channel pixels and the average values of the green channel pixels with a first comparison threshold, comparing the differences between the average values of the green channel pixels and the average values of the red channel pixels with a second comparison threshold, and comparing the differences between the average values of the blue channel pixels and the average values of the red channel pixels with a third comparison threshold; If the energy ratio is less than a preset energy threshold, the difference between the average pixel value of the blue channel and the average pixel value of the green channel is greater than a first comparison threshold, the difference between the average pixel value of the green channel and the average pixel value of the red channel is greater than a second comparison threshold, and the difference between the average pixel value of the blue channel and the average pixel value of the red channel is greater than a third comparison threshold, then the suspected smoke area is a smoke area.
2. The smoke detection method as described in claim 1, characterized in that, The step of setting the background image of the video stream information and extracting the suspected smoke region based on the background image and the non-background image in the video stream information includes: The first image frame in the video stream information is used as the background image, and the remaining image frames are used as non-background images. For each non-background image in the video stream information, visual saliency detection is performed in conjunction with the background image to extract the suspected smoke region in the non-background image.
3. The smoke detection method as described in claim 2, characterized in that, For each non-background image in the video stream information, visual saliency detection is performed in conjunction with the background image to extract the suspected smoke region in the non-background image, including: Adjust the contrast of the non-background image; Calculate the saliency map of the non-background image; Extract the preset color channels of the saliency map and perform thresholding processing; The region with the largest area in the thresholded saliency map is taken as the suspected smoke region in the non-background image; Wavelet transform processing is performed on the suspected smoke region in the non-background image.
4. The smoke detection method as described in claim 3, characterized in that, The preset color channel is the blue channel in the RGB three primary colors.
5. The smoke detection method according to any one of claims 2 to 4, characterized in that, The step of obtaining the energy ratio of the suspected smoke region on the non-background image relative to the non-suspected smoke region in the background image includes: Extract the preset color channels of the non-background image and the background image respectively; Perform wavelet transform on the suspected smoke region in the preset color channel of the non-background image, and calculate the energy value of the suspected smoke region on the non-background image based on the component of the wavelet transform. Perform wavelet transform on the non-smoke regions in the preset color channel of the background image, and calculate the energy value of the non-smoke regions on the background image based on the component elements of the wavelet transform. Calculate the ratio between the energy value of the suspected smoke region on the non-background image and the energy value of the non-suspected smoke region on the background image.
6. The smoke detection method as described in claim 5, characterized in that, The formula for calculating the energy value is: ; in, Representing an image Energy value, Indicates the horizontal detail component. Indicates the vertical detail component. Indicates the diagonal detail component. I(i, j) Representing an image One pixel.
7. A smoke detection device, characterized in that, The device includes: The acquisition module is used to acquire the video stream information to be detected, wherein the video stream information includes several image frames; The extraction module is used to set the background image of the video stream information and extract the suspected smoke area based on the background image and the non-background image in the video stream information; The pixel acquisition module is used to acquire the average value of the three primary color pixels in the suspected smoke area in the non-background image; The ratio acquisition module is used to acquire the energy ratio of the suspected smoke region on the non-background image to the non-suspected smoke region on the background image; The judgment module is used to determine whether the suspected smoke area is a smoke area based on the energy ratio and the average values of the three primary color pixels in the suspected smoke area in the non-background image. Specifically, it calculates the differences between the average values of the blue channel pixels and the average values of the green channel pixels, the average values of the green channel pixels and the average values of the red channel pixels, and the average values of the blue channel pixels and the average values of the red channel pixels, respectively, based on the average values of the three primary color pixels in the suspected smoke area in the non-background image. It then compares the energy ratio with a preset energy threshold, the difference between the average values of the blue channel pixels and the average values of the green channel pixels with a first comparison threshold, the difference between the average values of the green channel pixels and the average values of the red channel pixels with a second comparison threshold, and the difference between the average values of the blue channel pixels and the average values of the red channel pixels with a third comparison threshold. If the energy ratio is less than the preset energy threshold, the difference between the average values of the blue channel pixels and the average values of the green channel pixels is greater than the first comparison threshold, the difference between the average values of the green channel pixels and the average values of the red channel pixels is greater than the second comparison threshold, and the difference between the average values of the blue channel pixels and the average values of the red channel pixels is greater than the third comparison threshold, then the suspected smoke area is a smoke area.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the smoke detection method as described in any one of claims 1 to 6.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the smoke detection method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Smoke detection method based on red, green and blue (RGB) contrast image and target shape
CN103020628A
A traffic scene smoke intelligent detection method based on multi-dimensional information feature fusion
CN109255326A