Method, system, electronic device and storage medium for identifying oil fume concentration
The image processing method for oil fume detection improves accuracy and responsiveness by using frame difference analysis and centroid neighborhood detection to identify and eliminate interference, enabling real-time oil fume concentration recognition.
Patent Information
- Application Number
- CN202110162714.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-05
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-02-05
AI Technical Summary
Existing methods for detecting oil fume concentration, such as infrared reflection and physical particle detection, suffer from low accuracy and lack real-time responsiveness, particularly due to installation position requirements and lagging response times.
An image processing method involving frame difference analysis, centroid neighborhood detection, and contour elimination to identify oil smoke areas, using a camera to capture images, calculate frame differences, and determine oil fume concentration based on centroid neighborhood eigenvalues.
Enhances detection accuracy by eliminating interference areas and ensuring real-time detection, reducing delays associated with traditional methods, and facilitating intelligent control in kitchen environments.
Smart Images

Figure CN112862780B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of oil fume detection, and in particular to an oil fume concentration recognition method, system, electronic equipment and storage medium. Background Art
[0002] The kitchen is a necessary scene for every family to cook every day, and the effect of kitchen fume treatment directly affects the health and quality of life of family members. The traditional methods of detecting fume concentration are mainly infrared reflection method and physical particle detection method to detect the concentration of fume. Among them, the infrared reflection method mainly uses the transmitting end of the device to emit infrared light, and the receiving end receives the intensity of infrared light to judge the current concentration of fume. This method has great requirements on the accuracy of the installation position of the device, and the installation position needs to ensure that there are no related interferences to the infrared light to ensure the detection accuracy; while the physical particle detection method mainly uses the sensor to detect the amount of particles in the air to judge the current fume concentration. This solution installs the sensor between the path where the fume is generated and discharged. When the fume particles come into contact with the sensor, a corresponding response will be generated, which greatly lags the response speed and fails to meet the requirements of real-time detection. Summary of the invention
[0003] The technical problem to be solved by the present invention is to overcome the defect of low recognition accuracy in the prior art of oil fume concentration recognition method, and the purpose is to provide an oil fume concentration recognition method, system, electronic device and storage medium.
[0004] The present invention solves the above technical problems through the following technical solutions:
[0005] The present invention provides a method for identifying oil smoke concentration, the identification method comprising:
[0006] Get the current frame image corresponding to the cooking area;
[0007] Calculate and obtain a target frame difference image corresponding to the current frame image;
[0008] Determine the initial oil smoke motion area corresponding to the current frame image according to the target frame difference image;
[0009] Performing contour detection on the initial oil smoke motion area to obtain a plurality of first motion areas;
[0010] Calculate and obtain the centroid neighborhood of the first motion area and the neighborhood eigenvalue corresponding to the centroid neighborhood;
[0011] When the neighborhood characteristic value meets the set threshold range, determining that the first motion area where the current center of gravity neighborhood is located belongs to the oil smoke area;
[0012] A target oil fume concentration corresponding to the cooking area is obtained according to the oil fume area.
[0013] Preferably, the step of calculating and obtaining the target frame difference image corresponding to the current frame image comprises:
[0014] Acquire a background frame image corresponding to the cooking area;
[0015] Perform frame difference processing on the current frame image and the background frame image to obtain a target frame difference image.
[0016] Preferably, the step of acquiring the background frame image corresponding to the cooking area comprises:
[0017] Acquire a cooking scene frame image corresponding to the cooking scene within a historical set time period;
[0018] Identifying a historical frame image corresponding to the cooking area in the cooking frame scene image;
[0019] Performing grayscale transformation processing on the historical frame image, and performing frame difference processing on the historical frame image of a subsequent frame after the grayscale transformation processing and the historical frame image of a previous frame to obtain a first frame difference image;
[0020] When the first frame difference image meets a preset condition, the historical frame image of the next frame is used as the background frame image corresponding to the cooking area.
[0021] Preferably, when the first frame difference image meets a preset condition, the step of using the subsequent historical frame image as the background frame image corresponding to the cooking area includes:
[0022] Obtaining a first ratio between the number of white pixels and the total number of pixels in the first frame difference image;
[0023] When the first proportion is less than a set threshold and lasts for a set time, the historical frame image of the next frame is used as the background frame image.
[0024] Preferably, the step of determining the initial oil smoke motion area corresponding to the current frame image according to the target frame difference image comprises:
[0025] Performing grayscale conversion processing on the target frame difference image, and obtaining the initial oil smoke motion area corresponding to the current frame image according to the area where the white pixels in the target frame difference image after the grayscale conversion processing are located; and / or,
[0026] The step of calculating and obtaining the center of gravity neighborhood of the first motion area comprises:
[0027] Calculate and obtain the center of gravity position information and area information of each of the first motion areas;
[0028] Determine a neighborhood length corresponding to the first motion area according to the center of gravity position information and the area information;
[0029] The center-of-gravity neighborhood of the first motion region is determined according to the center-of-gravity position information and the neighborhood length.
[0030] Preferably, the centroid neighborhood includes a square neighborhood.
[0031] Preferably, the neighborhood characteristic value includes a grayscale value mean and / or a grayscale value variance corresponding to the centroid neighborhood.
[0032] Preferably, the step of obtaining the target oil fume concentration corresponding to the cooking area according to the oil fume area comprises:
[0033] Calculate and obtain a second ratio between the number of white pixels and the total number of pixels in the oil smoke area;
[0034] A first oil fume concentration corresponding to the oil fume area is determined according to the size of the second proportion, and a target oil fume concentration corresponding to the cooking area is acquired according to the first oil fume concentration.
[0035] The present invention also provides a system for identifying oil fume concentration, the system comprising:
[0036] A current frame image acquisition module, used to acquire a current frame image corresponding to the cooking area;
[0037] A target frame difference image calculation module, used for calculating and obtaining a target frame difference image corresponding to the current frame image;
[0038] An initial region determination module, used to determine an initial oil smoke motion region corresponding to the current frame image according to the target frame difference image;
[0039] A contour detection module, used for performing contour detection on the initial oil smoke motion area to obtain a plurality of first motion areas;
[0040] A centroid neighborhood calculation module, used to calculate the centroid neighborhood of the first motion area and the neighborhood eigenvalue corresponding to the centroid neighborhood;
[0041] A fume region determination module, configured to determine that the first motion region where the current center of gravity neighborhood is located belongs to the fume region when the neighborhood feature value meets a set threshold range;
[0042] The oil fume concentration acquisition module is used to acquire the oil fume concentration corresponding to the cooking area according to the oil fume area.
[0043] Preferably, the target frame difference image calculation module includes:
[0044] A background frame image acquisition unit, used to acquire a background frame image corresponding to the cooking area;
[0045] The target frame difference image acquisition unit is used to perform frame difference processing on the current frame image and the background frame image to acquire a target frame difference image.
[0046] Preferably, the background frame image acquisition unit comprises:
[0047] A scene frame image acquisition subunit, used to acquire a cooking scene frame image corresponding to a cooking scene within a historical set time period;
[0048] A historical frame image acquisition subunit, used for identifying the historical frame image corresponding to the cooking area in the cooking frame scene image;
[0049] A first frame difference image acquisition subunit is used to perform grayscale transformation processing on the historical frame image, and perform frame difference processing on the historical frame image of a subsequent frame after the grayscale transformation processing and the historical frame image of a previous frame to obtain a first frame difference image;
[0050] The background frame image acquisition subunit is used to use the history frame image of the next frame as the background frame image corresponding to the cooking area when the first frame difference image meets a preset condition.
[0051] Preferably, the background frame image acquisition subunit is used to obtain a first ratio between the number of white pixels and the total number of pixels in the first frame difference image; when the first ratio is less than a set threshold and lasts for a set time, the historical frame image of the next frame is used as the background frame image.
[0052] Preferably, the initial region determination module is used to obtain the initial fume motion region corresponding to the current frame image according to the region where the white pixels in the target frame difference image are located; and / or,
[0053] The centroid neighborhood calculation module includes:
[0054] A neighborhood information calculation unit, used for calculating and obtaining the center of gravity position information and area information of each of the first motion regions;
[0055] a neighborhood length determining unit, configured to determine a neighborhood length corresponding to the first motion region according to the center of gravity position information and the area information;
[0056] A center-of-gravity neighborhood determining unit is used to determine the center-of-gravity neighborhood of the first motion area according to the center-of-gravity position information and the neighborhood length.
[0057] Preferably, the centroid neighborhood includes a square neighborhood.
[0058] Preferably, the neighborhood characteristic value includes a grayscale value mean and / or a grayscale value variance corresponding to the centroid neighborhood.
[0059] Preferably, the oil fume concentration acquisition module includes:
[0060] A ratio calculation unit, used for calculating a second ratio between the number of white pixels and the total number of pixels in the oil smoke area;
[0061] A first oil fume concentration determining unit, configured to determine a first oil fume concentration corresponding to the oil fume area according to the second proportion;
[0062] The target oil fume concentration acquisition unit is used to acquire the target oil fume concentration corresponding to the cooking area according to the first oil fume concentration.
[0063] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for identifying oil fume concentration when executing the computer program.
[0064] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for identifying oil fume concentration are implemented.
[0065] On the basis of being in accordance with the common sense in the art, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present invention.
[0066] The positive and progressive effects of the present invention are:
[0067] The oil fume concentration in the cooking environment is identified and detected based on the image processing method. For the case of continuous and stable smoke, a method of motion area detection based on background frames is proposed to ensure the accuracy of oil fume motion area detection. For the situation where there are spatulas, limb interference, etc. in the motion area, a method of eliminating interfering motion areas based on centroid neighborhood eigenvalue detection is proposed. This method can effectively eliminate interfering motion areas and effectively improve the accuracy of oil fume concentration detection. Moreover, this recognition method is not affected by the detection distance, and the characteristic image of the oil fume can be captured at the moment the oil fume is generated, thereby greatly reducing the delay problem existing in the method of using physical particle detection, achieving the effect of real-time detection, ensuring the timeliness of oil fume concentration recognition, and facilitating further intelligent control, while also improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 This is a schematic diagram of the kitchen scene.
[0069] Figure 2 This is a schematic diagram of the cooking area in the kitchen scene.
[0070] Figure 3 This is a flow chart of the method for identifying oil fume concentration according to Example 1 of the present invention.
[0071] Figure 4 This is a flow chart of the method for identifying oil fume concentration according to Example 2 of the present invention.
[0072] Figure 5 This is a module schematic diagram of the oil fume concentration identification system of Example 3 of the present invention.
[0073] Figure 6 This is a module schematic diagram of the oil fume concentration identification system of Example 4 of the present invention.
[0074] Figure 7 This is a schematic diagram of the structure of an electronic device for implementing a method for identifying oil fume concentration according to Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0075] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0076] The oil fume concentration recognition technology of the present invention can be applied to oil fume concentration recognition in various application scenarios, such as oil fume concentration detection in a kitchen scenario.
[0077] Take the kitchen scene as an example. Figure 1 As shown, a represents a range hood, b represents an image acquisition device (such as a camera) arranged on the range hood, which is used to acquire scene images within the camera's viewing angle in real time; c represents a stove, and d represents a pot placed on the stove c; Figure 2 As shown, the dotted area corresponds to the cooking area, that is, the oil smoke recognition area, wherein the cooking area can be re-determined and adjusted according to actual conditions.
[0078] Example 1
[0079] like Figure 3 As shown, the method for identifying the oil smoke concentration of this embodiment includes:
[0080] S101, obtaining a current frame image corresponding to a cooking area;
[0081] Specifically, a camera installed on the range hood is used to collect corresponding scene images in the cooking scene in real time, and then image recognition technology is used to automatically identify the location of the cooking area in the scene image and its corresponding frame image, so as to facilitate subsequent oil fume recognition of the cooking area.
[0082] S102, calculating and obtaining a target frame difference image corresponding to the current frame image;
[0083] S103, determining an initial oil smoke motion area corresponding to the current frame image according to the target frame difference image;
[0084] S104, performing contour detection on the initial oil smoke motion area to obtain a plurality of first motion areas;
[0085] S105, calculating and obtaining the centroid neighborhood of the first motion region and the neighborhood feature value corresponding to the centroid neighborhood;
[0086] S106, when the neighborhood feature value meets the set threshold range, determining that the first motion area where the current center of gravity neighborhood is located belongs to the oil smoke area;
[0087] When the neighborhood eigenvalue meets the threshold range for characterizing the oil fume characteristics, the first motion area corresponding to the centroid neighborhood is determined to be the oil fume area; when the neighborhood eigenvalue does not meet the threshold range for characterizing the oil fume characteristics, the first motion area corresponding to the centroid neighborhood is determined to be the interference area and is excluded.
[0088] S107: Obtain a target oil fume concentration corresponding to the cooking area according to the oil fume area.
[0089] In this embodiment, the frame difference image corresponding to the current frame image of the cooking area is obtained to calculate the initial oil fume motion area corresponding to the current frame image, and then a plurality of first motion areas are automatically obtained based on contour detection, and the center of gravity neighborhood of each first motion area and its corresponding neighborhood eigenvalue are calculated, and then the oil fume area is accurately identified based on the neighborhood eigenvalue, that is, the interfering (spatula, limb interference, etc.) motion area is effectively excluded, thereby improving the accuracy of oil fume concentration detection; and the use of this recognition method is not affected by the detection distance, and the characteristic image of the oil fume can be captured at the moment the oil fume is generated, thereby greatly reducing the delay problem existing in the method of using physical particle detection, achieving the effect of real-time detection, and ensuring the timeliness of oil fume concentration recognition.
[0090] Example 2
[0091] like Figure 4 As shown, the method for identifying the oil smoke concentration of this embodiment is a further improvement of the embodiment 1, specifically:
[0092] Step S102 includes:
[0093] S1021, obtaining a background frame image corresponding to the cooking area;
[0094] In one feasible solution, step S1021 includes:
[0095] Acquire a cooking scene frame image corresponding to the cooking scene within a historical set time period;
[0096] Identify the historical frame image corresponding to the cooking area in the cooking frame scene image;
[0097] Performing grayscale transformation processing on the historical frame image, and performing frame difference processing on the historical frame image of a subsequent frame after the grayscale transformation processing and the historical frame image of a previous frame to obtain a first frame difference image;
[0098] When the first frame difference image meets the preset condition, the historical frame image of the next frame is used as the background frame image corresponding to the cooking area.
[0099] In an implementable solution, when the first frame difference image meets a preset condition, the step of using the subsequent historical frame image as the background frame image corresponding to the cooking area specifically includes:
[0100] Obtaining a first ratio between the number of white pixels and the total number of pixels in the first frame difference image;
[0101] When the first proportion is less than a set threshold and lasts for a set time, the historical frame image of the next frame is used as the background frame image.
[0102] S1022: Perform frame difference processing on the current frame image and the background frame image to obtain a target frame difference image.
[0103] Among them, the historical setting time period corresponds to a period of time before any current detection time. As time goes by, the background frame image corresponding to the cooking area is continuously and timely updated, ensuring the accuracy and effectiveness of the oil fume detection results in the cooking area. The frame difference method is used to select the background frame image, and then the frame difference processing is performed based on the background frame image and the current frame image to obtain the target frame difference image. Compared with the traditional method of calculating the frame difference based on the previous and next frames, it can more effectively detect oil fume, improve the accuracy of oil fume motion area detection, and thus ensure the accuracy of oil fume concentration recognition results; especially for the continuous and stable generation of oil fume (continuous and stable smoke), the motion area detection method based on the background frame can more effectively ensure the accuracy of oil fume motion area detection and identify potential oil fume motion areas to the greatest extent.
[0104] Specifically, within a certain set time period, select a certain frame of image With the previous frame image Perform frame difference processing to obtain a frame difference image Right now when When k∈[0,n)}, the pixel position is black, otherwise it is white. Where m, n are the sizes of the image to be detected, and the white part of the pixel position is the potential oil smoke movement area.
[0105] Statistical frame difference image The ratio of the number of white pixels to the total number of pixels in the video is taken into account. Taking into account the difference between the previous and next frame images caused by the noise of the video stream itself (generated by the hardware performance of the device collecting the video stream), the ratio of the number of pixels in the moving area to the number of pixels of a set value (such as 10%) can be selected as the threshold for dividing whether it is a background frame. That is, when the proportion of the moving area is less than 10% and the duration is greater than T, the current frame is taken as the background frame image in a relatively stable situation.
[0106] The background frame image is updated in real time to ensure that the frame difference image between the background frame image and the current frame image can accurately reflect the oil smoke concentration in the current scene.
[0107] Specifically, using the current frame image Image with background frame Perform frame difference calculation to obtain a target frame difference image based on the background frame image Right now
[0108] Step S103 includes:
[0109] S1031 , performing grayscale conversion processing on the target frame difference image, and obtaining an initial oil smoke motion area corresponding to the current frame image according to an area where white pixels are located in the target frame difference image after the grayscale conversion processing.
[0110] Among them, the original image can be converted into a grayscale image according to the following formula, as follows:
[0111] Gray=0.299R+0.587G+0.114B
[0112] Of course, other grayscale conversion formulas can be used to process the original image according to actual conditions, which will not be described here.
[0113] Step S105 includes:
[0114] S1051, calculating and obtaining the center of gravity position information and area information of each first motion area;
[0115] S1052, determining a neighborhood length corresponding to the first motion region according to the center of gravity position information and the area information;
[0116] S1053, determining the center of gravity neighborhood of the first motion area according to the center of gravity position information and the neighborhood length;
[0117] S1054. Calculate the neighborhood eigenvalues corresponding to each central neighborhood.
[0118] Among them, the neighborhood eigenvalues include the gray value mean and gray value variance corresponding to the centroid neighborhood.
[0119] The centroid neighborhood includes, but is not limited to, a square neighborhood.
[0120] In real cooking scenes, in most cases, the disturbances of human limbs, spatulas and other tools cannot be directly detected by background frame detection, which will cause certain interference to the movement of oil smoke. In order to eliminate these interference information, the contour elimination method based on irrelevant motion interference in the motion area is used to eliminate the relevant motion interference; specifically,
[0121] Perform contour detection on the grayscale image of the initial oil smoke motion area obtained based on the background frame detection to obtain multiple motion areas corresponding to the contours of the motion areas, and calculate the center of gravity G of each motion area i The position (x i ,y i ), and dynamically select the neighborhood size of the center of gravity coordinates according to the size of the motion area, that is, select the neighborhood length l of the center of gravity of each motion area according to prior knowledge, so as to obtain the neighborhood length l of each motion area with coordinates (x i ,y i ) is the center of gravity and the neighborhood length is l. Of course, the neighborhood length of the center of gravity of each motion area can also be re-determined or adjusted according to actual conditions.
[0122] According to the color characteristics of the oil fume itself and the color characteristics of the spatula or the human arm, it can be found that the color characteristics of the oil fume itself are quite different from the color characteristics of other interference objects, which is reflected in the gray value. The gray value means of the oil fume characteristics and other interference objects are different; in addition, since the edge contour of the oil fume itself is fuzzy, while the interference area corresponding to other interference objects has a more obvious edge, it is reflected in the neighborhood that the gray value variance of the oil fume area is small, while the variance of other interference areas is large. Therefore, according to the difference between these two features in the centroid neighborhood, the threshold interval (threshold range) of the gray value mean and gray value variance of the centroid neighborhood of the oil fume characteristics can be given in advance, thereby eliminating the influence of the interference area. The threshold interval of the gray value mean and gray value variance of the centroid neighborhood characterizing the oil fume characteristics can be obtained according to actual experience, etc., and can also be updated or adjusted according to actual conditions.
[0123] Among them, the calculation formulas for the gray value mean and gray value variance of the centroid neighborhood are as follows:
[0124]
[0125]
[0126] n=l 2
[0127] in, represents the mean gray value corresponding to the neighborhood of the centroid, Xi represents the gray value of each pixel in the centroid neighborhood, l represents the neighborhood length, S 2 Represents the gray value variance corresponding to the centroid neighborhood.
[0128] By calculating the mean gray value corresponding to each motion area in the current frame image and / or gray value variance S 2 Whether it is within the threshold range, if so, it means that the current motion area corresponds to the oil fume area, otherwise it is determined that the current motion area does not belong to the oil fume area, but corresponds to the interference area. In this way, different types of motion areas can be distinguished in real time, and the interference area can be effectively distinguished and excluded, thereby effectively improving the accuracy of oil fume area determination.
[0129] Step S106 includes:
[0130] Calculate the second ratio between the number of white pixels and the total number of pixels in the oil smoke area;
[0131] Determine a first oil fume concentration corresponding to the oil fume area according to the size of the second proportion;
[0132] A target oil fume concentration corresponding to the cooking area is obtained according to the first oil fume concentration.
[0133] The oil fume concentrations corresponding to the multiple different oil fume areas can be obtained, and the oil fume concentration corresponding to the entire cooking area can be calculated based on the oil fume concentrations in different oil fume areas, such as by summing up the oil fume concentrations in different oil fume areas and taking the average or weighted average.
[0134] In this embodiment, the oil fume concentration in the cooking environment is identified and detected based on the image processing method. In view of the continuous and stable smoke, a method of motion area detection based on the background frame is proposed to ensure the accuracy of the oil fume motion area detection; for the situation where there are spatulas, limb interference, etc. in the motion area, a method of eliminating interfering motion areas based on the detection of centroid neighborhood eigenvalues is proposed. This method can effectively eliminate interfering motion areas and effectively improve the accuracy of oil fume concentration detection; and the recognition method is not affected by the detection distance, and the characteristic image of the oil fume can be captured at the moment the oil fume is generated, thereby greatly reducing the delay problem existing in the method of using physical particle detection, achieving the effect of real-time detection, ensuring the timeliness of oil fume concentration identification, and facilitating further intelligent control, while also improving the user experience.
[0135] Example 3
[0136] like Figure 5As shown, the oil fume concentration recognition system of this embodiment includes a current frame image acquisition module 1, a target frame difference image calculation module 2, an initial area determination module 3, a contour detection module 4, a centroid neighborhood calculation module 5, an oil fume area determination module 6 and an oil fume concentration acquisition module 7.
[0137] The current frame image acquisition module 1 is used to acquire the current frame image corresponding to the cooking area;
[0138] Specifically, a camera installed on the range hood is used to collect corresponding scene images in the cooking scene in real time, and then image recognition technology is used to automatically identify the location of the cooking area in the scene image and its corresponding frame image, so as to facilitate subsequent oil fume recognition of the cooking area.
[0139] The target frame difference image calculation module 2 is used to calculate the target frame difference image corresponding to the current frame image;
[0140] The initial region determination module 3 is used to determine the initial oil smoke motion region corresponding to the current frame image according to the target frame difference image;
[0141] The contour detection module 4 is used to perform contour detection on the initial oil smoke motion area to obtain a plurality of first motion areas;
[0142] The centroid neighborhood calculation module 5 is used to calculate the centroid neighborhood of the first motion area and the neighborhood feature value corresponding to the centroid neighborhood;
[0143] The oil fume area determination module 6 is used to determine that the first motion area where the current center of gravity neighborhood is located belongs to the oil fume area when the neighborhood feature value meets the set threshold range;
[0144] When the neighborhood feature value meets the threshold range for characterizing the oil fume characteristics, the first motion area corresponding to the neighborhood of the center of gravity is determined to be the oil fume area; when the neighborhood feature value does not meet the threshold range for characterizing the oil fume characteristics, the first motion area corresponding to the neighborhood of the center of gravity is determined to be the interference area and is excluded. The oil fume concentration acquisition module 7 is used to obtain the oil fume concentration corresponding to the cooking area according to the oil fume area.
[0145] In this embodiment, the frame difference image corresponding to the current frame image of the cooking area is obtained to calculate the initial oil fume motion area corresponding to the current frame image, and then a plurality of first motion areas are automatically obtained based on contour detection, and the center of gravity neighborhood of each first motion area and its corresponding neighborhood eigenvalue are calculated, and then the oil fume area is accurately identified based on the neighborhood eigenvalue, that is, the interfering (spatula, limb interference, etc.) motion area is effectively excluded, thereby improving the accuracy of oil fume concentration detection; and the use of this recognition method is not affected by the detection distance, and the characteristic image of the oil fume can be captured at the moment the oil fume is generated, thereby greatly reducing the delay problem existing in the method of using physical particle detection, achieving the effect of real-time detection, and ensuring the timeliness of oil fume concentration recognition.
[0146] Example 4
[0147] like Figure 6 As shown, the oil fume concentration recognition system of this embodiment is a further improvement of the embodiment 3, specifically:
[0148] The target frame difference image calculation module 2 of this embodiment includes a background frame image acquisition unit 8 and a target frame difference image acquisition unit 9 .
[0149] The background frame image acquisition unit 8 is used to acquire the background frame image corresponding to the cooking area;
[0150] The target frame difference image acquisition unit 9 is used for performing frame difference processing on the current frame image and the background frame image to acquire the target frame difference image.
[0151] Specifically, the background frame image acquisition unit 8 includes a scene frame image acquisition subunit, a history frame image acquisition subunit, a first frame difference image acquisition subunit and a background frame image acquisition subunit.
[0152] The scene frame image acquisition subunit is used to acquire the cooking scene frame image corresponding to the cooking scene within the historical set time period;
[0153] The historical frame image acquisition subunit is used to identify the historical frame image corresponding to the cooking area in the cooking frame scene image;
[0154] The first frame difference image acquisition subunit is used to perform grayscale transformation processing on the historical frame image, and perform frame difference processing on the historical frame image of the subsequent frame after the grayscale transformation processing and the historical frame image of the previous frame to obtain a first frame difference image;
[0155] The background frame image acquisition subunit is used for taking the history frame image of the next frame as the background frame image corresponding to the cooking area when the first frame difference image meets a preset condition.
[0156] Among them, the background frame image acquisition subunit is used to obtain the first ratio between the number of white pixels and the total number of pixels in the first frame difference image; when the first ratio is less than the set threshold and lasts for a set time, the historical frame image of the next frame is used as the background frame image.
[0157] Among them, the historical setting time period corresponds to a period of time before any current detection time. As time goes by, the background frame image corresponding to the cooking area is continuously and timely updated, ensuring the accuracy and effectiveness of the oil fume detection results in the cooking area. The frame difference method is used to select the background frame image, and then the frame difference processing is performed based on the background frame image and the current frame image to obtain the target frame difference image. Compared with the traditional method of calculating the frame difference based on the previous and next frames, it can more effectively detect oil fume, improve the accuracy of oil fume motion area detection, and thus ensure the accuracy of oil fume concentration recognition results; especially for the continuous and stable generation of oil fume (continuous and stable smoke), the motion area detection method based on the background frame can more effectively ensure the accuracy of oil fume motion area detection and identify potential oil fume motion areas to the greatest extent.
[0158] Specifically, within a certain set time period, select a certain frame of image With the previous frame image Perform frame difference processing to obtain a frame difference image Right now when When k∈[0,n)}, the pixel position is black, otherwise it is white. Where m, n are the sizes of the image to be detected, and the white part of the pixel position is the potential oil smoke movement area.
[0159] Statistical frame difference image The ratio of the number of white pixels to the total number of pixels in the video is taken into account. Taking into account the difference between the previous and next frame images caused by the noise of the video stream itself (generated by the hardware performance of the device collecting the video stream), the ratio of the number of pixels in the moving area to the number of pixels of a set value (such as 10%) can be selected as the threshold for dividing whether it is a background frame. That is, when the proportion of the moving area is less than 10% and the duration is greater than T, the current frame is taken as the background frame image in a relatively stable situation.
[0160] The background frame image is updated in real time to ensure that the frame difference image between the background frame image and the current frame image can accurately reflect the oil smoke concentration in the current scene.
[0161] Specifically, using the current frame image Image with background frame Perform frame difference calculation to obtain a target frame difference image based on the background frame image Right now
[0162] In addition, the initial area determination module 3 of this embodiment is used to perform grayscale conversion processing on the target frame difference image, and obtain the initial oil smoke movement area corresponding to the current frame image according to the area where the white pixels in the target frame difference image after the grayscale conversion processing are located.
[0163] Among them, the original image can be converted into a grayscale image according to the following formula, as follows:
[0164] Gray=0.299R+0.587G+0.114B
[0165] Of course, other grayscale conversion formulas can be used to process the original image according to actual conditions, which will not be described here.
[0166] The centroid neighborhood calculation module 5 of this embodiment includes a neighborhood information calculation unit 10 , a neighborhood length determination unit 11 and a centroid neighborhood determination unit 12 .
[0167] The neighborhood information calculation unit 10 is used to calculate the center of gravity position information and area information of each first motion area;
[0168] The neighborhood length determining unit 11 is used to determine the neighborhood length corresponding to the first motion area according to the center of gravity position information and the area information;
[0169] The centroid neighborhood determining unit 12 is used to determine the centroid neighborhood of the first motion region according to the centroid position information and the neighborhood length.
[0170] Among them, the neighborhood eigenvalues include the gray value mean and gray value variance corresponding to the centroid neighborhood.
[0171] The centroid neighborhood includes, but is not limited to, a square neighborhood.
[0172] In real cooking scenes, in most cases, the disturbances of human limbs, spatulas and other tools cannot be directly detected by background frame detection, which will cause certain interference to the movement of oil smoke. In order to eliminate these interference information, the contour elimination method based on irrelevant motion interference in the motion area is used to eliminate the relevant motion interference; specifically,
[0173] Perform contour detection on the grayscale image of the initial oil smoke motion area obtained based on the background frame detection to obtain multiple motion areas corresponding to the contours of the motion areas, and calculate the center of gravity G of each motion area i The position (x i ,y i), and dynamically select the neighborhood size of the center of gravity coordinates according to the size of the motion area, that is, select the neighborhood length l of the center of gravity of each motion area according to prior knowledge, so as to obtain the neighborhood length l of each motion area with coordinates (x i ,y i ) is the center of gravity and the neighborhood length is l. Of course, the neighborhood length of the center of gravity of each motion area can also be re-determined or adjusted according to actual conditions.
[0174] According to the color characteristics of the oil fume itself and the color characteristics of the spatula or the human arm, it can be found that the color characteristics of the oil fume itself are quite different from the color characteristics of other interference objects, which is reflected in the gray value. The gray value means of the oil fume characteristics and other interference objects are different; in addition, since the edge contour of the oil fume itself is fuzzy, while the interference area corresponding to other interference objects has a more obvious edge, it is reflected in the neighborhood that the gray value variance of the oil fume area is small, while the variance of other interference areas is large. Therefore, according to the difference between these two features in the centroid neighborhood, the threshold interval (threshold range) of the gray value mean and gray value variance of the centroid neighborhood of the oil fume characteristics can be given in advance, thereby eliminating the influence of the interference area. The threshold interval of the gray value mean and gray value variance of the centroid neighborhood characterizing the oil fume characteristics can be obtained according to actual experience, etc., and can also be updated or adjusted according to actual conditions.
[0175] Among them, the calculation formulas for the gray value mean and gray value variance of the centroid neighborhood are as follows:
[0176]
[0177]
[0178] n=l 2
[0179] in, represents the mean gray value corresponding to the neighborhood of the centroid, X i represents the gray value of each pixel in the centroid neighborhood, l represents the neighborhood length, S 2 Represents the gray value variance corresponding to the centroid neighborhood.
[0180] By calculating the mean gray value corresponding to each motion area in the current frame image and / or gray value variance S 2 Whether it is within the threshold range, if so, it means that the current motion area corresponds to the oil fume area, otherwise it is determined that the current motion area does not belong to the oil fume area, but corresponds to the interference area. In this way, different types of motion areas can be distinguished in real time, and the interference area can be effectively distinguished and excluded, thereby effectively improving the accuracy of oil fume area determination.
[0181] The oil fume concentration acquisition module 7 of this embodiment includes a proportion calculation unit 13 , a first oil fume concentration determination unit 14 and a target oil fume concentration acquisition unit 15 .
[0182] The ratio calculation unit 13 is used to calculate a second ratio between the number of white pixels and the total number of pixels in the oil smoke area;
[0183] The first oil fume concentration determination unit 14 is used to determine the first oil fume concentration corresponding to the oil fume area according to the size of the second proportion;
[0184] The target oil fume concentration acquisition unit 15 is used to acquire the target oil fume concentration corresponding to the cooking area according to the first oil fume concentration.
[0185] The oil fume concentrations corresponding to the multiple different oil fume areas can be obtained, and the oil fume concentration corresponding to the entire cooking area can be calculated based on the oil fume concentrations in different oil fume areas, such as by summing up the oil fume concentrations in different oil fume areas and taking the average or weighted average.
[0186] In this embodiment, the oil fume concentration in the cooking environment is identified and detected based on the image processing method. In view of the continuous and stable smoke, a method of motion area detection based on the background frame is proposed to ensure the accuracy of the oil fume motion area detection; for the situation where there are spatulas, limb interference, etc. in the motion area, a method of eliminating interfering motion areas based on the detection of centroid neighborhood eigenvalues is proposed. This method can effectively eliminate interfering motion areas and effectively improve the accuracy of oil fume concentration detection; and the recognition method is not affected by the detection distance, and the characteristic image of the oil fume can be captured at the moment the oil fume is generated, thereby greatly reducing the delay problem existing in the method of using physical particle detection, achieving the effect of real-time detection, ensuring the timeliness of oil fume concentration identification, and facilitating further intelligent control, while also improving the user experience.
[0187] Example 5
[0188] Figure 7 This is a schematic diagram of the structure of an electronic device provided in Example 5 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method for identifying the oil fume concentration in Example 1 or 2 when executing the program. Figure 7 The electronic device 30 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0189] like Figure 7As shown, the electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including the memory 32 and the processor 31).
[0190] The bus 33 includes a data bus, an address bus, and a control bus.
[0191] The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and / or a cache memory 322 , and may further include a read-only memory (ROM) 323 .
[0192] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0193] The processor 31 executes various functional applications and data processing by running the computer program stored in the memory 32, such as the method for identifying the oil smoke concentration in Embodiment 1 or 2 of the present invention.
[0194] The electronic device 30 may also communicate with one or more external devices 34 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 35. Furthermore, the model generating device 30 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 36. Figure 7 As shown, the network adapter 36 communicates with other modules of the model-generated device 30 via the bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
[0195] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0196] Example 6
[0197] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the method for identifying oil fume concentration in Embodiment 1 or 2 are implemented.
[0198] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0199] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps in the method for identifying the oil fume concentration in Example 1 or 2.
[0200] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.
[0201] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A method for identifying oil smoke concentration, It is characterized in that The identification method comprises: Get the current frame image corresponding to the cooking area; Calculate and obtain a target frame difference image corresponding to the current frame image; Determine the initial oil smoke motion area corresponding to the current frame image according to the target frame difference image; Performing contour detection on the initial oil smoke motion area to obtain a plurality of first motion areas; Calculate and obtain the centroid neighborhood of the first motion area and the neighborhood eigenvalue corresponding to the centroid neighborhood; When the neighborhood characteristic value meets the set threshold range, determining that the first motion area where the current center of gravity neighborhood is located belongs to the oil smoke area; Acquire a target oil fume concentration corresponding to the cooking area according to the oil fume area; The step of calculating and obtaining a target frame difference image corresponding to the current frame image comprises: Acquire a background frame image corresponding to the cooking area; Performing frame difference processing on the current frame image and the background frame image to obtain a target frame difference image; the step of obtaining the background frame image corresponding to the cooking area includes: Acquire a cooking scene frame image corresponding to the cooking scene within a historical set time period; Identifying a historical frame image corresponding to the cooking area in the cooking scene frame image; Performing grayscale transformation processing on the historical frame image, and performing frame difference processing on the historical frame image of a subsequent frame after the grayscale transformation processing and the historical frame image of a previous frame to obtain a first frame difference image; When the first frame difference image meets the preset condition, the historical frame image of the next frame is used as the background frame image corresponding to the cooking area; when the first frame difference image meets the preset condition, the historical frame image of the next frame is used as the background frame image corresponding to the cooking area. The step includes: Obtaining a first ratio between the number of white pixels and the total number of pixels in the first frame difference image; When the first proportion is less than a set threshold and lasts for a set time, the historical frame image of the next frame is used as the background frame image.
2. The method for identifying oil smoke concentration according to claim 1, It is characterized in that The step of determining the initial oil smoke motion area corresponding to the current frame image according to the target frame difference image comprises: Performing grayscale conversion processing on the target frame difference image, and obtaining the initial oil smoke motion area corresponding to the current frame image according to the area where the white pixels in the target frame difference image after the grayscale conversion processing are located; and / or, The step of calculating and obtaining the center of gravity neighborhood of the first motion area comprises: Calculate and obtain the center of gravity position information and area information of each of the first motion areas; Determine a neighborhood length corresponding to the first motion area according to the center of gravity position information and the area information; The center-of-gravity neighborhood of the first motion region is determined according to the center-of-gravity position information and the neighborhood length.
3. The method for identifying oil smoke concentration according to claim 1, It is characterized in that The centroid neighborhood includes a square neighborhood.
4. The method for identifying the oil smoke concentration according to any one of claims 1 to 3, It is characterized in that The neighborhood characteristic value includes the gray value mean and / or gray value variance corresponding to the centroid neighborhood.
5. The method for identifying oil smoke concentration according to claim 1, It is characterized in that The step of obtaining the target oil fume concentration corresponding to the cooking area according to the oil fume area comprises: Calculate and obtain a second ratio between the number of white pixels and the total number of pixels in the oil smoke area; A first oil fume concentration corresponding to the oil fume area is determined according to the size of the second proportion, and a target oil fume concentration corresponding to the cooking area is acquired according to the first oil fume concentration.
6. A system for identifying oil fume concentration, It is characterized in that The identification system comprises: A current frame image acquisition module, used to acquire a current frame image corresponding to the cooking area; A target frame difference image calculation module, used for calculating and obtaining a target frame difference image corresponding to the current frame image; An initial region determination module, used to determine an initial oil smoke motion region corresponding to the current frame image according to the target frame difference image; A contour detection module, used for performing contour detection on the initial oil smoke motion area to obtain a plurality of first motion areas; A centroid neighborhood calculation module, used to calculate the centroid neighborhood of the first motion area and the neighborhood eigenvalue corresponding to the centroid neighborhood; A fume region determination module, configured to determine that the first motion region where the current center of gravity neighborhood is located belongs to the fume region when the neighborhood feature value meets a set threshold range; An oil fume concentration acquisition module, used for acquiring the oil fume concentration corresponding to the cooking area according to the oil fume area; The target frame difference image calculation module comprises: A background frame image acquisition unit, used to acquire a background frame image corresponding to the cooking area; A target frame difference image acquisition unit, used for performing frame difference processing on the current frame image and the background frame image to acquire a target frame difference image; The background frame image acquisition unit comprises: A scene frame image acquisition subunit, used to acquire a cooking scene frame image corresponding to a cooking scene within a historical set time period; A historical frame image acquisition subunit, used for identifying the historical frame image corresponding to the cooking area in the cooking scene frame image; A first frame difference image acquisition subunit is used to perform grayscale transformation processing on the historical frame image, and perform frame difference processing on the historical frame image of a subsequent frame after the grayscale transformation processing and the historical frame image of a previous frame to obtain a first frame difference image; A background frame image acquisition subunit, configured to use a subsequent historical frame image as the background frame image corresponding to the cooking area when the first frame difference image meets a preset condition; The background frame image acquisition subunit is used to obtain a first ratio between the number of white pixels and the total number of pixels in the first frame difference image; when the first ratio is less than a set threshold and lasts for a set time, the historical frame image of the next frame is used as the background frame image.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method for identifying the oil smoke concentration according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method for identifying oil smoke concentration described in any one of claims 1 to 5 are implemented.
