Image processing-based MBR product water turbidity detection method and system

By combining a multidimensional feature analysis method that integrates scattering response intensity and texture disorder, the problem of insufficient response of existing visual detection methods to weak suspended particle signals in low turbidity scenarios is solved, enabling accurate assessment of MBR permeate turbidity and early leak warning.

CN121811227BActive Publication Date: 2026-05-19SHAANXI WEILAN ENERGY SAVING & ENVIRONMENTAL TECH GRP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHAANXI WEILAN ENERGY SAVING & ENVIRONMENTAL TECH GRP CO LTD
Filing Date
2026-03-06
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing visual inspection methods lack sufficient sensitivity to the scattering signals of weak suspended particles in low-turbidity scenarios, making it difficult to distinguish between sensor thermal noise and linear interference from the pipe wall, resulting in inaccurate early warning of membrane damage and leakage.

Method used

A multidimensional feature analysis method combining scattering response intensity and texture disorder is adopted. By acquiring images of MBR permeate pipelines, water areas are extracted using a mask matrix, local contrast and noise standard deviation are calculated, suppression weights are constructed, particle confidence is obtained by combining eigenvalue decomposition of structure tensor matrix, and weighted processing is performed using the Sigmoid function to finally calculate the overall turbidity.

Benefits of technology

It improves the accuracy and sensitivity of MBR permeate turbidity detection, reduces false alarm rate, and enables early detection of membrane module damage and reliable monitoring of permeate water quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121811227B_ABST
    Figure CN121811227B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image data processing, and more particularly to a MBR water production turbidity detection method and system based on image processing, which comprises the following steps: obtaining an original image of a MBR water production pipeline and extracting a water area by using a mask matrix; calculating the local contrast of a pixel point relative to a neighborhood, constructing a suppression weight based on the noise standard deviation of an image sensor, and weighting the local contrast to obtain a scattering response intensity; obtaining texture disorder degree based on the ratio of the geometric mean value to the arithmetic mean value of the eigenvalues of a structure tensor; obtaining particle confidence based on the scattering response intensity and the texture disorder degree, obtaining weighted particle confidence by using a Sigmoid function, calculating the average value as comprehensive turbidity to evaluate the water production state. The present application fuses the scattering response intensity and the texture disorder degree, introduces the suppression weight and the soft threshold mechanism, reduces the interference of pipe wall scratches and thermal noise, and improves the detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image data processing technology, and in particular to a method and system for detecting turbidity in MBR permeate based on image processing. Background Technology

[0002] Membrane bioreactors (MBRs) utilize the efficient retention capacity of membrane modules for solid-liquid separation and are widely used in wastewater treatment projects, typically maintaining high transparency in their permeate. However, during long-term operation, the membrane fibers may experience minor damage due to hydraulic erosion. Once physical damage occurs, activated sludge will seep into the permeate side, leading to an increase in suspended particles in the effluent. Failure to promptly detect initial micro-leakage can result in the accumulation of contaminants, affecting the stable operation of subsequent processes and ensuring effluent compliance.

[0003] For monitoring turbidity in treated wastewater, conventional methods include manual inspection or deployment of online turbidity meters. Manual methods are limited by inspection intervals, making continuous monitoring difficult. Online instruments with contact probes are prone to adsorbing pollutants in wastewater environments, leading to reading drift and significant maintenance workload. Given the advantages of non-contact measurement, machine vision-based water quality detection technology is gradually being introduced into the monitoring process. This involves acquiring images of water flow in transparent pipe sections and using algorithms to analyze optical characteristics to infer water quality.

[0004] However, existing visual inspection methods mostly rely on global grayscale statistical features or texture features of images to characterize water quality, which has limitations in low-turbidity scenarios during the early stages of membrane damage. In the minor leakage stage, suspended particles in the water are sparse and dispersed, appearing as extremely weak local grayscale differences in the image rather than overall brightness changes or obvious texture structures. Conventional global statistical analysis tends to smooth local details, causing the scattering signals of tiny particles to be masked by background information, making it difficult to accurately detect early signs of leakage. Simultaneously, traditional edge detection operators lack the ability to identify the physical morphology of signals, making it difficult to effectively distinguish between random grayscale jumps caused by sensor electronic thermal noise and real tiny particle scattering signals, and also difficult to separate inherent linear scratches or water flow ripples on the pipe wall surface from point-like suspended matter. This feature confusion easily leads to misjudgments or missed detections in the low-turbidity range, failing to meet the high accuracy requirements for early warning of membrane damage. Summary of the Invention

[0005] To address the technical problems of existing visual inspection methods in low-turbidity scenarios, such as insufficient sensitivity to the scattering signals of weak suspended particles and difficulty in distinguishing between sensor thermal noise and linear interference from the pipe wall, this invention provides solutions in the following aspects.

[0006] In a first aspect, the present invention provides an image processing-based method for detecting turbidity in MBR permeate, the method comprising the steps of:

[0007] The process involves acquiring an original image of the MBR permeate pipeline and extracting the water region from the original image using a preset mask matrix. The local contrast of each pixel within the water region relative to its neighborhood is calculated. A suppression weight is constructed based on the noise standard deviation of the image sensor. The product of the suppression weight and the local contrast is calculated to obtain the scattering response intensity of each pixel. The structure tensor matrix of each pixel is constructed and eigenvalue decomposition is performed to obtain the maximum and minimum eigenvalues. Based on the ratio of the geometric mean to the arithmetic mean of the maximum and minimum eigenvalues, the scattering response intensity of each pixel is obtained. Texture disorder; based on the scattering response intensity and texture disorder, the particle confidence of each pixel is obtained; the difference between the particle confidence of each pixel and a preset response threshold is calculated, and the difference is mapped to a nonlinear weighting coefficient using the Sigmoid function. The particle confidence of each pixel is weighted using the nonlinear weighting coefficient to obtain the weighted particle confidence of each pixel; the average value of the weighted particle confidence of all pixels in the water body area is calculated as the comprehensive turbidity; the MBR permeate status is evaluated based on the comparison result between the comprehensive turbidity and the preset alarm threshold.

[0008] This invention acquires the original image of the MBR permeate pipeline and extracts the water area, calculates the local contrast of each pixel relative to its neighborhood, and constructs suppression weights based on the noise standard deviation of the image sensor to obtain the scattering response intensity. Simultaneously, it utilizes the ratio of eigenvalues ​​of the structure tensor matrix to obtain the texture disorder, and then fuses these two factors to obtain the particle confidence score. A sigmoid function is then used for weighted processing, and finally, the overall turbidity is calculated to assess the permeate water status. This approach comprehensively utilizes the optical scattering characteristics and spatial texture distribution characteristics of suspended particles. Compared to a single grayscale threshold judgment, this invention can retain the real suspended particle signal while using texture disorder to reduce the impact of non-particle interference such as bubbles, water flow ripples, and pipe wall scratches on the detection results. Furthermore, the suppression weights based on the noise standard deviation reduce misjudgments caused by the inherent thermal noise of the image sensor. Thus, it achieves an objective assessment of MBR permeate turbidity under non-contact conditions, providing reliable data support for the early detection of membrane module damage and the monitoring of permeate water quality.

[0009] Preferably, the scattering response intensity satisfies the following relationship:

[0010] ;

[0011] in, It is a pixel. The scattering response intensity; It is a pixel. grayscale value; It is a pixel. The average gray value of all pixels in the neighborhood; It is a pixel. The standard deviation of gray level within the neighborhood; It is the noise standard deviation of the image sensor; It is the signal-to-noise ratio adjustment coefficient; It is a natural exponential function; It is the absolute value symbol; It is the preset first minute value.

[0012] In this invention, the relationship between the scattering response intensity and the expression is a combination of Weber contrast and an exponential decay term based on noise variance. The Weber contrast term uses the ratio of the difference between the pixel gray value and the mean gray value of the neighborhood to adapt to the uneven illumination or gradual brightness changes that may exist in the MBR permeate pipeline, so that the capture of particle scattered light does not solely depend on absolute brightness. The noise suppression term uses the relationship between local variance and sensor noise floor to suppress signal fluctuations below the inherent noise level of the equipment, thereby reducing false scattering responses caused by the noise of the camera's own photosensitive element and improving the accuracy of the scattering response intensity in representing suspended matter in real water.

[0013] Preferably, the texture disorder degree satisfies the following relation:

[0014] ;

[0015] in, It is a pixel. Texture disorder; , They are pixels The maximum and minimum eigenvalues ​​of the structure tensor matrix at the location; It is a natural exponential function; It is the preset second minute value; It is the preset third minute value.

[0016] The relational expression for texture disorder in this invention utilizes the combined operation of eigenvalues ​​of the structure tensor, including a ratio term of the geometric mean to the arithmetic mean of eigenvalues ​​and an exponential term based on the difference of eigenvalues. This calculation method can evaluate the degree of texture isotropy in local areas. Since real suspended particle groups usually exhibit disordered isotropic distribution in images, while pipe wall scratches or water flow textures in a single direction exhibit obvious anisotropy, this relational expression can make the texture disorder value of each pixel reflect the possibility that it belongs to disordered particle texture, thereby reducing the weight of background interference with directional regularity in subsequent processing and reducing the interference of linear scratches or ripples on the detection of MBR permeate turbidity.

[0017] Preferably, the step of using the Sigmoid function to weight the granular confidence of each pixel to obtain the weighted granular confidence of each pixel includes: calculating the difference between the granular confidence of each pixel and a preset response threshold; substituting the difference into the Sigmoid function to obtain the nonlinear weight coefficient of each pixel; and multiplying the granular confidence of each pixel by the corresponding nonlinear weight coefficient to obtain the weighted granular confidence of each pixel.

[0018] This invention calculates the difference between particle confidence and a preset response threshold and substitutes it into a Sigmoid function to obtain a nonlinear weighting coefficient. This coefficient is then used to weight the particle confidence. By utilizing the nonlinear variation characteristics of the Sigmoid function near the threshold, low-confidence signals below the response threshold can be smoothly suppressed, while high-confidence signals above the response threshold can be preserved and enhanced. This soft-threshold processing method reduces abrupt changes in detection results caused by small signal fluctuations in the critical state, allowing the final obtained comprehensive turbidity to more smoothly reflect the gradual change process of MBR permeate water quality and improving the signal-to-noise ratio of the detection system for weak signals.

[0019] Preferably, the particle confidence level is the product of the square of the texture disorder and the scattering response intensity.

[0020] This invention sets the particle confidence level as the product of the square of the texture disorder and the scattering response intensity. The use of the square of the texture disorder increases the weight of texture features in the confidence evaluation. This means that only when a pixel has both high scattering brightness and highly disordered texture distribution will its particle confidence level show a high value. This non-linear fusion method further widens the numerical difference between real suspended particles and bright interference points or dark noise points, thereby highlighting the characteristic signals of real suspended matter in MBR permeate and reducing the risk of misjudgment caused by a single feature extremum.

[0021] Preferably, the acquisition of the preset mask matrix includes: acquiring a static background image of the MBR permeate pipeline containing a transparent window; and, based on the geometric edge coordinates of the transparent window in the static background image, setting the pixel value corresponding to the internal region of the transparent window to 1 and setting the pixel value corresponding to the pipe wall and border region to 0, thereby generating a mask matrix.

[0022] Preferably, the acquisition of the noise standard deviation of the image sensor includes: during the detection initialization phase, acquiring multiple frames of MBR permeate pipeline images under conditions of light blocking or photographing pure water; and using the standard deviation of pixel grayscale values ​​in the multiple frames of MBR permeate pipeline images as the noise standard deviation of the image sensor.

[0023] Preferably, the step of extracting the water region in the original image using a preset mask matrix includes: multiplying the gray value of each pixel in the original image with the element value at the corresponding position in the preset mask matrix to obtain the water region.

[0024] Preferably, constructing the structure tensor matrix of each pixel includes: calculating the gradient vector of each pixel; calculating the outer product of the gradient vectors to obtain the gradient tensor; and performing Gaussian smoothing on the gradient tensor to obtain the structure tensor matrix of each pixel.

[0025] In a second aspect, the present invention provides an image processing-based MBR permeate turbidity detection system. The image processing-based MBR permeate turbidity detection system includes a memory and a processor. The memory stores computer program instructions, which, when executed by the processor, implement the image processing-based MBR permeate turbidity detection method of the first aspect of the present invention.

[0026] By adopting the above technical solution, a computer program for detecting turbidity in MBR permeate water based on image processing, as described in the first aspect of the present invention, is generated and stored in a memory so that it can be loaded and executed by a processor. This allows for the creation of a terminal device based on the memory and processor, making it convenient to use.

[0027] The beneficial effects of this invention are as follows: This invention employs a multi-dimensional feature analysis method combining scattering response intensity and texture disorder. It utilizes scattering response intensity to capture the brightness abrupt changes of suspended particles and texture disorder to capture the spatial randomness of particle distribution. This dual-verification mechanism can distinguish between real suspended matter and directional interference such as pipe wall scratches and water flow ripples, thereby reducing the false alarm rate of MBR permeate turbidity detection in complex pipeline environments and improving the sensitivity of detection results to water quality changes. This invention also introduces a suppression weighting mechanism based on the standard deviation of image sensor noise. By acquiring the inherent noise floor of the device during the initialization phase and using this noise floor as a benchmark for weighted suppression of local contrast in subsequent calculations, the algorithm can adapt to the noise levels of different imaging devices. This reduces the possibility of sensor thermal noise being misjudged as suspended particles in low-turbidity water images, enhancing the system's detection stability in the low-turbidity range. This invention utilizes the Sigmoid function to construct a nonlinear soft threshold screening model, which weights the confidence scores of the fused particles. This achieves smooth suppression of low-confidence background noise and preservation of high-confidence particle signals. Compared to traditional hard threshold segmentation, this processing method retains more intermediate state information, enabling the calculated comprehensive turbidity index to reflect the subtle fluctuations in MBR permeate water quality more continuously and delicately, providing a basis for refined control of the production process. Attached Figure Description

[0028] Figure 1 A flowchart of an image processing-based method for detecting turbidity in MBR permeate provided in an embodiment of the present invention;

[0029] Figure 2 The original image of the MBR permeate pipeline provided in the embodiment of the present invention;

[0030] Figure 3 The image provided in this embodiment of the invention is a water area image after mask extraction and Gaussian filtering preprocessing of the original image;

[0031] Figure 4 A schematic diagram of overall turbidity provided for an embodiment of the present invention;

[0032] Figure 5 This is a structural block diagram of an MBR permeate turbidity detection system based on image processing, provided in an embodiment of the present invention. Detailed Implementation

[0033] The first aspect of this invention provides a method for detecting turbidity in MBR permeate based on image processing, such as... Figure 1 As shown, the method includes steps S100-S400:

[0034] Step S100: Obtain the original image of the MBR permeate pipeline, and extract the water area in the original image using a preset mask matrix.

[0035] It should be noted that in actual scenarios of membrane bioreactor permeate monitoring, the permeate pipeline typically includes opaque pipe walls, metal window frames, and the external environmental background. High-frequency edge textures and irregular light reflections in these non-water areas can easily be misinterpreted by the algorithm as turbidity signals. Simultaneously, image sensors generate inherent thermal noise during operation, and tiny air bubbles may exist in the water. If these high-frequency random noises are not processed, they will interfere with subsequent feature extraction of real suspended particles. Therefore, before extracting core features, this invention first uses masking technology to shield irrelevant backgrounds at fixed locations, and then employs smoothing filtering to suppress high-frequency noise while preserving the morphological features of larger particles, thereby locking in the effective detection range and improving the image signal-to-noise ratio.

[0036] Specifically, a transparent observation window, such as a glass tube, is installed in the water production pipeline. An industrial camera is fixedly mounted on one side of this transparent observation window, with the lens optical axis aligned with the water flow direction or perpendicular to the pipe wall. A light source is installed on the opposite or same side of the camera to form a transmission or scattering imaging light path. The camera acquires original images of the water production pipeline flowing through the transparent observation window in real time. The original image is then converted to grayscale to obtain a grayscale image. A binarization mask matrix is ​​called, and the grayscale value of each pixel in the grayscale image is multiplied by the corresponding element value in the binarization mask matrix. The image pixel value corresponding to the position with a value of 0 in the mask matrix is ​​set to zero, thereby retaining only the water body area containing the produced water. Further, a Gaussian convolution kernel of a preset size is selected, for example... The Gaussian convolution kernel of each pixel performs convolution traversal operation on each pixel in the water area, and replaces the value of the center pixel with the weighted average value of the neighboring pixels to obtain the preprocessed water area.

[0037] The binarized mask matrix is ​​obtained by: acquiring a static background image of the MBR permeate pipeline containing a complete transparent window structure; and, based on the geometric edge coordinates of the transparent window in the static background image, setting the pixel value of the corresponding internal region of the transparent window to 1 and setting the pixel value of the corresponding pipe wall and border region to 0, thereby generating a mask matrix.

[0038] like Figure 2 The image shown is the original image of the MBR permeate pipeline, displaying two water quality states. The left pipeline contains turbid water with densely distributed suspended particles, and due to external light, there is a noticeable reflected light spot in the center of the water. The right pipeline contains clear water with high transparency, and only a few tiny particles are visible.

[0039] like Figure 3 The image shown is the water area image after mask extraction and Gaussian filtering preprocessing of the original image. It can be observed that through pixel-level multiplication operations, non-water backgrounds such as pipe walls and borders were successfully masked, leaving only two water areas: turbid water and clear water.

[0040] At this point, the water area corresponding to the original image of the MBR permeate pipeline has been obtained.

[0041] Step S200: Calculate the local contrast of each pixel in the water body area relative to its neighborhood, construct a suppression weight based on the noise standard deviation of the image sensor, calculate the product of the suppression weight and the local contrast, and obtain the scattering response intensity of each pixel.

[0042] It should be noted that in the early stages of membrane rupture, the leaked micro-suspended particles appear only as weak local grayscale jumps in the original image, rather than obvious black or white spots, and the light distribution within the permeate window often exhibits gradual or unevenness. In this scenario, relying solely on absolute grayscale values ​​is insufficient to detect anomalies. Considering that the human eye and precision optical components perceive light signals according to Weber's Law—that is, the perceived signal intensity depends on the ratio of the signal increment to the background base brightness—this invention utilizes this statistical law to construct a contrast index that adapts to changes in illumination. Combined with local signal-to-noise ratio analysis, it adaptively enhances weak signals and filters out random noise.

[0043] First, a neighborhood window is constructed for each pixel in the water area. It should be noted that, in order to accurately assess the abruptness of the current pixel, it is not only necessary to consider the pixel itself, but also to rely on the set of pixels within a certain range around it to statistically analyze the brightness level and fluctuation characteristics of the local background.

[0044] Specifically, a neighborhood window is constructed centered on each pixel in the water area.

[0045] As a preferred implementation, the neighborhood window size can be set to... In terms of pixels, considering that suspended particles caused by leakage from conventional microfiltration membranes typically have a spatial scale of 3 to 5 pixels at current imaging magnification,... The neighborhood of a pixel can completely contain the individual particle target, ensuring the accuracy of background statistics when calculating local contrast, while avoiding the introduction of too much interference from distant uneven lighting or irrelevant textures due to an excessively large window. Implementers can adjust the window size according to the magnification of the actual imaging environment and the expected minimum particle size to be detected: for example, for imaging larger particles at higher magnification, the window can be appropriately increased to 20-30 pixels; for detecting extremely small noise at low magnification, the window can be appropriately reduced to 9-11 pixels.

[0046] Next, the noise standard deviation of the image sensor is obtained. It should be noted that, in order to effectively distinguish between real grayscale fluctuations and sensor thermal noise, the noise floor level of the imaging device needs to be known first, which serves as a benchmark for judging the validity of the signal.

[0047] Specifically, during the initial calibration phase of the imaging equipment, multiple frames of images of the MBR permeable water pipeline are acquired under conditions of complete shading or shooting standard pure water. The standard deviation of the pixel grayscale values ​​in these images is calculated and used as the noise standard deviation of the image sensor.

[0048] Finally, the scattering response intensity is calculated. It should be noted that, in order to construct a composite index that simultaneously considers brightness adaptability and noise robustness, this invention uses the difference between the pixel grayscale value and the local mean, divided by the local mean, to simulate Weber contrast, adapting to backgrounds of varying brightness; and uses the ratio of local variance to inherent noise variance to construct an exponential decay function to assess the statistical difference of the current fluctuation relative to the noise, ensuring that only valid fluctuations exceeding the noise level are retained.

[0049] Based on the above logic, the scattering response intensity of pixels within the water body region satisfies the following relationship:

[0050] ;

[0051] in, It is a pixel. The scattering response intensity; It is a pixel. grayscale value; It is a pixel. The average gray value of all pixels in the neighborhood; It is a pixel. The standard deviation of gray level within the neighborhood; This is the noise standard deviation of the image sensor, and this value is greater than 0; It is the signal-to-noise ratio adjustment coefficient; It is a natural exponential function; It is the absolute value symbol; It is a preset first tiny value used to prevent It should be 0, or it can be set to 0.001.

[0052] In this relation, It is the Weber contrast term, in which the molecule The denominator represents the absolute magnitude of the deviation of the current pixel's grayscale from the local background grayscale mean, reflecting the absolute strength of the signal; This represents the base brightness level of the local background; dividing the two achieves the normalization of the illumination, meaning that regardless of whether it is a bright area or a shadow area, as long as the relative contrast is consistent, a consistent response value will be produced. This is a noise suppression weighting term. This term constructs a nonlinear filter using the ratio of local variance to the sensor's inherent noise variance. Within the exponential function of this term, the numerator... Representing pixels The gray-scale fluctuation energy in the neighborhood of the denominator This represents the device's noise floor tolerance limit after coefficient adjustment; the ratio of the two reflects the pixel density. The signal-to-noise ratio (SNR) level of the region. When the local variance is significantly less than the noise floor tolerance limit, the ratio approaches zero, the exponential term approaches 1, causing the noise suppression weighting term to approach zero, thereby suppressing random noise; conversely, when the local variance is greater than the noise floor limit, the noise suppression weighting term approaches 1, preserving the true signal.

[0053] It is necessary to further add the signal-to-noise ratio adjustment coefficient. The value needs to be set according to the camera's signal-to-noise ratio characteristics and the ambient light environment: for imaging equipment with limited signal-to-noise ratio performance or in low-light conditions, due to the inherent high noise level of its imaging, in order to prevent false alarms, It can be set to a larger value, such as This enhances noise suppression; for industrial-grade imaging equipment with high signal-to-noise ratios or in well-lit conditions, its image quality is better. It can be set to a smaller value, such as To preserve more subtle grain details; in this embodiment, given the use of an industrial camera, The preferred value is 1.5.

[0054] Thus, the scattering response intensity of each pixel within the water body area was obtained.

[0055] Step S300: Construct the structure tensor matrix of each pixel and perform eigenvalue decomposition to obtain the maximum and minimum eigenvalues; based on the ratio of the geometric mean to the arithmetic mean of the maximum and minimum eigenvalues, obtain the texture disorder of each pixel.

[0056] It should be noted that in the water body area, in addition to suspended particles, there are also non-particulate high-brightness interferences, such as linear scratches on the viewing window wall, laminar ripples generated by water flow, or microbubble flow. Intensity information alone is insufficient to distinguish these interferences from actual turbidity particles. Considering that actual turbidity is caused by a large number of randomly distributed particles, its texture exhibits high spatial isotropy, meaning its orientation is chaotic and its energy distribution is uniform; while scratches or water flow patterns typically show significant anisotropy, meaning they have a specific direction of extension. To construct a composite discrimination model based on gradient energy and directional consistency, this invention utilizes structural tensor tools to analyze local geometry, thereby filtering out high-energy and disordered texture regions.

[0057] First, obtain the structure tensor matrix and its eigenvalues ​​for each pixel within the water body region. It should be noted that the structure tensor matrix effectively characterizes the principal gradient directions and intensity distribution in a local image, serving as a fundamental tool for analyzing texture directionality.

[0058] Specifically, for each pixel within the water body region, its structure tensor matrix is ​​obtained, and eigenvalue decomposition is performed on the structure tensor matrix to obtain the largest eigenvalue. and minimum eigenvalue ,in, The intensity representing the direction of the maximum rate of change of the local gradient. This represents the gradient intensity perpendicular to that direction.

[0059] Then, the texture disorder degree is calculated. It should be noted that, in order to accurately capture murky regions with chaotic texture characteristics and effectively suppress linear interference in one direction, this invention first uses the ratio of the geometric mean to the algebraic mean of eigenvalues ​​to characterize the energy density and distribution uniformity of the local gradient; secondly, it introduces the mean-mean inequality principle, which states that for any two non-negative real numbers, their arithmetic mean is always greater than or equal to their geometric mean, and equality holds if and only if they are equal. The advantage of the mean-mean inequality is that it provides a rigorous criterion for measuring numerical balance, and can keenly reflect the degree of difference between two variables.

[0060] Specifically, this invention utilizes the ratio of the square of the sum of the largest and smallest eigenvalues ​​to four times the product of the largest and smallest eigenvalues ​​to construct an exponential decay function with this ratio as the independent variable, thereby suppressing anisotropic textures with specific extension directions.

[0061] Based on the above logic, the texture disorder of each pixel within the water body region satisfies the following relationship:

[0062] ;

[0063] in, It is a pixel. Texture disorder; , They are pixels The maximum and minimum eigenvalues ​​of the structure tensor matrix at the location; It is a natural exponential function; It is a preset second tiny value used to prevent If the value is 0, it can be set to 0.001; It is a preset third micro value used to prevent It should be 0, or it can be set to 0.001.

[0064] This expression consists of the product of two parts, the first part being... The formula utilizes the ratio of the geometric mean to the arithmetic mean of the eigenvalues. The numerator, based on the geometric mean of the eigenvalues, reflects the coupling strength of gradients in two orthogonal directions; this value is large only when there is strength in both directions. The denominator, based on the algebraic mean of the eigenvalues, reflects the total gradient energy. This term is used to characterize whether the gradient distribution in various directions in a local region is balanced and full, thus excluding flat backgrounds or edges in a single direction. Part Two It utilizes the geometric corollary of the AM-GM inequality, where the fractional terms inside the exponential function... Used to assess the degree of anisotropy, according to the mean-mean inequality, the value of this fractional term is always greater than or equal to 1. When the local texture exhibits a chaotic isotropic distribution, the two eigenvalues ​​are approximately equal, and the fractional term approaches 1, while the exponential function value approaches its maximum value of 1. Conversely, when the local texture exhibits a clear specific directionality, the difference between the two eigenvalues ​​is significant, the value of the fractional term increases, causing the independent variable of the exponential function to become negative and its absolute value to increase, and the function value to rapidly decay to zero, thereby effectively suppressing scratches or water flow patterns.

[0065] At this point, the texture disorder of each pixel within the water body area has been obtained.

[0066] Step S400: Based on the scattering response intensity and texture disorder, obtain the particle confidence of each pixel; calculate the difference between the particle confidence of each pixel and a preset response threshold, map the difference to a nonlinear weighting coefficient using the Sigmoid function, and use the nonlinear weighting coefficient to weight the particle confidence of each pixel to obtain the weighted particle confidence of each pixel; calculate the average value of the weighted particle confidence of all pixels in the water body area as the comprehensive turbidity; evaluate the MBR permeate status based on the comparison result of the comprehensive turbidity and the preset alarm threshold.

[0067] It should be noted that scattering response intensity characterizes the degree of grayscale abrupt change of a pixel, while texture disorder characterizes the spatial disorder of the texture. To accurately assess the overall turbidity of the water body, these two dimensions of features need to be fused. Considering that an effective suspended particle signal should simultaneously possess high grayscale contrast and spatial disorder, this invention adopts a multiplicative coupling mechanism to reflect the collaborative logic of features; that is, only when both indicators are in the high value range are they judged as high-confidence suspended particles. Based on this, considering that the Sigmoid function has unique S-shaped nonlinear saturation characteristics, which can smoothly map input values ​​with a wide dynamic range to the normalized interval and exhibit high-discrimination response capability in the threshold critical region, this invention introduces the Sigmoid function to establish a nonlinear soft threshold screening mechanism. Utilizing its function shape of saturation at both ends and steepness in the middle, it achieves nonlinear retention of high-confidence effective signals and smooth suppression of low-amplitude residual noise, ultimately aggregating to obtain macroscopic indicators that objectively reflect the overall water quality status of the water body area.

[0068] Based on the above logic, the overall turbidity satisfies the following relationship:

[0069] ;

[0070] in, It refers to the overall turbidity of the water body area; It is a pixel. The scattering response intensity; It is a pixel. Texture disorder; It is the gain coefficient of the sigmoid function; It is the response threshold; It is a collection of pixels within a water body area; It represents the total number of pixels within the water body area; It is a natural exponential function.

[0071] In this relation, the first part Used to characterize pixels As for the particle confidence score of suspended particles, the first part is only relatively large when the pixel simultaneously possesses both high scattering response intensity and high texture disorder; the absence of any single feature, such as a scratch with only highlights but ordered texture, will cause the value of the first part to decrease. Second part... It is a nonlinear soft thresholding weight term based on the Sigmoid function, used to determine the validity weight of the current signal, where, This represents the difference between the particle confidence level and the response threshold; when the particle confidence level is less than the response threshold... When the difference is negative, the Sigmoid function value rapidly decays to near zero, thus suppressing background noise; when the particle confidence is greater than the response threshold... When the sigmoid function value approaches 1, it retains a turbid signal with high confidence.

[0072] It should be noted that the gain coefficient Settings need to be configured according to actual working conditions and hardware environment: for scenarios with high detection sensitivity requirements and strict ambient light control. It can be set to a larger value, such as 10, to create a steep cutoff boundary; for scenes with weak ambient light fluctuations and high tolerance for low noise, This value can be appropriately reduced, such as setting it to 5, to achieve a smooth soft threshold transition. For the conventional MBR permeate environment in this embodiment, The optimal value is 8. It should also be noted that the parameter response threshold... The response threshold is a key indicator determining the sensitivity of the sigmoid nonlinear screening mechanism; essentially, it defines the critical activation level at which scattered energy is considered a valid suspended particle signal. The value should be adaptively set based on the baseline illumination level and expected noise intensity of the water monitoring environment: for clean water bodies or low-light environments, since suspended particles scatter light weakly, the value should be appropriately reduced to prevent missing small particles. Value, such as set to This lowers the activation threshold and improves detection sensitivity. For environments with strong light interference or naturally turbid backgrounds, to avoid glare from water ripples or incorrect amplification of sensor thermal noise, the sensitivity should be appropriately increased. Value, such as set to This raises the activation threshold and enhances the system's robustness against false signals. In this embodiment, considering the imaging characteristics of a general industrial camera, It is preferable to set it to 3 times the baseline noise level in order to achieve a balance between sensitivity and noise immunity.

[0073] Finally, the calculated overall turbidity is compared with the preset alarm threshold. If the overall turbidity is greater than the alarm threshold, it is determined that the membrane module may be damaged or the turbidity of the produced water is abnormal. The equipment will automatically trigger an audible and visual alarm or send a warning message to the remote terminal to prompt the operation and maintenance personnel to check.

[0074] It should be noted that the alarm threshold setting needs to be dynamically adjusted based on the product water quality standards and reuse requirements: For product water used for high-standard reuse, such as reverse osmosis feed water, the tolerance for turbidity anomalies is extremely low, and the alarm threshold should be set to a larger value, such as 0.5, to improve detection sensitivity and ensure that any minor damage can be detected in time; for product water used for general discharge or in scenarios where there is a certain tolerance for turbidity fluctuations, the alarm threshold can be appropriately reduced, such as set to 0.8, to reduce the frequency of false alarms caused by occasional bubbles or instantaneous fluctuations in the water. In this embodiment, the alarm threshold is preferably set to 0.6.

[0075] like Figure 4 The diagram shows the characteristics of turbidity. The colored bars represent the scale of overall turbidity, with an upper limit of 1. When the overall turbidity is higher than 0.8, it is considered an anomaly exceeding the alarm threshold. The left area of ​​the diagram represents turbid water, with its overall turbidity significantly higher than the threshold, corresponding to the high-intensity region of the scale. This area is not uniformly distributed but exhibits a structured difference with high signal intensity at the center and gradually decreasing intensity towards the edges, while also containing subtle random signal fluctuations, successfully achieving accurate characterization of turbid water. The right area represents clear water, with its overall turbidity lower, corresponding to the low-intensity region of the scale. This area contains weak and irregular non-zero signals, reflecting the background noise characteristics of the actual system, but the overall turbidity is below the alarm threshold, and no warning is triggered.

[0076] This completes the turbidity test of the MBR permeate.

[0077] The second aspect of this embodiment provides an image processing-based MBR permeate turbidity detection system, such as... Figure 5As shown, the image processing-based MBR permeate turbidity detection system includes a memory and a processor. The memory stores computer program instructions, which, when executed by the processor, implement the image processing-based MBR permeate turbidity detection method of the first aspect of the present invention.

[0078] The image processing-based MBR permeate turbidity detection system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces. Their settings and functions are known in the art and will not be described in detail here.

[0079] In this invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used or combined with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic or magneto-optical storage medium, such as resistive random access memory (DRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (DRAM), high-bandwidth memory, hybrid memory cube, etc., or any other medium that can be used to store desired information and can be accessed by an application, module, or both. Any such computer storage medium can be part of a device or accessible to or connected to a device.

[0080] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.

Claims

1. A method for detecting turbidity in MBR permeate based on image processing, characterized in that, include: Obtain the original image of the MBR permeate pipeline, and extract the water area in the original image using a preset mask matrix; Calculate the local contrast of each pixel within the water body region relative to its neighborhood, construct a suppression weight based on the noise standard deviation of the image sensor, calculate the product of the suppression weight and the local contrast, and obtain the scattering response intensity of each pixel. Construct the structure tensor matrix of each pixel and perform eigenvalue decomposition to obtain the maximum and minimum eigenvalues; Based on the ratio of the geometric mean to the arithmetic mean of the maximum and minimum eigenvalues, the texture disorder of each pixel is obtained; Based on the scattering response intensity and texture disorder, the particle confidence level of each pixel is obtained; The difference between the particle confidence score of each pixel and a preset response threshold is calculated. The difference is mapped to a non-linear weighting coefficient using the Sigmoid function. The particle confidence scores of each pixel are weighted using the non-linear weighting coefficient to obtain the weighted particle confidence score of each pixel. The average weighted particle confidence score of all pixels in the water body area is calculated as the comprehensive turbidity. The MBR permeate status is evaluated based on the comparison between the comprehensive turbidity and a preset alarm threshold. The scattering response intensity satisfies the following relationship: ;in, It is a pixel. The scattering response intensity; It is a pixel. grayscale value; It is a pixel. The average gray value of all pixels in the neighborhood; It is a pixel. The standard deviation of gray level within the neighborhood; It is the noise standard deviation of the image sensor; It is the signal-to-noise ratio adjustment coefficient; It is the natural exponential function; It is the absolute value symbol; It is the preset first minute value.

2. The method for detecting turbidity in MBR permeate based on image processing according to claim 1, characterized in that, The disorder of the texture satisfies the following relation: ; in, It is a pixel. Texture disorder; , They are pixels The maximum and minimum eigenvalues ​​of the structure tensor matrix at the location; It is the natural exponential function; It is the preset second minute value; It is the preset third minute value.

3. The MBR permeate turbidity detection method based on image processing according to claim 1, characterized in that, The step of weighting the granular confidence of each pixel using nonlinear weighting coefficients to obtain the weighted granular confidence of each pixel includes: The granular confidence of each pixel is multiplied by the corresponding nonlinear weight coefficient to obtain the weighted granular confidence of each pixel.

4. The MBR permeate turbidity detection method based on image processing according to claim 3, characterized in that, The particle confidence level is the product of the square of the texture disorder and the scattering response intensity.

5. The method for detecting turbidity in MBR permeate based on image processing according to claim 1, characterized in that, The acquisition of the preset mask matrix includes: Acquire static background images containing transparent windows on the MBR permeate pipeline; Based on the geometric edge coordinates of the transparent window in the static background image, the pixel values ​​corresponding to the internal region of the transparent window are set to 1, and the pixel values ​​corresponding to the pipe wall and border region are set to 0, thus generating a mask matrix.

6. The method for detecting turbidity in MBR permeate based on image processing according to claim 1, characterized in that, The acquisition of the noise standard deviation of the image sensor includes: During the initial detection phase, multiple frames of images of the MBR permeate pipeline were acquired under conditions of light blocking or photographing pure water. The standard deviation of pixel grayscale values ​​in multi-frame MBR permeate pipeline images is used as the noise standard deviation of the image sensor.

7. The MBR permeate turbidity detection method based on image processing according to claim 1, characterized in that, The step of extracting the water region from the original image using a preset mask matrix includes: The grayscale value of each pixel in the original image is multiplied by the element value at the corresponding position in the preset mask matrix to obtain the water area.

8. The MBR permeate turbidity detection method based on image processing according to claim 1, characterized in that, The construction of the structure tensor matrix for each pixel includes: Calculate the gradient vector of each pixel; Calculate the outer product of the gradient vectors to obtain the gradient tensor; Gaussian smoothing is applied to the gradient tensor to obtain the structure tensor matrix of each pixel.

9. A system for detecting turbidity in MBR permeate based on image processing, characterized in that, The image processing-based MBR permeate turbidity detection system includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the image processing-based MBR permeate turbidity detection method according to any one of claims 1-8.