Membrane surface contamination monitoring method, device, equipment and medium based on image analysis
Through image analysis technology, biological pollution on the filter membrane surface of the MBR system is identified, which solves the shortcomings of single indicator monitoring in the existing technology, achieves comprehensive and accurate monitoring of membrane surface pollution, and improves the stability and filtration performance of the sewage treatment system.
Patent Information
- Application Number
- CN202410916915.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-07-10
AI Technical Summary
The existing MBR system relies on a single indicator, TMP, to monitor biological pollution on the filter membrane surface in sewage treatment, which cannot accurately identify pollution characteristics and regional differences, resulting in membrane pore blockage, impact on filtration performance, and unstable data quality.
A membrane surface pollution monitoring method based on image analysis is used to obtain biofilm images for grayscale processing and adaptive threshold combination to identify areas with different pollution levels and calculate the pollution index to achieve comprehensive and accurate monitoring of membrane surface pollution.
It overcomes the shortcomings of single indicator monitoring, achieves comprehensive and accurate monitoring of membrane surface pollution, adapts to different shooting equipment and imaging conditions, and improves monitoring precision and accuracy.
Smart Images

Figure CN118447028B
Abstract
Description
Technical Field
[0001] The present application relates to the field of wastewater biological treatment, and in particular to a membrane surface contamination monitoring method, device, equipment and medium based on image analysis. Background Art
[0002] Biological fouling on the filter membrane surface is a chronic problem in wastewater treatment by the membrane bioreactor (MBR) process. Severe biological fouling will lead to blockage of membrane pores, thereby affecting the membrane filtration performance. In order to maintain the stable operation of the system, it is necessary to monitor the degree of membrane surface fouling during the operation of the MBR and timely regulate and clean the filter membrane. At present, the operation monitoring indicators of MBR are single, and most sewage treatment plants only judge the degree of membrane fouling by the change of the transmembrane pressure (TMP) of the filter membrane. On the one hand, the data acquisition of this monitoring method that relies on a single indicator is significantly affected by the sensor, and the data quality is difficult to guarantee; on the other hand, TMP alone cannot identify the specific characteristics of membrane fouling, such as the balance of pollution, the difference in pollution in different areas of the membrane surface, and other information. Summary of the invention
[0003] The purpose of this application is to provide a membrane surface contamination monitoring method, device, equipment and medium based on image analysis, which can realize comprehensive and accurate monitoring of membrane surface contamination.
[0004] To achieve the above objectives, this application provides the following solutions.
[0005] In a first aspect, the present application provides a membrane surface contamination monitoring method based on image analysis, comprising:
[0006] Acquire biofilm images;
[0007] grayscale the biofilm image to obtain a grayscale image;
[0008] Taking minimization of the objective function as the goal, an optimal threshold combination is obtained in an adaptive manner; wherein the objective function is a function that characterizes the difference between the grayscale image and the threshold image, the threshold image is obtained by thresholding the grayscale image based on the threshold combination, and is used to characterize the distribution of areas with different degrees of contamination, and the threshold combination includes a plurality of different thresholds, and the plurality of different thresholds are used to distinguish different degrees of contamination of the biofilm;
[0009] The grayscale image is thresholded based on the optimal threshold combination to obtain an optimal threshold image.
[0010] Optionally, the biofilm image is grayed to obtain a grayscale image, and then the method further includes:
[0011] Performing median filtering on the grayscale image to obtain a filtered grayscale image;
[0012] The filtered grayscale image is equalized to obtain a preprocessed grayscale image.
[0013] Optionally, performing equalization processing on the filtered grayscale image to obtain the grayscale image after equalization processing specifically includes:
[0014] Performing contrast-limited adaptive histogram equalization on the filtered grayscale image to obtain an equalized grayscale image;
[0015] The equalized grayscale image is mixed with the filtered grayscale image to obtain a preprocessed grayscale image.
[0016] Optionally, thresholding the grayscale image based on the optimal threshold combination to obtain an optimal threshold image specifically includes:
[0017] Cutting the grayscale image into a plurality of grayscale sub-images;
[0018] Thresholding each of the grayscale sub-images based on the optimal threshold combination to obtain a plurality of optimal thresholded sub-images;
[0019] A morphological closing operation is performed on the plurality of optimal thresholded sub-images to obtain an optimal threshold map.
[0020] Optionally, the grayscale image is thresholded based on the optimal threshold combination to obtain an optimal threshold image, and then the method further includes:
[0021] Positioning and connecting domain analysis are performed on the heavily polluted area in the optimal threshold map to obtain the heavily polluted connected domain in the optimal threshold map; the heavily polluted area is an area whose gray value is less than or equal to the minimum threshold in the optimal threshold combination;
[0022] The pollution index is calculated based on the heavily polluted connected domains in the optimal threshold map.
[0023] Optionally, the formula for calculating the pollution index is:
[0024] score = area × (255-mean);
[0025] Among them, score is the pollution index, area is the total area of all heavily polluted connected domains in the optimal threshold map, and mean is the average grayscale value of each pixel in the corresponding area of all heavily polluted connected domains in the optimal threshold map in the grayscale map.
[0026] Optionally, the grayscale image is thresholded based on the optimal threshold combination to obtain an optimal threshold image, and then the method further includes:
[0027] According to the distribution of regions with different pollution degrees represented by the optimal threshold map, calculating the area ratio of the region with each pollution degree in the optimal threshold map;
[0028] The average pollution index is obtained by weighted calculation of the area proportion of each pollution level in the optimal threshold map.
[0029] In a second aspect, the present application provides a membrane surface pollution monitoring device based on image analysis, wherein the membrane surface pollution monitoring device based on image analysis applies the above-mentioned membrane surface pollution monitoring method based on image analysis, and the membrane surface pollution monitoring device based on image analysis comprises:
[0030] An image acquisition module, used for acquiring biofilm images;
[0031] A grayscale module, used for grayscale processing the biofilm image to obtain a grayscale image;
[0032] An adaptive threshold module is used to obtain an optimal threshold combination in an adaptive manner with the objective of minimizing an objective function; wherein the objective function is a function that characterizes the difference between a grayscale image and a threshold image, and the threshold image is obtained by thresholding the grayscale image based on the threshold combination, and is used to characterize the distribution of areas with different degrees of contamination, and the threshold combination includes a plurality of different thresholds, and the plurality of different thresholds are used to distinguish different degrees of contamination of the biofilm;
[0033] A thresholding module is used to threshold the grayscale image based on the optimal threshold combination to obtain an optimal threshold image.
[0034] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned membrane surface contamination monitoring method based on image analysis.
[0035] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned membrane surface contamination monitoring method based on image analysis.
[0036] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0037] The present application provides a membrane surface contamination monitoring method, device, equipment and medium based on image analysis. Comprehensive and accurate monitoring of membrane surface contamination can be achieved. The present application obtains biofilm images, processes and analyzes the biofilm images, and determines the distribution of different degrees of contamination, thereby overcoming the defects of existing single-indicator monitoring methods and achieving comprehensive and accurate monitoring of membrane surface contamination. In addition, the present application uses an adaptive method to determine the threshold, which allows the method of the present application to adapt to biofilm images obtained under different shooting equipment and imaging conditions, thereby ensuring monitoring accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 This is a diagram of the application environment of a membrane surface contamination monitoring method based on image analysis in one embodiment of the present application.
[0040] Figure 2 A schematic flow chart of a membrane surface contamination monitoring method based on image analysis provided in one embodiment of the present application.
[0041] Figure 3 A detailed flow chart of a membrane surface contamination monitoring method based on image analysis provided in one embodiment of the present application.
[0042] Figure 4 A schematic diagram of an image analysis and data export user interface provided in one embodiment of the present application.
[0043] Figure 5 This is an image of a hollow fiber membrane provided in one embodiment of the present application.
[0044] Figure 6 A comparison diagram of the grayscale effects with and without a preprocessing step provided in an embodiment of the present application.
[0045] Figure 7 A comparison diagram of thresholding effects with and without an adaptive thresholding step provided in an embodiment of the present application.
[0046] Figure 8 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0049] The membrane surface contamination monitoring method based on image analysis provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the biofilm image to the server 104, and the server 104 receives the biofilm image. For the biofilm image, the server 104 grayscales the biofilm image to obtain a grayscale image; with the objective function minimization as the goal, an adaptive method is adopted to obtain the optimal threshold combination; based on the optimal threshold combination, the grayscale image is thresholded to obtain the optimal threshold image. The server 104 can feedback the obtained optimal threshold image to the terminal 102. In addition, in some embodiments, the membrane surface contamination monitoring method based on image analysis can also be implemented separately by the server 104 or the terminal 102, such as the terminal 102 can directly process and analyze the biofilm image, or the server 104 can obtain the biofilm image from the data storage system, and process and analyze the biofilm image.
[0050] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. The terminal 102 only needs to be able to receive biofilm images or store biofilm images. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.
[0051] In an exemplary embodiment, Figure 2As shown, a membrane surface contamination monitoring method based on image analysis is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used for explanation, and the steps include the following steps 201 to 204.
[0052] Step 201, obtaining a biofilm image.
[0053] Step 202: grayscale the biofilm image to obtain a grayscale image.
[0054] Step 203, with the objective of minimizing the objective function, an optimal threshold combination is obtained in an adaptive manner; wherein the objective function is a function that characterizes the difference between the grayscale image and the threshold image, the threshold image is obtained by thresholding the grayscale image based on the threshold combination, and is used to characterize the distribution of areas with different pollution degrees, the threshold combination includes a plurality of different thresholds, and the plurality of different thresholds are used to distinguish different pollution degrees of the biofilm. Preferably, the objective function is the mean square error between the grayscale image and the threshold image.
[0055] Step 204: threshold the grayscale image based on the optimal threshold combination to obtain an optimal threshold image.
[0056] By implementing the above steps 201 to 204, comprehensive and accurate monitoring of membrane surface contamination can be achieved.
[0057] The present invention is further described below through the accompanying drawings and specific examples.
[0058] In the membrane surface pollution monitoring method based on image analysis of the above embodiment, the membrane pollution automatic monitoring and analysis method based on python image conversion is adopted, including: step 1: biofilm image shooting; step 2: cropping correction; step 3: image preprocessing; step 4: threshold analysis; step 5: threshold self-optimization; step 6: key pollution domain identification; step 7: data export, such as Figure 3 As shown, Figure 3 The images on the right side of the figure are schematic diagrams of the results after processing in different steps.
[0059] Figure 3 The specific implementation of the method shown is as follows.
[0060] S1: Take biofilm images during the stable operation of the MBR, filter and crop the clear areas, and adjust the image contrast and brightness to make them uniform.
[0061] S2: Build a python environment and import the required libraries; import the captured biofilm image, grayscale the biofilm image, convert the grayscale image into an array format and remove the noise in the image through median filtering; equalize the grayscale image, correct the image shadow, and obtain the preprocessed grayscale image.
[0062] S3: Dynamically crop the preprocessed grayscale image according to the size of the input image, and divide the preprocessed grayscale image into image sub-regions, namely grayscale sub-images.
[0063] S4: Apply multi-threshold analysis to each grayscale sub-image, set three thresholds thresh1, thresh2, and thresh3, and distinguish the pollution domain according to the pixel value. The grayscale sub-image is divided into heavily polluted, moderately polluted, lightly polluted, and background areas and assigned values respectively. The processed thresholded sub-images are merged into a threshold map to visualize different levels of pollution.
[0064] S5: In the acquired threshold image, extract the heavily polluted area and perform connected domain analysis; locate the heavily polluted area in the grayscale image, and select the key polluted domains and mark them in the grayscale image.
[0065] S6: Set up a threshold self-optimization module, convert the grayscale image and the threshold image into a unified format, and calculate the mean square error of the pixel values of the entire image. To minimize the mean square error, thresh1, thresh2, and thresh3 are traversed and optimized within their respective parameter ranges to obtain the best threshold combination.
[0066] S7: Based on the optimal threshold combination obtained in S6 above, analyze the grayscale sub-image according to the threshold to obtain the contours of different pollution domains, distinguish the pollution domains in the grayscale sub-images, and merge them to obtain the optimal threshold image; and further obtain the statistical information of different pollution degree areas in the optimal threshold image, as well as the annotation and specific information of the key pollution areas. The derived information can be adjusted according to actual needs, such as Figure 4 shown.
[0067] In the process of realizing the functions in the above steps, the selection of relevant functions, parameter settings and the introduction of morphological operations can be adjusted according to actual needs, preferably to be suitable for the features of the captured image. The following takes the automatic monitoring and analysis of membrane contamination on the surface of hollow fiber membranes as an example to further illustrate the implementation process and effect of the present invention.
[0068] In this embodiment, a camera installed inside the membrane module is used to capture the surface contamination of the hollow fiber membrane during operation. Images are collected at three different points every 2 days. The collected images of the hollow fiber membrane are as follows: Figure 5As shown. The collected images are cropped to capture clear areas and the image size, contrast, and brightness are preliminarily adjusted before being uniformly imported into an image analysis system written in Python. In this embodiment, the biological contamination information on the filter membrane surface during the operation of the MBR is efficiently extracted, specifically according to the following steps.
[0069] In the image preprocessing step, configure the Python environment and import the required libraries such as NumPy, Pillow, Pandas, OpenCV, etc. Use cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) to convert the original image image into a grayscale image.
[0070] Create a clahe object and call contrast-limited adaptive histogram equalization, where the cropping limit parameter is set to 2.5 and the cropping area parameter is (8, 8); use cv2.addWeighted() to mix the equalized grayscale image with the original image (the original grayscale image or the filtered grayscale image) to avoid excessive equalization, and the weights set during mixing are 0.5 each.
[0071] Use cv2.medianBlur() to perform median filtering on the array format grayscale image np_image to remove noise, set the filter size ksize to 5, and after processing, obtain the preprocessed grayscale image filtered_image.
[0072] In the thresholding step, np.array() is used to obtain an array-format grayscale image np_image. The grayscale image is analyzed in blocks to reduce the problems caused by differences in imaging conditions in the image regions. The filtered_image is divided into 5 rows and 10 columns to obtain 50 grayscale sub-images sub_image. In this embodiment, the image input is controlled by dynamic cropping to avoid the phenomenon of incomplete image cropping.
[0073] Apply multi-threshold analysis, set the threshold combination (thresh1, thresh2, thresh3), and apply cv2.threshold() for threshold processing. According to the results of the threshold analysis, the area with pixel values less than thresh1 is defined as the heavily polluted area, and the pixels in the area are assigned a value of 50; the area with pixel values between thresh1 and thresh2 is defined as the moderately polluted area, and the value is 100; the area with pixel values between thresh2 and thresh3 is defined as the lightly polluted area, and the value is 200; the area with pixel values higher than thresh3 is considered to be the background, and the value is 255.
[0074] Perform morphological closing operations on each sub - image using cv2.morphologyEx(), re - integrate the processed images, and merge them into a threshold image combined_image for further processing.
[0075] In the step of threshold self - optimization, optimize the three thresholds used to distinguish different degrees of pollution regions. Convert the threshold image filtered_image and the grayscale image combined_image to float format to avoid image data overflow. Define the mean square error MSE of the two as the objective function, and optimize the threshold combination within a given range with the goal of minimizing MSE.
[0076] Exemplarily, set the conditions for optimizing the three parameters as thresh1 < thresh2 < thresh3, and set the threshold optimization range to 50 - 200. During the process of traversing and optimizing the parameters, the traversal step size is 5 - 10 of the parameter value range. The finally calculated optimal parameter combination thresh1, thresh2, thresh3 are 80, 150, 190 respectively.
[0077] In the step of identifying and labeling key pollution regions, re - perform thresholding on the grayscale image with the thresholds in the optimized optimal threshold combination to obtain the optimal threshold image combined_image. Locate the severely polluted regions (i.e., regions assigned 50) in the optimal threshold image, and use cv2.connectedComponentsWithStats() for connected component analysis and record the connected component statistical information.
[0078] Traverse all severely polluted connected components, and quantify the severity of pollution according to their area and chromaticity. Specifically, obtain the area area of the region from the connected component analysis, construct a mask to obtain the corresponding region in the grayscale image, and calculate its average pixel value mean. Calculate the pollution index score = area×(255 - mean). Sort all connected components in descending order of score, and select the top 10 regions with the highest score as the key pollution regions and label them in filtered_image.
[0079] In the step of data export, combine the grayscale image and the threshold image for overall biological pollution information extraction and statistical analysis of the image. For the aforementioned identified key pollution regions, record their area, average pixel value of the grayscale image, and the proportion of the region area in the whole image in the dataframe (data table).
[0080] For the entire map, use cv2.calcHist() to construct a histogram to calculate the standard deviation of pixels in the entire map, calculate the area ratio of heavily, moderately, and lightly polluted domains in the entire map, and calculate the average pollution index based on the weighted area of domains with different degrees of pollution. The index is also recorded in the dataframe and exported.
[0081] In order to show the effect of the above-mentioned image preprocessing and threshold combination control, a corresponding comparison is set in this embodiment: Figure 6 , Figure 6 a) in the figure is the grayscale image without image preprocessing. Figure 6 b) in the figure is the pre-processed grayscale image obtained by adjusting the brightness and contrast of the image, removing noise and performing equalization. Figure 6 The image shown in a) has low contrast, the contaminated area is unclear, and there is an obvious shadow at the edge. This is because the diameter of the hollow fiber membrane is small, and the curvature causes the imaging distance and lighting conditions of the edge and the central area to be different. If no correction is made, it cannot be distinguished from the darkening caused by the shadow in the threshold processing, which is easy to cause misjudgment.
[0082] See also Figure 7 , Figure 7 a) in the figure is the threshold diagram obtained when the custom threshold combination thresh1=80, thresh2=105, thresh3=130, Figure 7 b) in the figure is the threshold diagram when the optimal threshold combination thresh1=80, thresh2=150, thresh3=190 is obtained by applying parameter self-optimization in this embodiment. Figure 7 It can be seen that when using the custom threshold combination, more polluted areas are ignored and identified as background, and the distinction between heavy pollution and moderate pollution domains is not obvious. However, the image after applying the parameter self-optimization module can better reflect the various pollution domains in the original image and distinguish the degree of pollution.
[0083] The present application also provides an application scenario, which applies the above-mentioned membrane surface pollution monitoring method based on image analysis. Specifically: The membrane surface pollution monitoring method based on image analysis provided in this embodiment can be applied in wastewater biological treatment. The membrane surface pollution monitoring method based on image analysis provided in this embodiment belongs to the monitoring link. Specifically, based on the above method, the optimal threshold map and statistical information are obtained. Based on the optimal threshold map and statistical information, the sewage treatment effect can be determined, and whether further measures should be taken, such as updating and cleaning the biofilm.
[0084] Based on the same inventive concept, the embodiment of the present application also provides a membrane surface pollution monitoring device based on image analysis for implementing the membrane surface pollution monitoring method based on image analysis involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the membrane surface pollution monitoring device based on image analysis provided below can refer to the limitations of the membrane surface pollution monitoring method based on image analysis above, and will not be repeated here.
[0085] In an exemplary embodiment, a membrane surface contamination monitoring device based on image analysis is provided, including: an image acquisition module, for acquiring a biofilm image. A grayscale module, for grayscale processing the biofilm image to obtain a grayscale image. An adaptive threshold module, for obtaining an optimal threshold combination in an adaptive manner with the objective of minimizing an objective function; wherein the objective function is a function that characterizes the difference between a grayscale image and a threshold image, and the threshold image is obtained by thresholding the grayscale image based on a threshold combination, and is used to characterize the distribution of areas with different degrees of contamination, and the threshold combination includes a plurality of different thresholds, and the plurality of different thresholds are used to distinguish different degrees of contamination of the biofilm. A thresholding module, for thresholding the grayscale image based on the optimal threshold combination, and obtaining an optimal threshold image.
[0086] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data determined by complementarity. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a membrane surface contamination monitoring method based on image analysis is implemented.
[0087] Those skilled in the art will understand that Figure 8The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0088] In an exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in the above-mentioned membrane surface contamination monitoring method embodiment based on image analysis are implemented.
[0089] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which, when executed by a processor, implements the steps in the above-mentioned membrane surface contamination monitoring method embodiment based on image analysis.
[0090] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0091] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, etc., but is not limited thereto.
[0092] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0093] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A membrane surface pollution monitoring method based on image analysis, characterized in that: include: Acquire biofilm images; grayscale the biofilm image to obtain a grayscale image; Taking minimization of the objective function as the goal, an optimal threshold combination is obtained in an adaptive manner; wherein the objective function is a function that characterizes the difference between the grayscale image and the threshold image, the threshold image is obtained by thresholding the grayscale image based on the threshold combination, and is used to characterize the distribution of areas with different degrees of contamination, and the threshold combination includes a plurality of different thresholds, and the plurality of different thresholds are used to distinguish different degrees of contamination of the biofilm; Thresholding the grayscale image based on the optimal threshold combination to obtain an optimal threshold image; Thresholding the grayscale image based on the optimal threshold combination to obtain an optimal threshold image specifically includes: Cutting the grayscale image into a plurality of grayscale sub-images; Thresholding each of the grayscale sub-images based on the optimal threshold combination to obtain a plurality of optimal thresholded sub-images; Performing a morphological closing operation on a plurality of the optimal thresholded sub-images to obtain an optimal threshold map; Thresholding the grayscale image based on the optimal threshold combination to obtain an optimal threshold image, and then further comprising: Positioning and connecting domain analysis are performed on the heavily polluted area in the optimal threshold map to obtain the heavily polluted connected domain in the optimal threshold map; the heavily polluted area is an area whose gray value is less than or equal to the minimum threshold in the optimal threshold combination; Calculate the pollution index based on the heavily polluted connected domain in the optimal threshold map; The formula for calculating the pollution index is: score = area × (255-mean); Among them, score is the pollution index, area is the total area of all heavily polluted connected domains in the optimal threshold map; mean is the average grayscale value of each pixel in the corresponding area of all heavily polluted connected domains in the optimal threshold map in the grayscale map; Thresholding the grayscale image based on the optimal threshold combination to obtain an optimal threshold image, and then further comprising: According to the distribution of regions with different pollution degrees represented by the optimal threshold map, calculating the area ratio of the region with each pollution degree in the optimal threshold map; The average pollution index is obtained by weighted calculation of the area proportion of each pollution level in the optimal threshold map.
2. The membrane surface pollution monitoring method based on image analysis according to claim 1 is characterized in that: The biofilm image is grayed to obtain a grayscale image, and then the following steps are further included: Performing median filtering on the grayscale image to obtain a filtered grayscale image; The filtered grayscale image is equalized to obtain a preprocessed grayscale image.
3. The membrane surface pollution monitoring method based on image analysis according to claim 2 is characterized in that: The filtered grayscale image is equalized to obtain a preprocessed grayscale image, which specifically includes: Performing contrast-limited adaptive histogram equalization on the filtered grayscale image to obtain an equalized grayscale image; The equalized grayscale image is mixed with the filtered grayscale image to obtain a preprocessed grayscale image.
4. A membrane surface pollution monitoring device based on image analysis, characterized in that: The membrane surface pollution monitoring device based on image analysis applies the membrane surface pollution monitoring method based on image analysis according to any one of claims 1 to 3, and the membrane surface pollution monitoring device based on image analysis comprises: An image acquisition module, used for acquiring biofilm images; A grayscale module, used for grayscale processing the biofilm image to obtain a grayscale image; An adaptive threshold module is used to obtain an optimal threshold combination in an adaptive manner with the objective of minimizing an objective function; wherein the objective function is a function that characterizes the difference between a grayscale image and a threshold image, and the threshold image is obtained by thresholding the grayscale image based on the threshold combination, and is used to characterize the distribution of areas with different degrees of contamination, and the threshold combination includes a plurality of different thresholds, and the plurality of different thresholds are used to distinguish different degrees of contamination of the biofilm; A thresholding module is used to threshold the grayscale image based on the optimal threshold combination to obtain an optimal threshold image.
5. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the membrane surface contamination monitoring method based on image analysis as described in any one of claims 1 to 3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the membrane surface contamination monitoring method based on image analysis described in any one of claims 1 to 3 is implemented.
