A flocculation analysis method and system based on alum flower morphology monitoring and a storage medium

By combining a monocular camera with the MOG2 model, real-time monitoring and automatic early warning of floc size and compactness were achieved, solving the problems of poor real-time performance, difficulty in dynamic identification, and low computational efficiency in existing technologies, and providing stable flocculation status assessment and dosing guidance.

CN121482062BActive Publication Date: 2026-04-10AOTU TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-12
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing methods for monitoring the flocculation state of flocs suffer from poor real-time performance, difficulty in dynamic identification, low computational efficiency, large errors in agglomerated particles, complex equipment, and high reliance on manual labor, making it impossible to achieve continuous and real-time assessment of floc particle size and compactness.

Method used

A monocular camera combined with the MOG2 model is used for background modeling and shadow detection. Through morphological opening operations and connected component analysis, the average particle size and compactness of the floc are calculated, and a time-series curve is generated to achieve real-time monitoring and automatic early warning frame by frame.

Benefits of technology

It enables real-time and reliable monitoring of dynamic flocs, removes unflocculated particles, generates stable particle size and compactness time-series curves, guides dosing adjustments and flocculation status diagnosis, and reduces equipment complexity and manual dependence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482062B_ABST
    Figure CN121482062B_ABST
Patent Text Reader

Abstract

The application discloses a flocculation analysis method and system based on alum flower shape monitoring and a storage medium, and belongs to the technical field of water treatment. Images of underwater flocculation are continuously collected and an image sequence is formed. The image sequence is input into a MOG2 model, and a foreground mask image is output, wherein dynamic and focus clear alum flowers are marked as white. Alum flower shape parameters are evaluated, the average particle size and average compactness of the alum flowers are calculated, and the pixel units of the alum flower shape parameters are converted into size units. Based on the average particle size and average compactness of each frame of image, a particle size time sequence curve and a compactness time sequence curve are drawn, the flocculation effect is analyzed, and dosing is controlled. The application can recognize dynamic and focus clear alum flowers, realizes continuous, real-time and reliable measurement of flocculation shape parameters, analyzes the flocculation effect from the angles of alum flower diameter and compactness in a high-quality manner, and has good practicability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of water treatment, and particularly relates to a flocculation analysis method and system based on monitoring of alunite flower morphology and a storage medium. BACKGROUND

[0002] In the water treatment process, the flocculation state of alunite flower directly affects the coagulation and sedimentation effect. The traditional method and some existing calculation methods usually rely on manual intervention, which is not only time-consuming and laborious, but also cannot reflect the dynamic changes of alunite flower in the water body, and lacks real-time performance. Secondly, the existing monitoring methods can only process static images, cannot calculate a large number of images in a short time, and cannot identify and measure the continuously dynamic alunite flower in the water; thus, the dynamic changes of the alunite flower particle size cannot be displayed. In practice, only when the dynamic changes of the alunite flower are known, the flocculation effect can be accurately judged, otherwise, it is difficult to judge the flocculation effect only by a few static images; real-time analysis is very important, and only by mastering the dynamic changes in real time, the coagulation and flocculation stage can be accurately judged in time.

[0003] Specifically, the existing monitoring methods of the flocculation state of alunite flower include the following schemes:

[0004] (1) Microscope offline measurement method: after taking water samples, the alunite flower particles are observed under a microscope, and the particle size is converted by manually measuring the pixels or a scale; the specific steps include sampling, slicing, photographing, and manual measurement and recording. However, the disadvantage is time-consuming and cannot reflect the dynamic changes;

[0005] (2) Static image particle size analysis method: a camera is installed on the side of the water pool to take a single or a small number of static images, the alunite flower contour is extracted by threshold segmentation, and the particle diameter is calculated; the specific steps include photographing, image preprocessing, threshold segmentation, and diameter calculation. However, the disadvantage is that it cannot handle continuous dynamic processes, and is greatly dependent on light and focus;

[0006] (3) Multi-camera / high-end optical system method: multiple cameras or special optical devices are used to simultaneously take alunite flower from different angles, and the particle size is calculated by using 3D reconstruction and other advanced technologies; the specific steps include multi-camera calibration, acquisition, three-dimensional reconstruction, particle identification, and size measurement. However, the disadvantage is that the equipment is complex, the cost is high, and it is difficult to use in large scale in the field;

[0007] (4) Monocular video offline analysis method: continuous video is taken, and the alunite flower contour is manually labeled, and then the particle size is calculated; the specific steps include video acquisition, frame-by-frame extraction, manual labeling, and diameter calculation. However, the disadvantage is that the manual participation is high, the calculation efficiency is low, and real-time monitoring cannot be truly realized.

[0008] In summary, the above methods mainly have the following defects:

[0009] (1) Real-time performance is poor: manual sampling and offline microscopic measurement cannot reflect the instantaneous changes of the flocculation process;

[0010] (2) Dynamic recognition is difficult: static images or simple threshold methods cannot distinguish between truly moving and clearly focused alum flowers, and may mistakenly include unfocused or water flow impurities in the measurement;

[0011] (3) Low calculation efficiency: traditional methods cannot process a large amount of data in a short time, and it is difficult to continuously monitor frame by frame, while the algorithm of the present application has fast operation speed and can calculate the particle size of each frame of video in real time;

[0012] (4) Large error of adhering particles: when multiple particles are too close, the measured diameter is larger; and some central clear but peripheral incomplete alum flowers may be underestimated in diameter by background modeling;

[0013] (5) High dependence on manual operation: existing methods often require manual selection and parameter adjustment, which is tedious and difficult to achieve continuous monitoring;

[0014] (6) Complex equipment: existing methods often rely on multiple cameras or complex optical systems, while the present application only needs a monocular camera and an optional scale to complete the measurement. SUMMARY

[0015] The present application aims to provide a flocculation analysis method and system based on alum flower morphology monitoring, and a storage medium, which aims to solve any one of the above technical problems and realize real-time evaluation of the particle size and compactness of alum flowers in the process of dynamic flocculation in water.

[0016] The present application is mainly realized by the following technical solutions:

[0017] A flocculation analysis method based on alum flower morphology monitoring, comprising the following steps:

[0018] Step S1: data acquisition and preprocessing; continuously acquiring images of underwater flocculation and forming an image sequence;

[0019] Step S2: dynamic foreground extraction; input the image sequence into the MOG2 model and output the foreground mask image, wherein the dynamic and clearly focused alum flowers are marked as white, and the background and shadow areas are marked as black or gray;

[0020] Step S3: evaluate the alum flower morphology parameters;

[0021] Step S31: calculate the average particle size of the alum flower; based on the foreground mask image, perform connected component analysis on the alum flower region, draw the minimum bounding rectangle in the alum flower region, and calculate the equivalent circle diameter according to the area of the minimum bounding rectangle as the particle size value of the alum flower, in units of pixels; then, calculate the average particle size of all alum flowers in each frame of image;

[0022] Step S32: evaluating the average compactness of the alum flowers; calculating the compactness T=P / A of each alum flower, and calculating the average compactness of all the alum flowers in each frame image;

[0023] Wherein: P is the number of white pixels in the minimum circumscribed rectangle belonging to the alum flower;

[0024] A is the equivalent circle area of the minimum circumscribed rectangle, in units of pixels;

[0025] Step S4: converting the pixel unit of the alum flower shape parameters into size unit;

[0026] Step S5: based on the average particle size and average compactness of each frame image, drawing a particle size time curve and a compactness time curve; based on the particle size time curve and the compactness time curve, analyzing the flocculation effect to control the dosing.

[0027] In order to better realize the present application, further, in the step S3, the average particle size and the average compactness of the alum flowers are respectively calculated based on a mode and median fusion calculation method; the mode and median fusion calculation method is that: the mode and the median of the particle size / compactness of all the alum flowers in each frame image are extracted, and the average value of the mode and the median is taken as the average particle size or the average compactness.

[0028] In order to better realize the present application, further, in the step S31, first, the white region in the foreground mask image is extracted, and morphological opening operation is performed to make each alum flower become a relatively independent region; then, connected domain analysis is performed.

[0029] In order to better realize the present application, further, in the step S5, in the initial flocculation stage, the particle size of the alum flower is small and grows slowly, and the compactness is at a low level; in the coagulation acceleration stage, the particle size and the compactness of the alum flower continue to increase synchronously; in the mature stage of the floc, the particle size and the compactness of the alum flower are stable; in the disintegration or dispersion stage, the particle size and the compactness of the alum flower decrease synchronously.

[0030] In order to better realize the present application, further, in the step S5, if the particle size and the compactness of the alum flower both rise with the change of time, the flocculation normally grows and tends to the mature stage;

[0031] If the particle size and the compactness of the alum flower both decrease with the change of time, the floc disintegrates or is mixed excessively or the water sample is impacted;

[0032] If the particle size of the alum flower increases with the change of time, and the compactness decreases with the change of time, it indicates that the alum flower grows but the structure is loose, and it is judged that the medicament is insufficient at this time;

[0033] If the particle size of the alum flower does not change with the change of time, and the compactness rises with the change of time, the alum flower is gradually compacted and is in a coagulation state.

[0034] To better realize the present application, further, in the step S5, if the particle size and compactness of the alum flower are both continuously less than the set threshold value, and the growth rate is less than the set threshold value, it is judged that the coagulation reaction is insufficient, and it is warned that the drug is insufficient; if the growth rate of the particle size of the alum flower is greater than the set threshold value, and it cannot be kept stable in the later period, and the compactness cannot be synchronously improved or is less than the set threshold value, it is judged that the excessive drug causes the charge reversal, and the alum flower is dispersed.

[0035] To better realize the present application, further, in the step S5, if the particle size of the alum flower suddenly decreases or continuously decreases, and the compactness synchronously decreases or the change fluctuation is greater than the set threshold value, it is judged that the stirring in water is too fast, and the flocculation structure is abnormal; if the particle size of the alum flower is greater than the set threshold value, and it is kept stable all the time, and the compactness is in a decreasing trend, it is judged that the internal structure of the alum flower is loose, and the flocculation structure is abnormal.

[0036] The present application is mainly realized through the following technical solutions:

[0037] A flocculation analysis system based on alum flower morphology monitoring is based on the above-mentioned flocculation analysis method based on alum flower morphology monitoring, comprising a data acquisition and preprocessing module, a dynamic foreground extraction module, a morphology parameter evaluation module, a size conversion module and an analysis and early warning module.

[0038] The data acquisition and preprocessing module is used for continuously shooting the images of underwater flocculation, and processing to obtain a video sequence and extracting an image sequence.

[0039] The dynamic foreground extraction module is used for extracting the foreground mask of the image based on the MOG2 model.

[0040] The morphology parameter evaluation module is used for evaluating the average particle size and the average compactness of the alum flower based on the foreground mask.

[0041] The size conversion module is used for converting the unit of the morphology parameters of the alum flower into a size unit.

[0042] The analysis and early warning module is used for analyzing the flocculation effect based on the particle size time sequence curve and the compactness time sequence curve, so as to control the drug addition.

[0043] A computer readable storage medium, which stores a computer program, the program being executed by a processor to realize the above-mentioned flocculation analysis method based on alum flower morphology monitoring.

[0044] The present application has the following beneficial effects:

[0045] (1) The present application can identify dynamic and clear alum flowers, use robust statistics to remove abnormal particles, and convert the real size through the scale in the picture to realize continuous, real-time and reliable flocculation particle size measurement without manual intervention. Specifically, the present application uses a monocular underwater camera to obtain a video sequence, models the background through a MOG2 model (Gaussian Mixture Model 2) and enables shadow detection, so that the formed and clear alum flowers are automatically retained as strong foreground, and the semi-transparent and un-flocculated alum flowers are separated as shadow-type weak foreground, thereby realizing the screening of clear alum flowers that can be used for particle size calculation.

[0046] (2) After foreground screening, the present application removes noise and breaks adhesion through morphological opening operation, extracts the minimum circumscribed rectangle for each alum flower region, and calculates the equivalent circle diameter as the particle size estimate value based on the circumscribed rectangle area. This method does not depend on the regularity of alum flower shape, and has stability in evaluating the shape with edge notches and local holes, so that unified particle size measurement of alum flowers of any shape can be realized. At the same time, the alum flower compactness is obtained by statistically calculating the proportion of white pixels inside the rectangle, which is used to measure whether the flocculation is complete and the structure is solid, and this index can be used to distinguish the states of flocculation formation, semi-transparent and loose, etc. The above method can reflect the size and maturity of the alum flower at the same time. Then, the mode and median of the particle size of all alum flowers in the same frame are fused and calculated, and the present application can effectively suppress the abnormal values caused by alum flower adhesion, dispersion or local unfocusing, and obtain stable and reliable average particle size of the current frame.

[0047] (3) The present application can realize real-time calculation of average particle size and compactness frame by frame (or according to a set time step) only by relying on a monocular camera, and can automatically generate the time sequence change curve of the two, which is used to observe the flocculation growth speed, compare the flocculation effect under different dosing amounts or water quality conditions, and provide key reference for online dosing adjustment and flocculation state diagnosis. In the application process, the monocular camera only needs to be fixed at the transparent observation window of the coagulation tank or alum flower reaction area, and the system can automatically estimate the average particle size of the alum flower in the water frame by frame in real time.

[0048] (4) The present application uses the shadow detection mechanism of MOG2 to innovatively distinguish the formed and clear alum flowers from the semi-transparent and un-flocculated alum flowers, and only calculates the subsequent clear alum flowers, which solves the problem of inaccurate particle size caused by the inability to remove blurred alum flowers in the traditional method.

[0049] (5) In view of the problems of poor real-time performance, difficulty in dynamic recognition, low calculation efficiency, large error of adhesion particles, complex equipment and high dependence on manual operation in the prior art, the present application can realize:

[0050] 1) Real-time monitoring of alum flower particle size in water frame by frame, reflecting the instantaneous change of the flocculation process;

[0051] 2) Identify dynamic and in-focus alum flowers, reject unfocused or peripherally incomplete flocculation particles to reduce measurement errors;

[0052] 3) High computational efficiency, capable of frame-by-frame processing of video or monitoring, achieving continuous monitoring without delay;

[0053] 4) Robust statistical methods are used to handle adhesion or abnormal particles to obtain stable and reliable single-frame average particle size;

[0054] Simplify the equipment, only one monocular camera (mandatory) and ruler (optional), reduce the installation and maintenance difficulty;

[0055] 5) Low requirements for shooting environment, suitable for alum flower monitoring under different light, water quality, container or installation angle conditions, without specific background or light source configuration;

[0056] 6) No manual intervention or complex operation, suitable for long-term online automatic monitoring. BRIEF DESCRIPTION OF DRAWINGS

[0057] Figure 1 Flowchart of the flocculation analysis method based on alum flower morphology monitoring of the present application;

[0058] Figure 2 Principle diagram of the flocculation analysis system based on alum flower morphology monitoring of the present application;

[0059] Figure 3 Classification diagram of alum flowers based on MOG2 recognition of the present application;

[0060] Figure 4 The image taken and the corresponding extracted foreground mask image;

[0061] Figure 5 The schematic diagram of setting a ruler on the taken image;

[0062] Figure 6 Example diagram of particle size time series curve in Example 1;

[0063] Figure 7 Schematic diagram of particle size time series curve and compactness time series curve when flocculation is normal;

[0064] Figure 8 Schematic diagram of particle size time series curve and compactness time series curve when the dosage is insufficient;

[0065] Figure 9 Schematic diagram of particle size time series curve and compactness time series curve when the dosage is excessive;

[0066] Figure 10 Example one of particle size time series curve and compactness time series curve when the flocculation structure is abnormal;

[0067] Figure 11 Example 2 shows the particle size and compaction time series curves when the flocculation structure is abnormal. Detailed Implementation

[0068] Example 1:

[0069] A flocculation analysis method based on monitoring floc morphology, such as Figure 1 As shown, it includes the following steps:

[0070] Step S1: Data acquisition and preprocessing;

[0071] After fixing the camera, continuously capture video of alum flocs in the water. Next, the frame rate or preset time step can be set according to requirements. For example, for a real-time monitoring video, the average particle size of the image can be calculated every 1 second, but the entire monitoring video is still input into MOG2 because MOG2 requires real-time background modeling.

[0072] Step S2: Dynamic foreground extraction;

[0073] MOG2 background modeling and shadow suppression are performed, preserving the white areas of the mask for opening operations. Specifically, MOG2 background modeling is performed on the first n frames of the video, and shadow suppression is enabled; dynamic floc pixels are marked as white, while the background and shadows are marked as black or gray; a foreground mask is generated, with flocs marked in white for subsequent diameter measurement. The specific steps include:

[0074] (1) Perform MOG2 background modeling on the first n frames of the video to learn stable background features in the water. The MOG2 model distinguishes pixels that are stable in the long term (belonging to the background) and pixels that change in a short time (belonging to dynamic flocs) by performing Gaussian mixture modeling on the brightness changes of each pixel;

[0075] (2) Enable the shadow detection function to exclude the blurred areas caused by shadows or water flow disturbances, and retain only the dynamic foreground image;

[0076] like Figure 3 As shown, this invention classifies alum floc into clear-flocculated floc and blurred-unflocculated floc. The clear-flocculated floc is detected using the MOG2 model. Subsequently, the average particle size and average compactness of the floc are extracted based on this to classify it into compact and loose floc, which facilitates reliable subsequent flocculation analysis and dosing control.

[0077] Specifically, the shadow detection of the MOG2 model marks the pixels with similar color direction to the background and small brightness change as weak foreground (gray). Correspondingly, the uncoagulated and semi-transparent alum flowers in the water have similar pixel characteristics to the shadow, while the mature and clear-edged alum flowers are identified as strong foreground (white), which is proved to be feasible in subsequent experiments.

[0078] The present application uses the shadow discrimination principle of MOG2 to automatically distinguish "clear / coagulated alum flowers" from "fuzzy / uncoagulated alum flowers", without the need for additional sensors, manual threshold, or model training. This mechanism realizes the automatic grading and screening of dynamic alum flowers, effectively eliminates the interference of fuzzy alum flowers on particle size calculation, and makes the real-time particle size estimation more stable and reliable.

[0079] (3) In the modeling process, the MOG2 model uses the following parameter settings (after experimental testing, this parameter setting is more stable and suitable for more different environments. The identification conditions are more demanding, so it can identify the clearest part of the alum flower in the current image and will not miss the clear alum flower):

[0080] history=500, varThreshold=16, detectShadows=True;

[0081] Among them:

[0082] history=500 means that the model will use the pixel history statistics of the previous 500 frames for background learning, so that the background model updates smoothly and will not be misjudged as foreground due to short-term fluctuations (such as water flow or bubbles);

[0083] varThreshold=16 means the sensitivity threshold for judging whether a pixel deviates from the background model. This value is stable in underwater environments and can better distinguish alum flower movement from background light changes;

[0084] detectShadows=True means that the shadow detection function is turned on, and the algorithm will automatically mark gray pixels as shadow areas, thereby automatically eliminating the fuzzy images caused by light refraction and water flow disturbance.

[0085] (4) The output of the MOG2 model is a foreground mask image, in which dynamic and focused alum flowers are marked as white pixels, while the background and shadow areas are marked as black or gray.

[0086] For example: For the MOG2 model, according to the recommended parameter setting history=500, process the first 500 frames of video (e.g. monitor frame rate 60fps, 500 frames ≈ 8.3 seconds); that is, the MOG2 model models the background by referring to the Gaussian mixture parameter statistical weight of about the last 500 frames. For example,Figure 4 As shown in (b), in the MOG2 model simulation, clear alunite flowers are clearly identified without being affected by the cluttered background, and unclear alunite flowers are basically identified as gray areas. The identified alunite flowers are marked as white areas, and all the clear alunite flowers are coagulated into blocks.

[0087] As shown in (b), in the MOG2 model simulation, clear alunite flowers are clearly identified without being affected by the cluttered background, and unclear alunite flowers are basically identified as gray areas. The identified alunite flowers are marked as white areas, and all the clear alunite flowers are coagulated into blocks. Figure 4 As shown in (b), in the MOG2 model simulation, clear alunite flowers are clearly identified without being affected by the cluttered background, and unclear alunite flowers are basically identified as gray areas. The identified alunite flowers are marked as white areas, and all the clear alunite flowers are coagulated into blocks.

[0088] Step S3: evaluating the alunite morphology parameters;

[0089] Step S31: calculating the average particle size of alunite;

[0090] (1) Foreground reservation and morphological opening operation; specifically, only the strong foreground (255 white) area of the foreground mask image output by the MOG2 model is reserved. Then, morphological opening operation is performed on the foreground image to remove noise and small adhesions, so that each alunite flower becomes a relatively independent region.

[0091] (2) Connected region identification and bounding rectangle screening; connected region analysis is performed on the processed image, and the minimum bounding rectangle of each foreground region (independent alunite flower region) is drawn. Regions with an area less than a set threshold (such as 10 pixels) are directly ignored to avoid counting small fragments that have not coagulated as complete alunite flowers.

[0092] (3) Calculation of the equivalent circle diameter of the bounding rectangle; the actual shape of alunite is often irregular, so the equivalent circle diameter of the bounding rectangle is used as the particle size of a single alunite flower in the present application. Specifically, the equivalent circle diameter of each bounding rectangle is calculated according to its area, which is used as the particle size value of the alunite flower, and is suitable for alunite flowers of various irregular shapes.

[0093] Performing the mode and median fusion calculation method on all particle diameters in the frame; the mode and median of all alunite particle diameters in the frame are calculated, and the average value of the two is taken as the final average particle diameter of the frame. This method can simultaneously resist the "large value" caused by alunite adhesion and the "small value" caused by poor coagulation, and the result is stable and reliable. That is, the mode and median fusion calculation method can simultaneously solve the problems of large single particle diameter caused by adhesion particles and small diameter caused by incomplete coagulation at the focus or periphery.

[0094] The mode can effectively reflect the typical particle size with the highest frequency of occurrence, and is suitable for the overall trend description of large samples. The median is not sensitive to extreme values (such as abnormal large / small values caused by alum flower adhesion or dispersion), and can represent the center position of data distribution, ensuring the stability of the results. For a sufficient number of alum flowers in the actual scene, the mode and the median should be similar, and the average of the two can reflect the robustness of the algorithm design. The calculation meets the millisecond-level real-time processing, and all operations are low-complexity geometric and morphological processing, which can be completed in milliseconds per frame, ensuring real-time performance under video frame rate.

[0095] Step S32: evaluating the average compactness of the alum flowers;

[0096] To evaluate whether each alum flower is coagulated and compact, the present application introduces the concept of compactness, which is essentially the proportion of white pixels to shape area. The compactness T = P / A;

[0097] Where: P is the number of white pixels within the circumscribed rectangle belonging to the alum flower;

[0098] A is the equivalent circular area of the circumscribed rectangle (i.e. the area of the circumscribed rectangle, unit px);

[0099] If T is high, the flocculation is formed, the structure is compact, and the edge is clear; if T is low, the flocculation is incomplete, the edge is loose or translucent alum flower.

[0100] Further, by analogy, the mode and median fusion calculation method is used to calculate the alum flower compactness index T.

[0101] The reason for calculating the average alum flower particle size in the picture based on the mode and median fusion calculation method, rather than the particle size of each individual alum flower, is as follows:

[0102] In the early stage of flocculation, there are many alum flowers in the captured image, and the diameter is small. For the same batch of water samples with uniform dosing, the formation and growth of alum flowers in the water body are basically consistent at the same time, and the difference between individual particles will not affect the overall trend. The core purpose of monitoring the flocculation of alum flowers is to guide the dosing amount or observe the overall flocculation state, rather than the accurate size of each individual particle. Therefore, using the average particle size as a representative value can not only reflect the overall flocculation level, but also significantly simplify the calculation and avoid complex single-particle segmentation and tracking process. This processing method not only improves the real-time performance and calculation efficiency, but also makes the obtained data more smooth in time series, which is more suitable for control feedback or trend analysis.

[0103] For example, taking a certain moment as an example, after background modeling and focus screening, the system identifies 15 clear alum flower particles. The calculated average particle size of each alum flower is 48, 50, 52, 49, 51, 49, 50, 50, 49, 90, 47, 48, 49, 51 and 50, and the unit is pixel. It can be seen that most of the alum flower particle sizes are concentrated in 48-51 pixels, and 90 pixels is obviously an abnormal value caused by adhesion of alum flowers. The mode is 50, the median is also 50, and the average value of the picture is 50 pixels. Under normal conditions of the alum flower, the calculated mode and median should be consistent. Similarly, the compactness can also be calculated in this way, and the average compactness of the picture can be calculated.

[0104] Step S4: convert the pixel unit of the alum flower shape parameter into the size unit, that is, convert the pixel into the actual size;

[0105] Calculate the corresponding millimeter size of each pixel by measuring the ruler with a known length in the picture; convert the average particle size of each frame from pixel to actual size and output the real-time value. Among them, the ruler only needs to be measured once, as long as the camera and focal length are fixed, the conversion ratio of pixel to millimeter is constant, and consistent measurement can be ensured. For example, as shown in Figure 5 , place a 1cm ruler at the focus (the ruler in the figure is a demonstration drawing) which can be a ruler or a reference object with a known length. It is recommended to use a white rectangular object which is easy to calculate. Focus on the conversion relationship when there is no alum flower, for example, 1cm length corresponds to 50px, then 1px≈0.2mm, which can be used to convert the alum flower particle size.

[0106] Step S5: based on the average particle size and average compactness of each frame of image, draw the particle size time sequence curve and the compactness time sequence curve; based on the particle size time sequence curve and the compactness time sequence curve, analyze the flocculation effect to control the addition of chemicals.

[0107] The average particle size or average compactness of each frame is composed of time sequence data to generate a time change curve to obtain the corresponding particle size time sequence curve and compactness time sequence curve. Specifically:

[0108] (1) Particle size time sequence curve: form the time sequence data of the average particle size of each frame (or according to the preset time step) to draw the curve of the change of particle size with time in real time. For example, as shown in Figure 6 , simulate the average particle size of alum flowers from 19:10 to 19:30, start adding chemicals at 19:12, and sample and calculate once every 1min to obtain the particle size time sequence curve of the time period.

[0109] (2) Compactness time sequence curve: take the average compactness of each frame (or according to the preset time step) as another time sequence curve to show the change trend of the flocculation quality (compactness / looseness) of alum flowers.

[0110] Based on the above particle size time curve and the compactness time curve linkage to determine the flocculation effect:

[0111] (1) If the particle size and compactness both rise with time, the flocculation is normal growth, tend to mature;

[0112] (2) If the particle size increases with time, but the compactness decreases with time, the alum flower grows but the structure is loose, and the reagent may be insufficient;

[0113] (3) If the particle size does not change, but the compactness rises with time, the small alum flower is becoming compact, in the condensation;

[0114] (4) If the particle size and compactness both decrease with time, the floc is disintegrated, mixed too much or the water sample is impacted.

[0115] Specifically, based on the above real-time calculation of the average particle size and the average compactness of two core features, the change trend of which is used to realize the automatic state recognition and abnormal early warning function of the flocculation process.

[0116] (1) State discrimination mechanism;

[0117] The system comprehensively analyzes the average particle size change rate, the average compactness change rate and the cooperative change relationship of the two, automatically identifies the typical stages in the flocculation process, including but not limited to:

[0118] 1) Initial flocculation stage: small particle size and slow growth, low compactness;

[0119] 2) Condensation acceleration stage: particle size continues to increase, compactness increases synchronously;

[0120] 3) Floc maturation stage: particle size stabilizes within a certain range, compactness maintains at a high level;

[0121] 4) Disintegration or dispersion stage: particle size decreases accompanied by compactness decrease.

[0122] As shown in Figure 7 , the initial flocculation stage has very small particle size, which slowly rises, and the compactness is low but gradually increases. The condensation acceleration stage has rapid particle size growth, which is the fastest rising stage, and the compactness increases synchronously. The floc maturation stage has stable particle size, and the compactness approaches a high value and remains stable.

[0123] The state discrimination adopts a combination strategy of threshold interval, trend direction and change amplitude, which does not depend on fixed parameters, and can be adaptively adjusted according to the water body conditions, improving the universality and robustness.

[0124] (2) Abnormal recognition mechanism;

[0125] The system continuously monitors the particle size and compactness sequence, and automatically triggers a warning when the following abnormal patterns occur:

[0126] 1) Insufficient dosing: the particle size is consistently small or grows slowly, and the compactness is at a low level for a long time, and neither the particle size nor the compactness has a significant upward trend. The system determines that the coagulation reaction is insufficient, which should be due to insufficient dosing. As shown in Figure 8 , the average particle size is maintained at a low level for a long time and grows slowly; the compactness is also in a low value range and has no obvious upward trend. It shows that the alum amount is insufficient to cause the alum flower to grow normally, and the coagulation reaction is insufficient. The red dots in the figure are the simulated possible alarm points.

[0127] 2) Excessive dosing; the particle size increases rapidly for a short time, and then is unstable, and the compactness cannot be increased synchronously or is at an abnormally low level. The system determines that it may be due to excessive dosing causing charge reversal, and the alum flower is dispersed. As shown in Figure 9 , the particle size rises sharply in the early stage, but then fluctuates greatly; the compactness does not increase synchronously or is at an abnormally low value. It may be due to excessive dosing causing charge reversal, so that the alum flower structure cannot be kept stable, and the aggregation-disintegration cycle occurs. The alarm will be triggered at multiple time points, and the red dots in the figure are the simulated possible alarm points.

[0128] 3) Abnormal flocculation structure;

[0129] ① The particle size suddenly decreases or continuously decreases, and the compactness decreases synchronously or fluctuates sharply. The system determines that it may be due to excessive stirring in water, which affects the flocculation of the alum flower.

[0130] ② The particle size remains large and stable, but the compactness decreases slowly. The system determines that the internal structure is loose, which may be due to aging of the flocculation, and the alum flower stays in the pool for too long.

[0131] As shown in Figure 10 , the particle size and compactness both normally rise in the first half, but suddenly decrease at the same time in the middle, which may be due to flocculation destruction / excessive stirring. As shown in Figure 11 , the average particle size continuously increases or even remains stable, but the compactness shows a continuous downward trend in the second half, which may be due to aging of the flocculation / structure loosening. The red dots in the figure are the simulated possible alarm points.

[0132] Example 2:

[0133] A flocculation analysis system based on alum flower morphology monitoring, as shown in Figure 2 , includes:

[0134] 1. A data acquisition and preprocessing module for continuously shooting images of underwater flocculation, processing video sequences, and extracting image sequences;

[0135] Underwater video acquisition, as shown in Figure 5As shown, in the process of acquisition, a ruler or reference object is pasted at the focusing position. Specifically, a monocular underwater camera is fixed at a transparent observation window of a coagulation tank or a reaction zone for continuously acquiring a video sequence of alum flower movement. Preferably, a ruler of known length can be placed in the field of view for conversion of pixels to actual size.

[0136] 2. a dynamic foreground extraction module;

[0137] The dynamic foreground extraction module is used for MOG2 background modeling and shadow suppression, and the mask white area is reserved for open operation.

[0138] The application uses the shadow detection principle in the MOG2 model to distinguish between "clear / flocculation good" and "fuzzy / unclear flocculation good" alum flowers, automatically separates the dynamic and clear alum flower area from the continuous video, and is not disturbed by static impurities or light changes.

[0139] The MOG2 model is an existing dynamic extraction algorithm, and the application identifies clear alum flowers based on the "shadow detection" function of the MOG2 model. The principle of shadow detection is that shadow usually makes the original background pixel dark, but does not change the original color relationship. Therefore, the MOG2 model detects the change of the current pixel brightness, but the color direction is consistent. Accordingly, as shown in (a) of FIG. 1, in actual application, the unclear alum flower is white and translucent, and the color direction is consistent in the background but the brightness changes. Therefore, although the unclear alum flower does not belong to shadow, the pixel behavior meets the shadow condition, and as shown in (b) of FIG. 1, the MOG2 model treats it as a shadow-like foreground weak signal. Figure 4 Figure 4

[0140] 3. The morphology parameter evaluation module is used for evaluating the average particle size and average compactness of the alum flower based on the foreground mask image.

[0141] For the alum flower area, a minimum circumscribed rectangle is made, the compactness and equivalent circular diameter are analyzed, and then the average particle size and average compactness of the alum flower are statistically obtained.

[0142] 4. A size conversion module is used for converting the unit of the morphology parameter of the alum flower into a size unit.

[0143] If it is necessary to correspond the pixel to the actual millimeter size, a ruler is placed. According to the ruler, the millimeter size corresponding to each pixel is converted, and the average particle size of the current frame is converted from pixel to actual size. The pixel value can also reflect the change of the alum flower particle size, however, the change is only applicable to a single scene. If more scenes are compared together, the conversion can be made according to the actual situation.

[0144] ​​5. Analysis and early warning module, for analyzing flocculation effect based on particle size time curve and compactness time curve to control dosing; specifically including:

[0145] (1) Visualization module, for displaying time series trend chart in real time on control large screen or scientific research analysis platform, so that the operator can see the size change and maturity change of alum flower flocculation process in real time, facilitating intuitive judgment of flocculation effect and intuitive judgment of running state.

[0146] (2) Flocculation diagnosis and early warning module, for diagnosing flocculation state and performing abnormal early warning based on average particle size and average compactness.

[0147] The present application realizes real-time, automatic and interpretable monitoring and early warning of flocculation state, and significantly enhances the intelligent degree of water treatment system. The present application constructs a completely automatic processing flow of video input -> MOG2 foreground screening -> morphological opening operation denoising -> particle size and compactness calculation -> time series visualization -> abnormal alarm, and can perform real-time analysis on streaming monitoring video or recorded video.

[0148] The system can generate average particle size-time and average compactness-time curves for intuitive display of flocculation process change; and when particle size and compactness are abnormal, the system can automatically trigger an alarm according to the set rules. The present application only needs a single camera to realize real-time monitoring and abnormal identification of alum flower state, and can be used to guide online dosing adjustment, process optimization or continuous monitoring of scientific research experiments.

[0149] The present application only needs a single camera to realize millisecond-level real-time calculation frame by frame, does not depend on complex equipment, is not affected by water quality, illumination and background change, and has the advantages of low cost, high adaptability, no maintenance, etc. The system can also automatically generate time series trend curves of particle size and compactness, and can be further used for dosing adjustment, flocculation effect comparison and flocculation state diagnosis, providing continuous and reliable online monitoring capability for water treatment sites and scientific research experiments. The potential application fields of the present application include:

[0150] Real-time floc monitoring in coagulation tanks of waterworks can use the results of the present application as one of the reference indexes for real-time feedback of dosing amount control;

[0151] Flocculation performance comparison: the average particle size of the present application can draw time series trend curves of particle size change, and can directly compare the coagulation speed under different conditions (such as different reagents or different pH conditions), helping to find the optimal flocculation method;

[0152] University and scientific research experiment platform: for automatically recording "floe growth process" without sampling or offline microscope measurement;

[0153] The water treatment equipment manufacturing plant is used for taking the "real-time alum flower particle size" as a monitoring parameter of a new generation of intelligent coagulation equipment, and can realize unattended operation.

[0154] The water plant large screen visualization uses the time sequence particle size curve for on-site monitoring large screen display, realizes production site visualization and trend early warning, and enables non-professional operators to directly understand the flocculation trend.

[0155] The above is only a preferred embodiment of the present application, and does not limit the present application in any form. Any simple modification or equivalent change made on the basis of the technical essence of the present application to the above embodiment falls within the protection scope of the present application.

Claims

1. A flocculation analysis method based on alum flower morphology monitoring, characterized by, The method comprises the following steps: Step S1: data acquisition and preprocessing; Continuously collecting images of flocculation under water and forming an image sequence; Step S2: dynamic foreground extraction; inputting the image sequence into a MOG2 model and outputting a foreground mask image, wherein the dynamic and focus clear alum flowers are marked as white, and the background and shadow area are marked as black or gray; Step S3: evaluating alum flower morphology parameters; Step S31: calculating the average particle size of alum flowers; based on the foreground mask image, performing connected component analysis on the alum flower area, drawing a minimum bounding rectangle in the alum flower area, and calculating the equivalent circular diameter of the minimum bounding rectangle as the particle size value of the alum flower, in units of pixels; then, calculating the average particle size of all alum flowers in each frame of image; Step S32: evaluating the average compactness of alum flowers; calculating the compactness T=P / A of each alum flower, and calculating the average compactness of all alum flowers in each frame of image; Wherein: P is the number of white pixels in the minimum bounding rectangle belonging to the alum flower; A is the equivalent circular area of the minimum bounding rectangle, in units of pixels; Step S4: converting the pixel units of the alum flower morphology parameters into size units; Step S5: based on the average particle size and average compactness of each frame of image, drawing a particle size time sequence curve and a compactness time sequence curve; based on the particle size time sequence curve and the compactness time sequence curve, analyzing the flocculation effect to control dosing.

2. The flocculation analysis method based on alum flower morphology monitoring according to claim 1, characterized in that, In the step S3, the average particle size and the average compactness of the alum flowers are respectively calculated based on a mode and median fusion calculation method; the mode and median fusion calculation method is: extracting the mode and median of the particle size / compactness of all alum flowers in each frame of image, and taking the average value of the mode and the median as the average particle size or the average compactness.

3. The flocculation analysis method based on alum flower morphology monitoring according to claim 1, characterized in that, In the step S31, first, the white area in the foreground mask image is extracted, and morphological opening operation is performed to make each alum flower a relatively independent area; Then, connected component analysis is performed.

4. A flocculation analysis method based on monitoring alum flower morphology according to any one of claims 1-3, characterized in that, In the step S5, in the initial flocculation stage, the particle size of the alum flower is small and grows slowly, and the compactness is at a low level; in the coagulation acceleration stage, the particle size and the compactness of the alum flower continue to increase synchronously; In the mature stage of the floc, the particle size and the compactness of the alum flower are stable; in the disintegration or dispersion stage, the particle size and the compactness of the alum flower decrease synchronously.

5. The flocculation analysis method based on alum flower morphology monitoring according to claim 4, characterized in that, In the step S5, if the particle size and the compactness of the alum flower both rise with time, the flocculation grows normally and tends to the mature stage; If the particle size and the compactness of the alum flower both decrease with time, the floc disintegrates or is mixed excessively or the water sample is impacted; If the particle size of the alum flower increases with time and the compactness decreases with time, it indicates that the alum flower grows but the structure is loose, and it is judged that the reagent is insufficient; If the particle size of the alum flower does not change with time and the compactness rises with time, the alum flower is gradually compacted and is in a coagulation state.

6. The flocculation analysis method based on alum flower morphology monitoring according to claim 4, characterized in that, In the step S5, if the particle size and the compactness of the alum flower both continue to be less than a set threshold value, and the growth rate is less than a set threshold value, it is judged that the coagulation reaction is insufficient, and it is warned that the reagent is insufficient; if the growth rate of the particle size is greater than a set threshold value, and it cannot be stable in the later stage, and the compactness cannot be simultaneously improved or is less than a set threshold value, it is judged that excessive dosing causes charge reversal, and the alum flower disperses.

7. The flocculation analysis method based on alum flower morphology monitoring according to claim 4, characterized in that, In the step S5, if the particle size of the alum flower suddenly decreases or continuously decreases, and the compactness simultaneously decreases or changes with a fluctuation greater than a set threshold, it is determined that the stirring in water is too fast, and the flocculation structure is abnormal. If the particle size of the alum flower is greater than a set threshold, and remains stable, and the compactness is in a decreasing trend, it is determined that the internal structure of the alum flower is loose, and the flocculation structure is abnormal.

8. A flocculation analysis system based on monitoring of alum flower morphology, carried out based on a method of flocculation analysis based on monitoring of alum flower morphology according to any one of claims 1-7, characterized by, The data acquisition and preprocessing module is used for continuously shooting images of flocculation under water, and processing the images to obtain a video sequence and extract an image sequence; The dynamic foreground extraction module is used for extracting a foreground mask of the image based on a MOG2 model; The morphological parameter evaluation module is used for evaluating the average particle size and the average compactness of the alum flower based on the foreground mask; The size conversion module is used for converting the unit of the morphological parameters of the alum flower into a size unit; The analysis and early warning module is used for analyzing the flocculation effect based on the particle size time curve and the compactness time curve, so as to control dosing. The program is executed by the processor to realize the flocculation analysis method based on alum flower morphology monitoring in any one of claims 1-7.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, ​

Citation Information

Patent Citations

  • Water treatment dosing control method and device based on alumen ustum detection

    CN116012701A

  • Water treatment dosing method and dosing system based on alumen ustum detection

    CN120081476A