Detection system for industrial wastewater treatment
By using Gaussian kernel convolution and Lab color space conversion, the instability problem of floc identification and water quality detection in industrial wastewater treatment was solved, achieving accurate identification of flocs and rapid response to water quality anomalies, thus improving the stability and accuracy of the detection system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-03-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional visual inspection technology has difficulty distinguishing between large, loose, and difficult-to-settle flocs and compact, easy-to-settle, high-quality flocs in industrial wastewater treatment. Furthermore, changes in lighting and water surface reflection affect the stability of the inspection results, resulting in a lack of substantial basis for process control.
Image preprocessing is performed using Gaussian kernel convolution, and adaptive segmentation is performed by calculating the mean gray value of local neighborhood pixels. The gradient magnitude and fractal dimension are calculated by combining the floc morphology feature module, and converted into Lab color space values. The judgment module determines water quality anomalies and calculates the dosage increment.
It enables accurate identification of flocs and rapid identification of water quality anomalies in industrial wastewater treatment, reduces the occurrence of excessive reagents or substandard treatment, and improves the stability and accuracy of detection.
Smart Images

Figure CN121724974A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of visual detection, and in particular to a detection system for industrial wastewater treatment. BACKGROUND
[0002] Visual detection technology is to simulate human visual function by using machine vision system, and to realize automatic identification, measurement, positioning and defect detection of objects in a non-contact manner.
[0003] When dealing with complex industrial wastewater environment, traditional visual detection technology often relies on global threshold segmentation or single RGB color space analysis. In outdoor or semi-open sedimentation tank scenes, natural light changes, shadow shielding and water surface reflection will interfere with image acquisition quality, causing the target recognition algorithm to misjudge the light and shadow fluctuations as suspended solids or impurities, resulting in unstable detection results. At the same time, conventional morphological analysis usually only focuses on simple geometric features such as particle diameter and projection area, and it is difficult to distinguish between large and loose difficult-to-settle flocs and compact and easy-to-settle high-quality flocs, so that the process control based on morphological feedback lacks substantial basis. Therefore, improvement is needed. SUMMARY
[0004] The purpose of the present application is to solve the shortcomings in the prior art and to provide a detection system for industrial wastewater treatment.
[0005] In order to achieve the above purpose, the present application adopts the following technical scheme: a detection system for industrial wastewater treatment comprises: A sedimentation image preprocessing module is used to acquire an industrial sedimentation tank acquisition image, perform a Gaussian kernel convolution operation on the acquisition image pixel matrix, generate a smooth denoising image, calculate the local neighborhood pixel gray mean value for each pixel gray value of the smooth denoising image, divide the foreground flocculation body pixels and the background water body pixels, and generate a binary flocculation segmentation graph; A flocculation body morphological feature module is used to calculate the flocculation body region pixel gradient amplitude, locate the gradient amplitude mutation position, generate a flocculation body edge contour set, construct a multi-level size grid to cover the flocculation body edge contour set, and calculate and generate a flocculation compact fractal dimension according to the binary flocculation segmentation graph; A wastewater chroma deviation detection module is used to extract the background water body region RGB component and convert it to Lab color space value according to the background water body region associated with the flocculation compact fractal dimension, extract the a channel and b channel values to construct a liquid phase Lab color feature vector, call a preset standard discharge sample covariance matrix and mean vector, combine the liquid phase Lab color feature vector, and calculate and generate a chroma abnormal deviation value; A determination module is configured to compare the chromaticity abnormal deviation value with an allowable chromatic aberration statistical threshold, determine a water quality abnormality determination signal, compare the flocculation compact fractal dimension with a compact structure reference value according to the water quality abnormality determination signal, and calculate a dosing increment based on the difference.
[0006] Preferably, the acquiring step of the binary flocculation segmentation map comprises: An image of an industrial sedimentation tank is acquired, a Gaussian kernel size and a boundary padding strategy are set, kernel convolution operation is performed on the acquired image pixel matrix pixel by pixel, high-frequency noise interference is suppressed, and a smooth denoising image is generated; According to the smooth denoising image, the gray values of each pixel point of the smooth denoising image are extracted, a local neighborhood window size and a sliding step size are set, the window is slid on the smooth denoising image according to the pixel position, the gray values in the window are counted and the mean value is calculated, and a local neighborhood pixel gray mean value is generated. According to the local neighborhood pixel gray mean value, the gray values of each pixel point of the smooth denoising image are read, the difference between the pixel gray value and the local neighborhood pixel gray mean value is calculated pixel by pixel, the difference is compared with a preset threshold, the foreground flocculation body pixels and the background water body pixels are marked according to the determination result, and a binary flocculation segmentation map is generated.
[0007] Preferably, the acquiring step of the flocculation body edge contour set comprises: According to the binary flocculation segmentation map, the range of the foreground flocculation body pixels is limited, the absolute value of the gray difference of adjacent pixels is calculated to form a pixel gradient amplitude matrix, the gradient amplitude mutation points are detected along the row and column directions, and a closed path is formed by four-neighborhood connected tracking to generate a flocculation body edge contour set.
[0008] Preferably, the acquiring step of the flocculation compact fractal dimension comprises: According to the flocculation body edge contour set, a multi-level grid size sequence and a coverage starting point are set, square grids are generated in the image range level by level, it is judged whether each grid intersects with the flocculation body edge contour or the internal area and the number of occupied grids is recorded, the number of grids covering the edge and the number of grids covering the internal area are distinguished to form two types of grid coverage count sequences; According to the two types of grid coverage count sequences, the flocculation compact fractal dimension is calculated.
[0009] Preferably, the acquiring step of the liquid phase Lab color feature vector comprises: According to the background water body area associated with the flocculation compact fractal dimension, the pixel set of the background water body area is located, the RGB components of the background water body area are extracted, and the Lab color space value of the background water body area is obtained; According to the Lab color space numerical value of the background water area, pixel values of a channel and b channel are extracted, and mean values of the a channel and the b channel are calculated to construct a liquid phase Lab color feature vector.
[0010] Preferably, the water quality anomaly determination signal acquisition step is: The chromaticity anomaly deviation value is sequentially compared with a statistical threshold value of allowable color difference, and if the chromaticity anomaly deviation value exceeds the statistical threshold value of allowable color difference, the current water color state is marked as abnormal, otherwise, the current water color state is marked as normal, and a water color state identifier is generated.
[0011] Preferably, the water quality anomaly determination signal acquisition step further comprises: According to the water color state identifier, color state information corresponding to the identifier value is analyzed, and it is determined whether the color state is an abnormal state, if the color state is an abnormal state, a water quality anomaly determination signal is generated, and the signal state is recorded in a system state register unit, if the color state is a normal state, no signal is output.
[0012] Preferably, the water quality anomaly determination signal acquisition step further comprises: If the water quality anomaly determination signal appears, the flocculation dense fractal dimension and the dense structure reference value are called, a numerical difference between the flocculation dense fractal dimension and the dense structure reference value is calculated, and the dosage adjustment trend is determined according to the direction and size of the difference, and a dosage increment is obtained.
[0013] Compared with the prior art, the application has the advantages and positive effects that: In the application, Gaussian kernel convolution operation is performed on the image pixel matrix collected by the industrial sedimentation tank, and the mean value of the local neighborhood pixel gray scale is calculated, which can suppress the noise interference caused by water surface ripples and uneven illumination, realize adaptive segmentation of the foreground flocculation body and the background water body, and provide a pure data basis for subsequent analysis. The binary flocculation segmentation graph constructed provides a pure data basis for subsequent analysis. Based on the segmentation result, the pixel gradient amplitude is calculated and the mutation position is located, an edge contour set is generated, the flocculation dense fractal dimension is calculated by constructing a multi-level size grid coverage, and the flocculation body edge roughness and internal structure density are quantitatively represented, so that the settling performance and aggregation state of suspended solids are accurately reflected. In combination with the associated background water area, the RGB component is converted into Lab color space numerical value, the a channel and b channel values are extracted to construct a liquid phase feature vector, the chromaticity anomaly deviation value is calculated by using the covariance matrix and mean value vector of the standard discharge sample, the influence of brightness fluctuation on water quality color determination is eliminated, the recognition sensitivity to small chromaticity changes is improved, the chromaticity anomaly deviation value is compared with the statistical threshold value of allowable color difference, the water quality chemical feature anomaly can be quickly identified, and the dosage increment is calculated according to the difference between the flocculation dense fractal dimension and the dense structure reference value, which avoids the phenomenon of excessive reagent or substandard treatment caused by traditional single index. BRIEF DESCRIPTION OF DRAWINGS
[0014] Figure 1 The system flowchart of the present application. DETAILED DESCRIPTION
[0015] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.
[0016] Please refer to Figure 1 The present application provides a technical solution: a detection system for industrial wastewater treatment, comprising: A sediment image preprocessing module is configured to acquire an industrial sedimentation tank collected image, perform a Gaussian kernel convolution operation on a pixel matrix of the collected image, generate a smoothed denoising image, calculate a local neighborhood pixel gray mean value for each pixel gray value of the smoothed denoising image, divide foreground flocculation body pixels and background water body pixels, and generate a binary flocculation segmentation image. A flocculation body morphological feature module is configured to calculate a flocculation body region pixel gradient amplitude, locate a gradient amplitude mutation position, generate a flocculation body edge contour set, construct a multi-level size grid to cover the flocculation body edge contour set, and calculate and generate a flocculation compact fractal dimension according to the binary flocculation segmentation image. A wastewater chromaticity deviation detection module is configured to extract background water body region RGB components and convert them into Lab color space values according to the background water body region associated with the flocculation compact fractal dimension, extract a channel a and a channel b value to construct a liquid phase Lab color feature vector, call a preset standard discharge sample covariance matrix and mean vector, combine the liquid phase Lab color feature vector, and calculate and generate a chromaticity abnormal deviation value. A judgment module is configured to compare the chromaticity abnormal deviation value with an allowable color difference statistical threshold, generate a water quality abnormality judgment signal, compare the flocculation compact fractal dimension with a compact structure reference value according to the water quality abnormality judgment signal, and calculate a dosing increment based on the difference.
[0017] The acquisition step of the binary flocculation segmentation image is: An industrial sedimentation tank collected image is acquired, a Gaussian kernel size and a boundary padding strategy are set, a kernel convolution operation is performed on the collected image pixel matrix pixel by pixel, high-frequency noise interference is suppressed, and a smoothed denoising image is generated. According to the smoothed denoising image, each pixel gray value of the smoothed denoising image is extracted, a local neighborhood window size and a sliding step size are set, the window is slid on the smoothed denoising image according to the pixel position, the gray values in the window are counted and the mean value is calculated, and a local neighborhood pixel gray mean value is generated. Based on the average gray value of local neighboring pixels, the gray value of each pixel in the smoothed and denoised image is read. The difference between the gray value of each pixel and the average gray value of local neighboring pixels is calculated pixel by pixel. The difference is compared with a preset threshold. The foreground flocculent pixels and the background water pixels are marked according to the judgment result to generate a binary flocculent segmentation map.
[0018] Specifically, images of the industrial sedimentation tank are acquired, and the Gaussian kernel size and boundary filling strategy are set according to the resolution of the images acquired by the industrial camera, such as... And based on the estimated noise particle size, set the size parameters of the Gaussian kernel. For example, select That is, to build a The matrix is used as the convolution kernel, and the standard deviation of the Gaussian distribution is set. The value is 1.5, derived from previous histogram statistical analysis of dark current noise. This value is used to determine the attenuation level of the kernel function's central weights. The weight value at each position in the kernel matrix is calculated using the two-dimensional Gaussian function formula. The calculation formula is as follows: ,in Coordinates in the convolution kernel The weighting coefficient at the location, and These represent the horizontal and vertical distances from the point to the center of the core, respectively. Pi After calculating all 25 weight values to a preset standard deviation, normalization is performed to ensure that the sum of all weights equals 1, preventing changes in the overall image brightness. A mirror-fill method is used to extend the edges of the original image, that is, copying edge pixels to fill the areas required for the convolution operation. The outer region of the width ensures that the processed image size remains unchanged, initiating the convolution operation traversal process, and... Align the center of the Gaussian kernel with the first pixel of the acquired image pixel matrix, and extract the surrounding pixels of that pixel. The grayscale value within the neighborhood is multiplied by the corresponding Gaussian kernel weight, and these 25 products are accumulated to obtain a new grayscale value. This calculation result is used as the new grayscale value of the center pixel and stored in the pre-allocated memory space. The Gaussian kernel is moved pixel by pixel on the image pixel matrix in a left-to-right and top-to-bottom order. The above operations of extracting the neighborhood, weighting the product, and accumulating the product are repeated until all pixels in the image matrix have been traversed, generating a smoothed and denoised image.
[0019] Based on the smoothed and denoised image, the grayscale values of each pixel are extracted. The size of the local neighborhood window and the sliding step size are set. The size of the local neighborhood window is determined according to the average physical diameter of the flocculants to be detected and their pixel proportion in the image. For example, the common diameter of flocculants measured by microscopic calibration corresponds to a width of 20 to 30 pixels in the image. The value is 35, which means defining a The rectangular region is used as the reference range for calculating the background mean. The sliding step size is set to 1, that is, the local mean is calculated independently for each pixel without skipping sampling, and the process is repeated for each coordinate point of the smoothed and denoised image. With the current coordinates Centered on the rectangle, determine the boundary coordinates of its rectangular neighborhood, which are the row coordinate ranges. Column coordinate range For areas where the image edges cannot meet the full window size, an edge pixel copying and padding method is used to fill in the data. The gray values of all pixels within the rectangular window coverage area are read to construct a local gray set. The total gray value of the window is obtained by summing all the gray values in the set. Then, the local mean is calculated using the formula: ,in For the image in coordinates The average gray level of the local neighboring pixels at that location. For Centered The sum of the grayscale values of all pixels within the window. The window side length is 35. The total number of pixels within the window is 1225. The calculated... The numerical values are saved to the corresponding positions in a mean matrix of the same size as the original image, with floating-point precision. In the process, the above calculations are performed on all pixels in the image in sequence to generate the average grayscale value of the local neighborhood pixels.
[0020] Based on the average grayscale value of the local neighborhood pixels, the grayscale value of each pixel in the smoothed and denoised image is read. The difference between the pixel grayscale value and the average grayscale value of the local neighborhood pixels is calculated pixel by pixel, and a contrast judgment threshold is set. This threshold is determined based on a grayscale comparison experiment of a mixture of clean water and standard flocculants. For example, half of the bimodal valley value of the contrast histogram is used as the threshold. This value indicates that the current pixel's grayscale value must be at least 15 grayscale levels higher than the background average to be considered foreground, starting from the first pixel position of the smoothed and denoised image. Begin by reading its grayscale value. Simultaneously, the mean grayscale value of the corresponding local neighborhood pixels is read from the mean matrix. Perform interpolation wherein is the current gray difference result, is the original smooth gray of the current coordinate point, is the corresponding background mean value, the calculated difference value is compared with a preset threshold value , if , i.e. the current pixel is significantly brighter than the surrounding background, it is determined that the pixel belongs to the foreground flocculation body, and the value at the corresponding position in the binaryzation result matrix is marked as 255 (white), if , it is determined that the pixel belongs to the background water body or noise, and the value at the corresponding position in the binaryzation result matrix is marked as 0 (black), the above difference calculation and threshold comparison logic are sequentially executed on all pixel points in the image in row priority order, the traversal and marking operation on the entire image matrix is completed, and the matrix composed of 0 and 255 finally filled is taken as the output data to generate a binaryzation flocculation segmentation graph.
[0021] The acquisition step of the flocculation body edge contour set is: According to the binaryzation flocculation segmentation graph, the range of the foreground flocculation body pixels is limited, the absolute value of the gray difference of adjacent pixels is calculated to form a pixel gradient amplitude matrix, the gradient amplitude mutation points are detected along the row and column directions, and a closed path is formed by four-neighborhood connected tracking to generate a flocculation body edge contour set.
[0022] Specifically, according to the binaryzation flocculation segmentation graph, the range of the foreground flocculation body pixels is limited, the entire coordinate position of the binaryzation image matrix is first scanned, the white pixel set with a gray value of 255 is identified as the foreground flocculation body pixel range, a blank gradient matrix with the same resolution as the original image is constructed, each pixel point in the foreground pixel set is traversed , the gray values of the right adjacent pixel and the lower adjacent pixel are extracted, the absolute value of the gray difference between the current pixel and the right pixel is calculated to obtain the horizontal gradient component, the absolute value of the gray difference between the current pixel and the lower pixel is calculated to obtain the vertical gradient component, and the horizontal gradient component and the vertical gradient component are added to obtain the pixel gradient amplitude at the position. For a binary image, the gradient amplitude at the edge is usually 0 or 255, the gradient amplitude mutation points are detected along the row and column directions, and the gradient threshold value The threshold is set based on half of the maximum grayscale jump value of 255 in the binary image. Any pixel with a gradient magnitude greater than 128 is marked as an edge candidate point. A closed path is formed by four-neighbor connectivity tracing. Starting from the top left corner of the image, the first edge candidate point is retrieved as the tracing starting point. The four adjacent positions are checked in a clockwise order of top, right, bottom, and left to see if there are any marked edge points. If there are, they are added to the current contour path and connectivity search is continued with the new point as the center until the path returns to the starting point to form a closed loop, or the search stops at the image boundary. Short non-closed paths with a length of less than 20 pixels are discarded as noise. The coordinate sequence of paths with a length of more than 20 pixels and a closed structure is retained to generate the flocculent edge contour set.
[0023] The steps to obtain the fractal dimension of flocculated compaction are as follows: Based on the floc edge contour set, a multi-level grid size sequence and coverage start point are set, and square grids are generated in the image range level by level. For each grid, it is determined whether it intersects with the floc edge contour or internal region and the number of occupied grids is recorded. The number of grids covering the edge and the number of grids covering the internal region are distinguished and recorded to form two types of grid coverage counting sequences. Based on the two types of grid cover counting sequences, the fractal dimension of flocculation compaction is calculated using the following formula: ; in, , , , For flocculated dense fractal dimension, The number of scales in the grid size sequence. For the first Area per grid size – edge-weighted overall coverage For the first The number of grids covering the flocculent region at each grid size reflects the density of the flocculent. For the first The number of grids covering the edge contour of flocs at a given grid size reflects the edge complexity. For the first The side length of each grid, The weighting factors contributing to area and edge dimensions are used to balance their combined impact on the fractal dimension. For the first Overall coverage at each grid size The natural logarithm of is used to represent the trend of change in the total coverage quantity on a logarithmic scale. For the first Reciprocal of grid size The natural logarithm of is used to represent the trend of grid size scaling on a logarithmic scale.
[0024] Specifically, based on the floc edge contour set, a multi-level grid size sequence and coverage start point are set, according to the resolution specifications of the acquired images, such as... The basic grid cell side length is set to 2 pixels, and a grid size sequence is constructed in a doubling manner, specifically including five scale values: 2, 4, 8, 16, and 32. The top-left vertex of the image is set. Starting from the origin of the grid coverage, square grids are generated progressively within the image area. First, the first element in the sequence, with a side length of 2 pixels, is used to divide the entire image plane into several grids. The system uses square grid cells and initializes two independent counters to record the number of grid cells covering the flocculent entity and the number of grid cells covering the flocculent edge, respectively. Each grid cell is traversed and checked to determine if there are any pixels belonging to the flocculent edge contour set within the grid's coverage area. If at least one edge pixel exists, the edge coverage grid counter is incremented. Simultaneously, it checks if the grid area contains any pixels belonging to the foreground flocculent (i.e., pixels with a grayscale value of 255). As long as a foreground pixel is included, regardless of its location at the edge, the area coverage grid counter is incremented. After completing the traversal and statistics of all grids at the current scale, the two count values corresponding to that scale are saved. Then, the system switches to the next size in the sequence, such as 4 pixels, re-divides the grid, and repeats the traversal, judgment, and count accumulation process until all preset scales are statistically analyzed. The area coverage counts and edge coverage counts obtained at each scale are arranged in ascending order of size, forming two types of grid coverage count sequences.
[0025] In the formula for calculating the fractal dimension of flocculation density, the comprehensive fractal dimension of the flocs at different scales is calculated by linear regression using the least squares method. The slope in the double logarithmic coordinate system is used to characterize the morphological complexity and density of the flocs. Compared with the single fractal dimension, this formula combines edge features and region filling features, which can more accurately quantify the structural density of the flocs. This represents the number of scales in the grid size sequence, a dimensionless integer. This parameter is obtained based on the grid size sequence length set in the preceding steps. In this embodiment, the grid size sequence is set to... It contains 5 different scale levels, therefore The value is 5, which determines the number of sample points in the regression analysis; Representing the The dimensionless ratio of the side length of each grid cell to the basic unit pixel is extracted sequentially from a preset grid size sequence. The specific elements in the sequence are... , , , , These values are used to calculate the x-coordinate in the logarithmic coordinate system to ensure the consistency of dimensions in logarithmic operations; Representing the The number of grid cells covering the flocculent region at each grid size, a dimensionless integer. This parameter is obtained by counting the number of grid cells containing foreground flocculent pixels on the corresponding grid size. For example, when processing a typical flocculent image frame, the resulting sequence data is: , , , , ; Representing the The number of grids covering the edge contour of flocs at each grid size, a dimensionless integer. This parameter is obtained by counting the number of grids containing edge contour pixels on the corresponding grid size. The sequence data obtained based on the edge detection results of the same frame image is as follows: , , , , ; The weighting factor representing area and edge contribution is a dimensionless constant. This parameter is used to adjust the proportion of compactness and edge roughness features in the overall dimension, and its value ranges from 0 to 1. It is determined through experiments analyzing the correlation between floc settling performance and morphological parameters. This indicates a greater emphasis on the influence of the internal density of the flocs; Representing the The area per grid size is the edge-weighted comprehensive coverage, a dimensionless value, calculated using the following formula: Calculations were performed using the above statistical data, to Right now For example, Similarly, calculate other scales. Values, to obtain a sequence ; Representing the Reciprocal of grid size The natural logarithm of , a dimensionless numerical value, i.e. Calculate at various scales value: , , , , ; represent the number of integrated coverage under the first grid size , the natural logarithm of the dimensionless value, i.e. , calculate the value of each scale: , , , , .
[0026] According to the parameters, the calculation is as follows: The above-mentioned calculation of and sequence into the regression formula, first calculate the sum of each term: ; ; ; ; ; Substitute formula molecule part: ; Substitute formula denominator part: ; Finally, calculate : ; The calculated flocculation compactness fractal dimension is 1.55, which is a dimensionless parameter, reflecting the comprehensive characteristics of the flocculation body in the edge irregularity and internal filling compactness. The higher the value, the more complex the structure of the flocculation body and the more compact the internal structure.
[0027] The steps for obtaining the liquid phase Lab color feature vector are as follows: According to the background water area associated with the flocculation compactness fractal dimension, the background water area pixel set is located, the background water area RGB component is extracted, and the Lab color space value of the background water area is obtained; According to the Lab color space value of the background water area, the pixel values of a channel and b channel are extracted, the mean values of a channel and b channel are calculated, and the liquid phase Lab color feature vector is constructed.
[0028] Specifically, according to the background water area associated with the flocculation dense fractal dimension, the background water area pixel set is located, first, the binary flocculation segmentation graph generated in the previous step is called, the area with pixel value of 0 in the segmentation graph is marked as background, the two-dimensional matrix coordinates of the segmentation graph are traversed, the coordinates of all pixel points marked as background are extracted to form a background pixel coordinate index list, and the coordinates are backtracked to the original high-resolution color image collected to read the red component R, green component G and blue component B values at the corresponding coordinate positions one by one. Considering the volatility of the lighting conditions in the industrial field, the extracted RGB values are corrected based on the white balance coefficient to eliminate the interference of the light source color temperature on the background color of the water body. The corrected RGB values are projected to the CIE-XYZ standard colorimetric system using a linear transformation matrix, and then the XYZ values are converted to CIE-Lab uniform color space values using a nonlinear mapping function. In this space, the L component represents the brightness, the a component represents the color change from green to red, and the b component represents the color change from blue to yellow. This conversion eliminates the nonlinear influence of brightness changes on color discrimination, ensuring that the color characteristics of each background pixel can be accurately expressed in a perceptually uniform metric space. Finally, all the converted Lab values of the background pixels are stored as a background water color dataset to obtain the Lab color space values of the background water area.
[0029] According to the Lab color space values of the background water area, the pixel values of the a channel and the b channel are extracted, the a color channel and the b color channel data highly related to the color attribute are separated from the stored background water color dataset, the L brightness channel reflecting only the light intensity is removed to avoid the interference of environmental light intensity fluctuations on water quality colorimetric determination, and the remaining a channel value set and b channel value set are preprocessed before statistics. The interquartile range method is used to filter out outlier values caused by image sensor thermal noise or water surface reflection bright spots to ensure the data purity of subsequent calculations. For the cleaned effective data, the average of the a channel pixel values and the average of the b channel pixel values are calculated. These two average values directly quantify the overall color tone tendency of the current water body on the red-green antagonistic axis and the yellow-blue antagonistic axis. The calculated a channel average is taken as the first element of the column vector, and the b channel average is taken as the second element of the column vector. A two-dimensional feature vector is constructed in a fixed order, which represents the centroid position of the current water body on the colorimetric plane in mathematics, providing a standardized input format for subsequent quantification of water quality colorimetric deviation, and constructing a liquid phase Lab color feature vector.
[0030] The colorimetric abnormal deviation value acquisition step is: According to the liquid phase Lab color feature vector, the colorimetric abnormal deviation value is calculated, and the calculation formula is: ; wherein, is the chromaticity abnormal deviation value, is the liquid-phase Lab color feature vector, composed of the average values of the a channel and the b channel of the background water area, is the standard discharge sample mean vector, representing the Lab mean value of the standard water body, is the standard discharge sample covariance matrix, representing the joint distribution relationship of the a channel and the b channel in the standard sample, is the inverse matrix of the standard discharge sample covariance matrix, used to measure the weighted spatial relationship of the mean deviation, is the covariance matrix of the current background water sample, representing the dispersion degree of the current water color in the a channel and the b channel, is the determinant of matrix , reflecting the generalized variance of the current water color distribution, is the determinant of matrix , reflecting the generalized variance of the standard sample color distribution, is the distribution form influence factor, adjusting the relative weight of the mean deviation and the distribution dispersion change in the comprehensive abnormality measurement.
[0031] Specifically, the chromaticity abnormal deviation value calculation formula combines the comprehensive measurement method of Mahalanobis distance and generalized variance ratio, not only considers the directional deviation of the water color mean value relative to the standard value, but also introduces the change consideration of the color distribution dispersion, which can detect both chromaticity drift (such as dissolved pollution) and turbidity distribution pattern change (such as suspended particle change), thereby more comprehensively evaluating the water quality abnormality degree; represents the liquid-phase Lab color feature vector, composed of the a channel mean value and the b channel mean value of the current background water area. This parameter is obtained by real-time image acquisition and calculation. For example, in the current detection period, the a channel mean value is , the b channel mean value is , then , this vector reflects the average chromaticity state of the current discharge water body; represents the standard discharge sample mean vector, representing the chromaticity center of the normal water body meeting the environmental protection standard in the Lab space. The acquisition method of this parameter is as follows: during the system debugging stage, continuously run the treatment equipment and input standard water and qualified discharge water, collect an image every 10 minutes, continuously collect 288 sample data for 48 hours, calculate the average values of the a channel and the b channel of these qualified samples, for example, the standard water body is slightly blue, the average value of the a channel is , the average value of the b channel is , then ; The covariance matrix of the standard emission sample represents the joint distribution relationship and natural fluctuation range of the a, b channels in the standard sample. This parameter is also based on the 48-hour qualified sample data described above, and is obtained by using the covariance calculation formula to calculate the a channel variance, b channel variance, and the covariance of the two, for example, the calculation result is This matrix reflects the allowed fluctuation ellipse area of the normal water quality color; The inverse matrix of the covariance matrix of the standard emission sample is used to measure the weighted spatial relationship of the mean deviation, and eliminates the dimensional influence brought by the different fluctuation amplitudes of each color channel. According to the above matrix calculation, the determinant of is ; The covariance matrix of the current background water sample represents the dispersion degree of the current water color in the a, b channel. This parameter is calculated by using the real-time covariance formula according to the a, b value set of the current frame background pixels, and reflects the color uniformity of the current water body. For example, the current water body has a wide color distribution due to containing part of the unsedimented particles, and the calculation result is ; The determinant of the matrix reflects the generalized variance of the current water color distribution, that is, the “volume” of the distribution area. According to the above matrix calculation, ; The determinant of the matrix reflects the generalized variance of the standard sample color distribution. According to the foregoing calculation, it is ; The distribution form influence factor adjusts the relative weight of the mean deviation and the distribution dispersion change in the comprehensive abnormality measurement. This parameter is set through comparative experiments. The influence degree of simple chroma over-standard and simple turbidity over-standard on water quality is tested respectively. It is found that the importance of chroma deviation is slightly higher than that of distribution dispersion, but the distribution change cannot be ignored. It is set to .
[0032] According to the parameters, the following calculations are performed: First, calculate the chroma mean deviation vector: ; Calculate the Mahalanobis distance square term (first part): ; First, calculate the vector and matrix product: ; Then multiply the latter column vector: ; Calculate distribution dispersion difference item (second part): ; ; Integrate two parts and take square root: ; The calculated color anomaly deviation value is 2.91, which is a dimensionless comprehensive statistical distance. When the value is close to 0, it indicates that the current water color and distribution are highly consistent with the standard discharged water. The larger the value, the more serious the deviation. In this example, the value of 2.91 shows that there is a significant deviation in the color average of the water body and the color distribution range is larger, indicating that there may be insufficient dosing leading to incomplete color removal or suspended solids remaining. The system will trigger the subsequent dosing adjustment logic according to this value.
[0033] The water quality anomaly determination signal acquisition step is: Compare the color anomaly deviation value with the allowable color difference statistical threshold value one by one. If the color anomaly deviation value exceeds the allowable color difference statistical threshold value, mark the current water color state as abnormal, otherwise mark it as normal, and generate a water color state identifier; According to the water color state identifier, analyze the color state information corresponding to the identifier value, determine whether the color state is abnormal, if it is abnormal, generate a water quality anomaly determination signal, and record the signal state in the system state register unit, if it is normal, keep no signal output.
[0034] Specifically, the color anomaly deviation value is compared with the allowable color difference statistical threshold value one by one, and the allowable color difference statistical threshold value is set as The threshold is set according to the secondary standard of industrial wastewater discharge and the color difference limit that can be observed by the naked eye. By statistically analyzing the color anomaly values of 300 batches of historical treated water samples that meet the standard, the average value of these qualified sample values is calculated And the standard deviation The threshold value is set as the average value plus three times the standard deviation, for example, the calculation result is , Then Read the current calculated color anomaly deviation value, and compare it with The comparison is performed. If the current value is greater than 2.4, it indicates that the water color is significantly different from the standard sample, exceeding the allowable statistical fluctuation range. In this case, the state variable is marked as 1, indicating an anomaly. If the current value is less than or equal to 2.4, it indicates that the difference is within the normal fluctuation range. The state variable is marked as 0, indicating normal. This binary state variable is written into the real-time monitoring record table to form the corresponding time series data and generate a water color status identifier.
[0035] Based on the water body color status identifier, the color status information corresponding to the identifier value is parsed. The latest status identifier bit is read from the monitoring record table, and the value of the identifier bit is checked. If the value is 1, it indicates that the previous detection step has captured an abnormality in color or turbidity. The abnormality confirmation counter is started, and the status identifier is continuously monitored in the next 5 consecutive detection cycles. If the status identifier is 1 in 3 or more of these 5 times, it is confirmed that the fluctuation is not accidental, and the current color status is determined to be abnormal. At this time, the alarm logic is triggered, the alarm flag in the internal register is set, and a digital signal packet containing the current timestamp, abnormal value, and type code is generated, which is the water quality abnormality judgment signal. An abnormal event record is added to the system log database, and the record content includes the specific deviation value and trigger time. If the read identifier value is 0, or although there is an abnormal identifier, the continuous confirmation condition is not met, the color status is determined to be normal, the alarm flag bit is kept reset, no new signal packet is generated, and no signal output is maintained.
[0036] The steps to obtain the dosage increment are as follows: If a water quality anomaly detection signal is detected, the fractal dimension of flocculation and the baseline value of dense structure are called up, the numerical difference between the fractal dimension of flocculation and the baseline value of dense structure is calculated, and the dosing adjustment trend is determined based on the direction and magnitude of the difference, so as to obtain the dosing increment.
[0037] Specifically, if an abnormal water quality signal is detected, the flocculation density fractal dimension and the dense structure baseline value are retrieved, and the dense structure baseline value is set. This benchmark value corresponds to the morphological characteristics of the flocs when the flocculation effect is optimal. It is obtained by calculating the fractal dimension of the flocculation images when the turbidity of the supernatant is lowest in multiple sedimentation experiments and taking the average value. For example, the dimension of the optimal flocculation state was determined to be 1.65 after multiple experiments. Read the currently calculated flocculated dense fractal dimension. (For example ), perform subtraction to calculate the difference The direction of drug administration is determined by the sign of the difference. This indicates that the current flocs are not dense enough and have a loose structure, requiring an increase in flocculant dosage to promote denser aggregation. , indicating that the floc is too tight or there may be excessive dosage, which needs to reduce the drug amount, according to the size of the absolute value of the difference to determine the adjustment step, set the proportion coefficient (mg / L), calculate the dosage increment , into the numerical calculation mg / L, that is, the current need to increase 5 mg / L on the basis of the original dosage.
Claims
1. A detection system for industrial wastewater treatment, characterized in that, The system includes: The sedimentation image preprocessing module is used to acquire images collected from industrial sedimentation tanks, perform Gaussian kernel convolution operation on the pixel matrix of the acquired images to generate smooth and denoised images, calculate the mean gray value of local neighboring pixels for the gray value of each pixel in the smooth and denoised image, divide the foreground flocculent pixels and background water pixels, and generate a binary flocculent segmentation map. The floc morphology feature module is used to calculate the pixel gradient magnitude of the floc region based on the binarized floc segmentation map, locate the abrupt change position of the gradient magnitude, generate the floc edge contour set, construct a multi-level size grid to cover the floc edge contour set, and calculate and generate the floc dense fractal dimension. The wastewater color deviation detection module is used to extract the RGB components of the background water body region and convert them into Lab color space values based on the background water body region associated with the fractal dimension of the flocculation and compaction. It also extracts the values of the a channel and b channel to construct a liquid phase Lab color feature vector, calls the preset covariance matrix and mean vector of the compliant discharge sample, and calculates and generates the color deviation value by combining the liquid phase Lab color feature vector. The determination module is used to compare the abnormal deviation value of color with the allowable color difference statistical threshold, determine and generate a water quality abnormality determination signal, compare the flocculation and compaction fractal dimension with the compaction structure benchmark value based on the water quality abnormality determination signal, and calculate the dosage increment based on the difference.
2. The detection system for industrial wastewater treatment according to claim 1, characterized in that, The steps for obtaining the binary flocculation segmentation map are as follows: Acquire images of industrial sedimentation tanks, set Gaussian kernel size and boundary filling strategy, perform kernel convolution operation on pixel-by-pixel of the acquired image pixel matrix to suppress high-frequency noise interference and generate smooth and denoised images; Based on the smoothed and denoised image, extract the gray values of each pixel in the smoothed and denoised image, set the size of the local neighborhood window and the sliding step size, slide the window on the smoothed and denoised image according to the pixel position, count the gray values in the window and calculate the mean, and generate the local neighborhood pixel gray mean. Based on the average gray value of the local neighboring pixels, the gray value of each pixel in the smoothed and denoised image is read, the difference between the pixel gray value and the average gray value of the local neighboring pixels is calculated pixel by pixel, the difference is compared with a preset threshold, and the foreground flocculent pixels and background water pixels are marked according to the judgment result to generate a binary flocculent segmentation map.
3. The detection system for industrial wastewater treatment according to claim 1, characterized in that, The steps for obtaining the flocculent edge contour set are as follows: Based on the binary flocculation segmentation map, the pixel range of the foreground flocs is defined, the absolute value of the gray level difference between adjacent pixels is calculated to form a pixel gradient magnitude matrix, gradient magnitude abrupt change points are detected along the row and column directions and closed paths are formed by four-neighbor connectivity tracing, and a floc edge contour set is generated.
4. The detection system for industrial wastewater treatment according to claim 1, characterized in that, The steps for obtaining the flocculated dense fractal dimension are as follows: Based on the floc edge contour set, a multi-level grid size sequence and coverage start point are set, and square grids are generated in the image range level by level. For each grid, it is determined whether it intersects with the floc edge contour or internal region and the number of occupied grids is recorded. The number of grids covering the edge and the number of grids covering the internal region are distinguished and recorded to form two types of grid coverage counting sequences. The flocculation density fractal dimension is calculated based on the two types of grid coverage counting sequences.
5. The detection system for industrial wastewater treatment according to claim 1, characterized in that, The steps for obtaining the liquid phase Lab color feature vector are as follows: Based on the background water region associated with the fractal dimension of the flocculation, locate the pixel set of the background water region, extract the RGB components of the background water region, and obtain the Lab color space values of the background water region. Based on the Lab color space values of the background water area, the pixel values of channel a and channel b are extracted, and the mean values of channel a and channel b are calculated to construct the liquid phase Lab color feature vector.
6. The detection system for industrial wastewater treatment according to claim 1, characterized in that, The steps for obtaining the water quality anomaly detection signal are as follows: The abnormal chromaticity deviation value is compared with the allowable color difference statistical threshold one by one. If the abnormal chromaticity deviation value exceeds the allowable color difference statistical threshold, the current water body color status is marked as abnormal; otherwise, it is marked as normal, and a water body color status identifier is generated.
7. The detection system for industrial wastewater treatment according to claim 6, characterized in that, The step of obtaining the water quality anomaly determination signal further includes: Based on the water body color status identifier, the color status information corresponding to the identifier value is parsed to determine whether the color status is abnormal. If it is abnormal, a water quality abnormality judgment signal is generated and the signal status is recorded in the system status register unit. If it is normal, no signal output is maintained.
8. The detection system for industrial wastewater treatment according to claim 1, characterized in that, The steps for obtaining the dosage increment are as follows: If the aforementioned water quality anomaly detection signal occurs, the fractal dimension of flocculation and the reference value of dense structure are called, the numerical difference between the fractal dimension of flocculation and the reference value of dense structure is calculated, and the dosing adjustment trend is determined based on the direction and magnitude of the difference to obtain the dosing increment.