Foam recognition method, apparatus, electronic device, and storage medium
By performing inter-frame difference and brightness feature analysis on the image sequence of effluent, combined with voting strategies and statistical rules, accurate detection of foam content in effluent was achieved, solving the problem of high hardware costs and improving the real-time performance and accuracy of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies for detecting foam in wastewater require high-cost hardware and lack effective solutions.
By performing inter-frame difference processing on the image sequence to be detected, foam identification is performed using brightness feature thresholds and voting strategies, and foam proportion statistics are calculated using preset statistical rules, thus realizing the detection of foam content in discharged water.
Accurate detection of foam content in effluent can be achieved without introducing additional hardware equipment, reducing hardware costs and improving the real-time performance and accuracy of detection.
Smart Images

Figure CN114897809B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing, and in particular to a foam identification method and device, an electronic device, and a storage medium. BACKGROUND
[0002] In order to realize pollution monitoring in the production process of a factory, it is necessary to detect the pollution degree of sewage discharged by the factory. The foam content in the discharged water is directly related to the pollution degree of the discharged water. Therefore, the pollution degree of the discharged water can be determined by detecting the foam in the discharged water. At present, the foam detection of the discharged water is usually completed by arranging sensors for sensing foam in the water body. This method requires the use of a large number of sensors, which has a high hardware cost, thereby limiting the application.
[0003] At present, there is no effective solution to the problem of high hardware cost required for foam detection of discharged water in the related art. SUMMARY
[0004] The present application provides a foam identification method, device, electronic device, and storage medium to solve the problem of high hardware cost required for foam detection of discharged water in the related art.
[0005] In a first aspect, a foam identification method is provided in the present application, and the method comprises:
[0006] performing inter-frame difference processing on the to-be-detected image sequence to obtain a target frame difference image sequence;
[0007] performing foam identification on the target frame difference image sequence in a preset time period according to a brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain an initial foam identification result;
[0008] performing foam proportion statistics on the initial foam identification result according to a preset statistical rule to obtain a target foam identification result of the to-be-detected image sequence in the preset time period.
[0009] In some embodiments, before performing inter-frame difference processing on the to-be-detected image sequence to obtain a target frame difference image sequence, the method further comprises:
[0010] obtaining an original image sequence;
[0011] performing channel separation on the original image sequence in a YUV color gamut (Y represents brightness, and U and V represent chroma), and extracting Y channel image data of the original image sequence after channel separation to obtain the to-be-detected image sequence.
[0012] In some embodiments, the channel separation of the original image sequence in the YUV color gamut is performed, and the Y channel image data of the original image sequence after channel separation is extracted to obtain the to-be-detected image sequence, including:
[0013] The channel separation of the original image sequence in the YUV color gamut is performed, and the Y channel image data of the original image sequence after channel separation is extracted to obtain the Y channel image sequence;
[0014] The Y channel image sequence is subjected to histogram normalization processing to obtain the to-be-detected image sequence.
[0015] In some embodiments, the to-be-detected image sequence is subjected to inter-frame difference processing to obtain a target frame difference image sequence, including:
[0016] The difference between adjacent frames of the to-be-detected image sequence is calculated to obtain an initial frame difference image sequence;
[0017] The initial frame difference image sequence is subjected to dilation and erosion processing to obtain the target frame difference image sequence.
[0018] In some embodiments, before the target frame difference image sequence in a preset time period is subjected to foam recognition according to the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy, the method further includes:
[0019] The brightness information of each frame difference image in the target frame difference image sequence is counted to determine the brightness feature threshold.
[0020] In some embodiments, the target frame difference image sequence in a preset time period is subjected to foam recognition according to the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain an initial foam recognition result, including:
[0021] According to the brightness feature threshold, foam pixel points in each frame difference image are determined, and based on the detection result of the foam pixel points in each frame difference image and the preset voting strategy, foam pixel point voting is performed on each pixel point in the frame difference images of a preset number of frames in the preset time period to obtain the initial foam recognition result.
[0022] In some embodiments, based on the detection result of the foam pixel points in each frame difference image and the preset voting strategy, foam pixel point voting is performed on each pixel point in the frame difference images of a preset number of frames in the preset time period to obtain the initial foam recognition result, including:
[0023] According to the preset voting strategy, the frame number of each pixel point being classified as a foam pixel point in the frame difference images of the preset frame number in the preset time period is calculated;
[0024] The pixel points with the frame number of being classified as a foam pixel point greater than a preset frame number threshold are voted as foam pixel points in the preset time period, to obtain the initial foam identification result.
[0025] In some embodiments, the foam proportion statistics of the initial foam identification result is performed according to a preset statistical rule, to obtain a target foam identification result of the image sequence to be detected in the preset time period, including:
[0026] According to a preset block rule, the frame difference images in the target frame difference image sequence are image blocked, the pixel proportion of the foam pixel points in each image block is calculated according to the initial foam identification result, if the pixel proportion is greater than a preset proportion threshold, the image block is determined as foam, otherwise, the image block is determined as non-foam, to obtain the target foam identification result.
[0027] In a second aspect, a foam identification device is provided in the embodiment, including: an inter-frame difference module, a foam identification module, and a statistics module, wherein:
[0028] The inter-frame difference module is configured to perform inter-frame difference processing on the image sequence to be detected, to obtain a target frame difference image sequence.
[0029] The foam identification module is configured to perform foam identification on the target frame difference image sequence in the preset time period according to a preset voting strategy and a corresponding brightness feature threshold of the target frame difference image sequence, to obtain an initial foam identification result.
[0030] The statistics module is configured to perform foam proportion statistics on the initial foam identification result according to a preset statistical rule, to obtain a target foam identification result of the image sequence to be detected in the preset time period.
[0031] In a third aspect, an electronic device is provided in the embodiment, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the foam identification method of the first aspect when executing the computer program.
[0032] In a fourth aspect, a storage medium is provided in the embodiment, and the storage medium stores a computer program, and the program is executed by a processor to implement the foam identification method of the first aspect.
[0033] Compared with the related art, the foam identification method, device, electronic device and storage medium provided in the embodiment, by performing inter-frame difference processing on the to-be-detected image sequence, obtaining a target frame difference image sequence, according to the brightness feature threshold corresponding to the target frame difference image sequence and the preset voting strategy, performing foam identification on the target frame difference image sequence in a preset time period to obtain an initial foam identification result, and according to a preset statistical rule, performing foam proportion statistics on the initial foam identification result to obtain a target foam identification result of the to-be-detected image sequence in the preset time period. It realizes the statistics of the foam content in the monitoring area based on image analysis, without introducing additional hardware devices, thereby reducing the hardware cost of foam detection of the discharged water.
[0034] The details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objects and advantages of the present application more clear and simple. BRIEF DESCRIPTION OF DRAWINGS
[0035] The drawings described herein are used to provide further understanding of the present application, constitute a part of the present application, the schematic embodiments of the present application and the description thereof are used to explain the present application, and do not constitute improper limitation on the present application. In the drawings:
[0036] Figure 1 It is an application scene diagram of the foam identification method of the present embodiment;
[0037] Figure 2 It is a flowchart of the foam identification method of the present embodiment;
[0038] Figure 3 It is a detection result schematic diagram of the foam identification method of the present embodiment at the drain;
[0039] Figure 4 It is a flowchart of the foam identification method of the preferred embodiment;
[0040] Figure 5 It is a structural block diagram of the foam identification device of the present embodiment. DETAILED DESCRIPTION
[0041] In order to more clearly understand the purpose, technical scheme and advantages of the present application, the present application is described and explained below in combination with the drawings and embodiments.
[0042] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," and "third," etc., used in this application are merely for distinguishing similar objects and do not represent a specific ordering of the objects.
[0043] The method embodiments provided in this example can be executed in a computer or a smart camera. Figure 1 This is an application scenario diagram of the foam recognition method in this embodiment. For example... Figure 1 As shown in the figure, the area enclosed by the line segments represents the factory drainage outlet where foam identification is to be performed. Cameras installed at the factory drainage outlet can capture real-time drainage video. This drainage video is processed into a sequence of images to be detected using a computer or smart camera. After inter-frame differencing of this sequence, a target frame difference image sequence is obtained. Then, based on the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy, foam identification is performed on the target frame difference image sequence within a preset time period to obtain the initial foam identification result. Finally, according to preset statistical rules, the foam proportion of the initial foam identification result is statistically analyzed to obtain the target foam identification result of the image sequence to be detected within the preset time period, thus obtaining the final foam identification result. Figure 1 The distribution of foam in the water at the drainage outlet.
[0044] This embodiment provides a foam identification method. Figure 2 This is a flowchart of the foam recognition method in this embodiment, as shown below. Figure 2 As shown, the process includes the following steps:
[0045] Step S210, inter-frame difference processing is performed on the to-be-detected image sequence to obtain a target frame difference image sequence.
[0046] The to-be-detected image sequence can specifically be an image sequence obtained after pre-processing of a continuous image sequence of a preset number of frames extracted from original monitoring video of an application scene. For example, video data of a factory sewage outlet in a monitoring scene can be subjected to video frame extraction, a number of frames per second can be extracted to combine a continuous image sequence, and the continuous image sequence can be pre-processed to obtain the to-be-detected image sequence. The number of extracted frames can be determined according to an actual application scene. Illustratively, 4 frames per second can be extracted to combine a continuous image sequence. Further, after obtaining the continuous image sequence, the image sequence can be subjected to channel separation according to a YUV color gamut to obtain a Y channel image sequence, thereby reducing the influence of color changes in the application scene on the accuracy of the foam recognition result. In addition, after obtaining the Y channel image sequence, the Y channel image can be subjected to histogram normalization processing to obtain the final to-be-detected image sequence, thereby reducing the influence of brightness changes on the accuracy of the recognition result.
[0047] In addition, after obtaining the to-be-detected image sequence, each two adjacent frames in the sequence can be regarded as an image pair, inter-frame difference processing can be performed on the image pair, and the absolute value of the difference can be taken as the inter-frame difference result of the image pair, thereby obtaining a target frame difference image sequence of the to-be-detected image sequence.
[0048] Step S220, according to a brightness feature threshold value corresponding to the target frame difference image sequence and a preset voting strategy, foam recognition is performed on the target frame difference image sequence in a preset time period to obtain an initial foam recognition result.
[0049] The brightness feature threshold value can be adaptively adjusted according to a statistical result of brightness feature information of the target frame difference image sequence. For example, the mean value of Y channel information in each frame difference image can be taken as the brightness feature threshold value of the frame difference image. The brightness feature threshold value can also be determined according to other information of the image, and the specific determination manner can be adjusted according to an actual application scene, which is not limited herein. Further, each pixel point in each frame difference image can be compared with the brightness feature threshold value, and all pixel points in each frame difference image can be classified as foam pixel points or not. A foam pixel point is a pixel point in a foam region of a water body. That is, if a region in a water body is foam, the pixel point in the frame difference image corresponding to the region is a foam pixel point. Illustratively, if the value of a pixel point in a frame difference image is greater than the brightness feature threshold value, the pixel point is initially classified as foam in the frame.
[0050] After the bubble pixel points in each frame difference image are classified, the bubble pixel points in the frame difference images of the preset frame number in the preset time period are voted through a preset voting strategy, and the bubble pixel points in the preset time period are further determined according to the voting result. For example, under the premise that 4 frames of video data are extracted per second to obtain the sequence of images to be detected, a sequence of 8 adjacent target frame difference images in 2 seconds can be selected. For a certain pixel point on a frame difference image, if it is classified as a bubble pixel point in the preset frame number, it can be determined that the pixel point is a bubble pixel point in the time period of 2 seconds. In summary, according to the brightness feature threshold and the preset voting strategy, the bubble recognition result of the frame difference image in the preset time period based on the pixel point can be obtained, which is used as the initial bubble recognition result.
[0051] By using the inter-frame difference method and the brightness feature threshold to recognize bubbles in the image, the interference of other factors in the image on the bubble recognition result can be reduced, and the accuracy of the bubble recognition result can be improved, so that the real-time of the bubble detection in the monitoring scene can be realized without relying on related hardware devices, the accuracy of the detection can be improved, and the cost of the bubble detection device can be reduced.
[0052] In step S230, the initial bubble recognition result is statistically analyzed according to a preset statistical rule to obtain a target bubble recognition result of the sequence of images to be detected in the preset time period.
[0053] The statistical rule is used to statistically analyze the initial bubble recognition result on the basis of step S220. Specifically, after it is determined whether each pixel point in the frame difference image is a bubble pixel point according to the initial bubble recognition result, the frame difference image can be statistically analyzed by blocks. For example, the image can be divided into 32x32 image blocks. The number of bubble pixel points in each image block is counted. If the number exceeds a preset proportion threshold, for example, 50%, the image block is marked as a bubble. If the number is less than the preset proportion threshold, the image block is marked as non-bubble, so that the bubble distribution in the entire scene in the preset time period is obtained.
[0054] In order to more intuitively display the bubble distribution in the application scene in real time, the image blocks classified as bubbles can be marked as red circular rings, and the image blocks classified as non-bubbles can be marked as green circular rings. It should be noted that the size of the image block and the determination of the proportion threshold can be set according to the actual application scene and requirements. For example, the size of the image block can be considered comprehensively considering the time consumption of the identification process, the hardware conditions and the like, which is not limited in the present embodiment. For example, Figure 3 The detection result of the drainage port of the bubble recognition method provided in the present embodiment is shown in the figure. Figure 3As shown, it can be known that the foam identification method of the embodiment can accurately identify the foam and non-foam in the water body, and mark them respectively. Among them, the foam identification method of the embodiment marks the foam in the water body as a dark circle in the figure, and marks the non-foam in the water body as a light circle in the figure, so as to clearly display the foam distribution of the drain outlet, and then facilitate the staff to further evaluate the pollution degree of the water body.
[0055] The steps S210 to S230 described above, by performing inter-frame difference processing on the to-be-detected image sequence, obtain a target frame difference image sequence, according to the brightness feature threshold corresponding to the target frame difference image sequence and the preset voting strategy, perform foam identification on the target frame difference image sequence in the preset time period, obtain an initial foam identification result, and according to a preset statistical rule, perform foam proportion statistics on the initial foam identification result, and obtain a target foam identification result of the to-be-detected image sequence in the preset time period. It realizes the statistics of the foam content in the monitoring area based on image analysis, without introducing additional hardware devices, thereby reducing the hardware cost of foam detection of the discharged water.
[0056] Further, in an embodiment, based on the step S210 described above, before performing inter-frame difference processing on the to-be-detected image sequence to obtain a target frame difference image sequence, the foam identification method can further include the following steps:
[0057] Step S211, obtaining an original image sequence. The original image sequence can be a continuous image sequence obtained by frame extraction of the video.
[0058] Step S212, performing channel separation of YUV color gamut on the original image sequence, and extracting Y channel image data of the original image sequence after channel separation to obtain a to-be-detected image sequence. By performing channel separation of YUV color gamut on the original image sequence and extracting Y channel image data, the influence of color change in the scene on the accuracy of the foam identification result can be reduced, thereby improving the accuracy of the foam identification.
[0059] Further, in an embodiment, based on the step S212 described above, performing channel separation of YUV color gamut on the original image sequence, and extracting Y channel image data of the original image sequence after channel separation to obtain a to-be-detected image sequence, specifically can include the following steps: performing channel separation of YUV color gamut on the original image sequence, and extracting Y channel image data of the original image sequence after channel separation to obtain a Y channel image sequence; performing histogram normalization processing on the Y channel image sequence to obtain a to-be-detected image sequence.
[0060] By histogram normalization processing on the Y channel image, the influence of the brightness change in the image on the accuracy of the recognition result can be reduced, and the similarity of the statistical features between adjacent frames can be improved, thereby improving the accuracy of the foam recognition result of the water body in the application scenario.
[0061] Additionally, in one embodiment, based on the above step S210, the inter-frame difference processing is performed on the to-be-detected image sequence to obtain a target frame difference image sequence, specifically including the following steps:
[0062] Step S213, calculating the difference value between adjacent frames of the to-be-detected image sequence in the to-be-detected image sequence to obtain an initial frame difference image sequence;
[0063] Step S214, performing dilation and erosion processing on the initial frame difference image sequence to obtain the target frame difference image sequence.
[0064] The above steps S213 to S214, by performing dilation and erosion processing on the frame difference image, can reduce the influence of water ripples fluctuation in the application scenario on the foam recognition result, thereby improving the robustness of the foam detection to the environment.
[0065] Additionally, in one embodiment, before performing the foam recognition on the target frame difference image sequence in the preset time period according to the brightness feature threshold corresponding to the target frame difference image sequence and the preset voting strategy to obtain the initial foam recognition result, the above foam recognition method can further include the following steps: statistics the brightness information of each frame of the frame difference image in the target frame difference image sequence to determine the brightness feature threshold.
[0066] Specifically, by statistics the brightness information of each frame of the frame difference image, the brightness feature of each frame of the frame difference image can be determined, so as to adjust the corresponding brightness feature threshold based on the brightness feature of each frame of the frame difference image. Exemplarily, the Y channel information mean of each frame of the frame difference image can be calculated, and the Y channel information mean is taken as the brightness feature threshold. By determining the brightness feature threshold based on the brightness information of each frame of the frame difference image, the accuracy of the foam recognition result can be improved.
[0067] Additionally, in one embodiment, based on the above step S220, the foam recognition is performed on the target frame difference image sequence in the preset time period according to the brightness feature threshold corresponding to the target frame difference image sequence and the preset voting strategy to obtain the initial foam recognition result, specifically including the following steps:
[0068] Step S221, determining the foam pixel points in each frame difference image according to the brightness feature threshold value, and performing foam pixel point voting on each pixel point in the frame difference images of the preset number of frames within the preset time period based on the detection result of the foam pixel points of each frame difference image and the preset voting strategy to obtain an initial foam recognition result. The brightness feature threshold value is determined based on the pixels of each frame difference image in the target frame difference image sequence. Through the brightness feature threshold value and the preset voting strategy, the initial foam recognition result based on the pixel points in the frame difference image can be realized, thereby improving the accuracy of water body foam recognition.
[0069] Further, in one embodiment, based on the above step S221, based on the detection result of the foam pixel points of each frame difference image and the preset voting strategy, the foam pixel point voting is performed on each pixel point in the frame difference images of the preset number of frames within the preset time period to obtain the initial foam recognition result, which can specifically include the following steps: according to the preset voting strategy, the number of frames in which each pixel point is classified as a foam pixel point in the frame difference images of the preset number of frames within the preset time period is calculated; the pixel points whose number of frames classified as foam pixel points is greater than the preset frame number threshold value are voted as foam pixel points within the preset time period to obtain the initial foam recognition result.
[0070] That is, if the pixel at a certain pixel point position is identified as a foam pixel point in multiple frame difference images, the confidence that the pixel point position belongs to the water body foam region is greater. Therefore, the pixel point can be classified as a foam pixel point. By processing the foam pixel points of multiple frame difference images through the voting strategy, the initial foam recognition result is obtained, which can further improve the accuracy of foam recognition.
[0071] Additionally, in one embodiment, based on the above step S230, the initial foam recognition result is statistically counted according to the preset statistical rule to obtain the target foam recognition result of the image sequence to be detected within the preset time period, which can specifically include the following steps:
[0072] Step S231, performing image blocking on the frame difference images in the target frame difference image sequence according to the preset blocking rule, calculating the pixel ratio of the foam pixel points in each image block according to the initial foam recognition result, and if the pixel ratio is greater than the preset ratio threshold value, determining the image block as foam, otherwise, determining the image block as non-foam to obtain the target foam recognition result.
[0073] The pixel ratio based blocking statistical method can confirm the real-time situation of foam distribution in the application scenario, which can reduce the calculation amount of foam distribution statistics, thereby reducing the performance requirements of the operation chip. The foam recognition method of the embodiment does not need to set a sensing device in the water body, so the application deployment cost of the equipment is reduced on the premise of improving the accuracy of foam recognition.
[0074] The present embodiment is described and explained below by preferred embodiments.
[0075] Figure 4 is a flow chart of the foam recognition method of the present preferred embodiment. As shown in Figure 4 the foam recognition method comprises the following steps:
[0076] Step S401, 4 frames are extracted from the original video per second to combine a continuous image sequence;
[0077] Step S402, the continuous image sequence is separated by channel according to the YUV color field to obtain a Y channel image sequence;
[0078] Step S403, the Y channel image sequence is subjected to histogram normalization;
[0079] Step S404, adjacent frame images in the Y channel image sequence after histogram normalization are taken as an image pair, and difference values are obtained for all image pairs to obtain a frame difference image sequence;
[0080] Step S405, the frame difference image sequence is subjected to dilation and erosion operation;
[0081] Step S406, the mean value of the frame difference image is taken as a threshold value, and if the pixel value in the frame difference image is greater than the threshold value, the pixel point is identified as a foam pixel point;
[0082] Step S407, in adjacent 8 frame difference images, the number of frames in which each pixel point position is identified as a foam pixel point is counted, and if the number of frames is greater than a preset frame number threshold, the pixel point is confirmed as a foam pixel point;
[0083] Step S408, the frame difference image is divided into blocks according to 32x32, the proportion of pixels in each image block that are foam pixel points is counted, and when the proportion exceeds a preset proportion threshold, the image block is confirmed as foam, otherwise it is confirmed as non-foam, and the foam distribution is obtained.
[0084] In the present embodiment, a foam recognition device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has been described and will not be repeated. The terms "module", "unit", "sub-unit" and the like used below can be a combination of software and / or hardware that realizes a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and is conceived.
[0085] Figure 5 is a structural block diagram of the foam recognition device 50 of the present embodiment, as shown in Figure 5As shown, the foam recognition device 50 comprises an interframe difference module 52, a foam recognition module 54, and a statistics module 56, wherein:
[0086] The interframe difference module 52 is configured to perform interframe difference processing on the image sequence to be detected to obtain a target frame difference image sequence.
[0087] The foam recognition module 54 is configured to perform foam recognition on the target frame difference image sequence in a preset time period according to a brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain an initial foam recognition result.
[0088] The statistics module 56 is configured to perform foam proportion statistics on the initial foam recognition result according to a preset statistics rule to obtain a target foam recognition result of the image sequence to be detected in the preset time period.
[0089] The foam recognition device 50 described above performs interframe difference processing on the image sequence to be detected to obtain a target frame difference image sequence, performs foam recognition on the target frame difference image sequence in a preset time period according to a brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain an initial foam recognition result, and performs foam proportion statistics on the initial foam recognition result according to a preset statistics rule to obtain a target foam recognition result of the image sequence to be detected in the preset time period. Based on image analysis, the foam content in the monitoring area is counted without introducing additional hardware devices, thereby reducing the hardware cost of foam detection of the discharged water.
[0090] It should be noted that each of the above modules can be a functional module or a program module, which can be implemented by software or hardware. For the modules implemented by hardware, each of the above modules can be located in the same processor; or each of the above modules can also be located in different processors in any combination.
[0091] In this embodiment, an electronic device is also provided, which comprises a memory and a processor, the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the above method embodiments.
[0092] Optionally, the electronic device can further comprise a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0093] Optionally, in this embodiment, the processor can be configured to execute the following steps through the computer program:
[0094] perform interframe difference processing on the image sequence to be detected to obtain a target frame difference image sequence;
[0095] According to the brightness feature threshold corresponding to the target frame difference image sequence and the preset voting strategy, the target frame difference image sequence in the preset time period is subjected to foam recognition, and an initial foam recognition result is obtained.
[0096] According to a preset statistical rule, the initial foam recognition result is subjected to foam proportion statistics, and a target foam recognition result of the image sequence to be detected in the preset time period is obtained.
[0097] It should be noted that the specific examples in the present embodiment can refer to the examples described in the above embodiments and optional implementation manners, which will not be described herein again.
[0098] In addition, in combination with the foam recognition method provided in the above embodiments, a storage medium can also be provided in the present embodiment to implement. The storage medium has a computer program stored thereon; the computer program is executed by a processor to implement any one of the foam recognition methods in the above embodiments.
[0099] It should be understood that the specific embodiments described herein are only used to explain this application, but not to limit it. According to the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the present application.
[0100] Obviously, the drawings are only some examples or embodiments of the present application, and those of ordinary skill in the art can also apply the present application to other similar situations according to the drawings without creative labor. In addition, it can be understood that although the work done in the development process may be complex and long, for those of ordinary skill in the art, some design, manufacture or production changes according to the technical content disclosed in the present application are only routine technical means, and should not be regarded as insufficient disclosure of the present application.
[0101] The term "embodiment" in the present application means that the specific features, structures or characteristics described in combination with the embodiments can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean independence or alternative to other embodiments. Those of ordinary skill in the art can clearly or implicitly understand that the embodiments described in the present application can be combined with other embodiments without conflict.
[0102] The above embodiments only express several implementation ways of the present application, and the description is specific and detailed, but it should not be understood as a limitation to the patent protection scope. It should be pointed out that, for ordinary skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A foam identification method, characterized in that, include: The image sequence to be detected is subjected to inter-frame difference processing to obtain the target frame difference image sequence; Based on the brightness feature threshold corresponding to the target frame difference image sequence and the preset voting strategy, foam recognition is performed on the target frame difference image sequence within a preset time period to obtain the initial foam recognition result. The initial foam identification results are statistically analyzed according to preset statistical rules to determine the proportion of foam, thereby obtaining the target foam identification results for the image sequence to be detected within a preset time period; wherein, The step of performing bubble recognition on the target frame difference image sequence within a preset time period based on the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain an initial bubble recognition result includes: Based on the brightness feature threshold, bubble pixels in each frame difference image are determined, and based on the detection results of bubble pixels in each frame difference image and the preset voting strategy, bubble pixel voting is performed on each pixel in the frame difference image of a preset number of frames within the preset time period to obtain the initial bubble recognition result. The step of performing foam proportion statistics on the initial foam recognition results according to preset statistical rules to obtain the target foam recognition results of the image sequence to be detected within a preset time period includes: The frame difference image in the target frame difference image sequence is divided into image blocks according to the preset block division rules. The pixel ratio of bubble pixels in each image block is calculated based on the initial bubble recognition result. If the pixel ratio is greater than the preset ratio threshold, the image block is determined to be a bubble; otherwise, the image block is determined to be a non-bubble, and the target bubble recognition result is obtained.
2. The foam identification method according to claim 1, characterized in that, Before performing inter-frame difference processing on the image sequence to be detected to obtain the target frame difference image sequence, the method further includes: Obtain the original image sequence; The original image sequence is subjected to YUV color gamut channel separation, and the Y channel image data after channel separation is extracted to obtain the image sequence to be detected.
3. The foam identification method according to claim 2, characterized in that, The step of performing YUV color gamut channel separation on the original image sequence and extracting the Y channel image data after channel separation to obtain the image sequence to be detected includes: The original image sequence is subjected to YUV color gamut channel separation, and the Y channel image data after channel separation is extracted to obtain the Y channel image sequence; The Y-channel image sequence is subjected to histogram normalization to obtain the image sequence to be detected.
4. The foam identification method according to claim 1, characterized in that, The step of performing inter-frame difference processing on the image sequence to be detected to obtain the target frame difference image sequence includes: Calculate the difference between adjacent frames of the image to be detected in the image to be detected sequence to obtain an initial frame difference image sequence; The initial frame difference image sequence is subjected to dilation and erosion processing to obtain the target frame difference image sequence.
5. The foam identification method according to claim 1, characterized in that, Before performing bubble recognition on the target frame difference image sequence within a preset time period based on the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain the initial bubble recognition result, the method further includes: The brightness information of each frame difference image in the target frame difference image sequence is statistically analyzed to determine the brightness feature threshold.
6. The foam identification method according to claim 1, characterized in that, The method, based on the detection results of bubble pixels in each frame difference image and the preset voting strategy, performs bubble pixel voting on each pixel in the frame difference image of a preset number of frames within the preset time period to obtain the initial bubble recognition result, including: According to the preset voting strategy, calculate the number of frames in the frame difference image of the preset number of frames within the preset time period, in which each pixel is classified as a bubble pixel. Pixels that are classified as bubble pixels in frames with a number greater than a preset frame threshold are voted as bubble pixels within the preset time period to obtain the initial bubble recognition result.
7. A foam identification device, characterized in that, include: The system includes an inter-frame difference module, a foam detection module, and a statistics module; among which: The inter-frame difference module is used to perform inter-frame difference processing on the image sequence to be detected to obtain the target frame difference image sequence. The foam recognition module is used to perform foam recognition on the target frame difference image sequence within a preset time period based on the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy, so as to obtain an initial foam recognition result. The statistics module is used to perform foam proportion statistics on the initial foam recognition results according to preset statistical rules, to obtain the target foam recognition results of the image sequence to be detected within a preset time period; wherein, The step of performing bubble recognition on the target frame difference image sequence within a preset time period based on the brightness feature threshold corresponding to the target frame difference image sequence and a preset voting strategy to obtain an initial bubble recognition result includes: Based on the brightness feature threshold, bubble pixels in each frame difference image are determined, and based on the detection results of bubble pixels in each frame difference image and the preset voting strategy, bubble pixel voting is performed on each pixel in the frame difference image of a preset number of frames within the preset time period to obtain the initial bubble recognition result. The step of performing foam proportion statistics on the initial foam recognition results according to preset statistical rules to obtain the target foam recognition results of the image sequence to be detected within a preset time period includes: The frame difference image in the target frame difference image sequence is divided into image blocks according to the preset block division rules. The pixel ratio of bubble pixels in each image block is calculated based on the initial bubble recognition result. If the pixel ratio is greater than the preset ratio threshold, the image block is determined to be a bubble; otherwise, the image block is determined to be a non-bubble, and the target bubble recognition result is obtained.
8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the foam recognition method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the foam recognition method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for detecting, tracking and recognizing movement visible exogenous impurity in medicine liquid
CN101354359A
Accumulated water detection method and device, storage medium and electronic device
CN111402301A