Sewage heavy metal concentration dynamic monitoring method and sensor based on image gray level
By establishing a database and standard curve of image grayscale values and heavy metal concentrations, and combining turbidity compensation with a multi-wavelength LED light source array, the problems of high cost, long time consumption and low accuracy in existing heavy metal pollution monitoring technologies have been solved. This has enabled low-cost, rapid and real-time monitoring of heavy metal concentrations, which is suitable for real-time control of wastewater treatment processes.
Patent Information
- Application Number
- CN202511172987.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-12-02
AI Technical Summary
Existing heavy metal pollution monitoring technologies are costly, time-consuming, unable to monitor online in real time, have low accuracy and rely on manual colorimetry, and cannot meet the real-time control requirements of wastewater treatment processes. Furthermore, existing methods cannot quickly estimate heavy metal concentrations.
A dynamic monitoring method for heavy metal concentration in wastewater based on image grayscale is adopted. By establishing a database and standard curve of image grayscale values and heavy metal concentrations, machine vision correction is used to correct changes in ambient light in real time and dynamically correct the image grayscale values of the target area. Combined with a multi-wavelength LED light source array for turbidity compensation, rapid and real-time online monitoring is achieved.
It enables low-cost, rapid, and real-time monitoring of heavy metal concentrations, reduces subjective errors, and improves monitoring accuracy and reliability. It is suitable for quickly estimating the total concentration of metal ions or the concentration of a single metal, supports data archiving and sharing, and becomes more accurate with use.
Smart Images

Figure CN121053579A_ABST
Abstract
Description
Technical Field
[0001] This invention patent belongs to the field of wastewater heavy metal monitoring technology, specifically involving a method and sensor for dynamic monitoring of wastewater heavy metal concentration based on image grayscale. It utilizes the differences in image grayscale under different heavy metal concentrations to perform rapid and real-time dynamic monitoring of heavy metal concentration. Background Technology
[0002] Heavy metals (such as Mn, Pb, Cd, Cr, Cu, Zn, etc.) are global environmental pollutants, exhibiting chronic toxicity and carcinogenicity to humans and other organisms. Heavy metal wastewater (containing ions of heavy metals such as chromium, cadmium, copper, mercury, nickel, and zinc) generated during industrial production processes in mining, metallurgy, machinery manufacturing, chemical, electronics, and instrumentation industries is among the most serious pollutants of water bodies and poses the greatest threat to human health. Due to the lack of long-term, effective, and continuous monitoring and risk warning for heavy metals in water, surface water and drinking water pollution incidents caused by heavy metals and other toxic substances occur frequently, and the problem of heavy metal pollution in water seriously affects human health.
[0003] Current methods for detecting heavy metals mainly include ultraviolet spectrophotometry (UV), atomic absorption spectrophotometry (AAS), X-ray fluorescence spectrometry (XRF), inductively coupled plasma mass spectrometry (ICP-MS), and electrochemical methods. However, existing detection methods still have some problems that urgently need to be solved. For example, colorimetric test strips rely on manual colorimetry, which is highly subjective, easily affected by ambient light, and cannot provide real-time online dynamic monitoring. Although laboratory analysis (ICP-MS, AAS, etc.) has high precision, the equipment is expensive and time-consuming, and it cannot be used for on-site detection, failing to meet the real-time control requirements of wastewater treatment processes. Consequently, it cannot detect heavy metal pollution in a timely manner, affecting the timely treatment of heavy metal pollution. Since many heavy metal solutions are colored, or can develop color after the addition of colorimetric reagents, the intensity of the color can reflect the concentration of heavy metals to some extent. Furthermore, in many application scenarios, highly precise concentration values are not required. It is only necessary to quickly estimate the overall concentration of heavy metals to determine whether the water quality meets the standards and whether further treatment is needed. In such cases, laboratory analysis (ICP-MS, AAS, etc.) is not only difficult to monitor on-site in real time, but also costly, resulting in unnecessary waste. If visual observation is used, it is not only impossible to quantify the data, but also has too large an error margin, relies heavily on the observer's experience, and has high labor costs. At the same time, the data cannot be saved, has poor traceability, and is not conducive to subsequent comparative analysis. Summary of the Invention
[0004] One of the objectives of this invention is to provide a method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale. This method is low in cost and utilizes the differences in image grayscale under different heavy metal concentrations. By employing machine vision correction, it can perform rapid and real-time online dynamic monitoring of heavy metals and promptly detect heavy metal pollution.
[0005] To achieve the above objectives, the present invention provides the following technical solution:
[0006] A method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale includes the following steps:
[0007] (1) Establish a database and standard curve for image grayscale values and heavy metal concentrations: acquire sample images under different heavy metal concentrations, simultaneously acquire standard color cards during shooting, acquire sample-color card composite images, perform image recognition, acquire image grayscale values after dynamic calibration through color cards, establish a database for image grayscale values and heavy metal concentrations, and establish a standard curve for image grayscale values and heavy metal concentrations.
[0008] (2) Take images of sewage samples, simultaneously collect standard color cards during shooting, obtain sample-color card composite images, perform image recognition, and obtain the grayscale values of sewage sample images after dynamic calibration through color cards.
[0009] (3) Substitute the image grayscale value into the standard curve or database of image grayscale value and heavy metal concentration, and then calculate the heavy metal concentration in the wastewater.
[0010] This invention improves the reliability and accuracy of measurement results by capturing images of wastewater samples and simultaneously acquiring a standard color chart during the capture process, thus obtaining a composite image of the sample and the color chart. It also allows for real-time correction of ambient light changes and dynamic adjustment of the image grayscale values in the target area. The grayscale values are then substituted into a standard curve of image grayscale versus heavy metal concentration (or, if the grayscale values match those of the same type of heavy metal in a database, the corresponding concentration value can be directly retrieved) to obtain the heavy metal concentration in the wastewater. The method is simple, suitable for rapid processing, requires minimal computation, and is cost-effective. It is applicable when rapid estimation of total metal ion concentration is needed, or when rapid calculation of the concentration of a single metal is required when the color-concentration relationship is clear.
[0011] This invention acquires a sample-color chart composite image by simultaneously capturing images of a standard color chart with known reflectance (such as X-Rite ColorChecker Classic), establishes a color mapping relationship under the current environment, and can dynamically calibrate the image grayscale value of the target area. The algorithm is as follows:
[0012]
[0013] In the formula, G corrected It refers to the corrected grayscale value, G sample G refers to the grayscale value of the captured sample. black This refers to the grayscale value of the darkest area on the color chart (to eliminate dark current), G white This refers to the grayscale value (normalized baseline) of the whitest area on the color chart, V. stdThis refers to the standard white balance grayscale value (which can be calibrated in a laboratory), when the camera pixel depth is 8 bits, V std The standard setting is 240, while for 12-bit cameras it can be set to around 3800. Density correction can also be applied in different density ranges: for example, when the camera pixel depth is 8-bit, in the low-density area, V... std Set to 240 to improve sensitivity; in the high concentration region, V std Setting it to 200 can prevent saturation.
[0014] The above algorithm is the most commonly used grayscale compensation formula in this invention, and it can also be adaptively adjusted according to the application scenario. Furthermore, the above algorithm can be supplemented with a turbidity compensation term to further improve measurement accuracy; in this case, the compensation formula is:
[0015]
[0016] In the formula, G final This refers to the final grayscale value after turbidity correction, where k represents the turbidity-grayscale compensation coefficient and T is the turbidity value of the current sample.
[0017] Furthermore, when the concentration range is complex, standard curves can be established in segments.
[0018] The concentration calculation formula (standard curve) can be: C = k0 × G final +b, where C is the concentration of heavy metal ions, k 0l And b can be fitted by gradient concentration experiments: by preparing standard concentration solutions, G is measured final Fit k0 and b. Furthermore, the above concentration calculation formula is just an example; for instance, if the relationship between image grayscale and concentration follows an exponential equation, or the concentration calculation formula can also be a cubic polynomial equation, such as G... final = a - b1·C + b2·C 2 +b3·C 3 Among them, a, b1, b2, and b3 can be fitted by a gradient concentration experiment: by preparing a standard concentration solution and measuring G... final Fit a, b1, b2, b3.
[0019] Furthermore, the standard color chart contains at least three grayscale regions with different reflectivities. The standard color chart can be an X-Rite ColorChecker, etc. The standard color chart is captured simultaneously during shooting to obtain a sample-color chart composite image, which is used to correct changes in ambient light in real time.
[0020] Furthermore, sample images were acquired at the characteristic wavelengths of heavy metals, such as Cr. 6+ Using 540nm, Cu 2+Using 620nm LEDs with a specific wavelength for illumination enhances the color differences of heavy metals, improving the signal-to-noise ratio compared to grayscale values captured by ordinary RGB cameras.
[0021] Furthermore, during the imaging process in step (2), a multi-wavelength LED light source array is used, with each wavelength LED light source being independently controllable and multi-wavelength collaborative detection. The differential response of different wavelengths to turbidity scattering is used for compensation to reduce the impact of turbidity on monitoring accuracy. Typically, 405nm and 650nm are used for turbidity compensation, and the characteristic wavelengths for heavy metals are used for heavy metal monitoring. It can be seen that this invention only requires multi-wavelength or dual-wavelength images and does not require an additional turbidity sensor. Specifically, the turbidity compensation formula is as follows:
[0022]
[0023] In the formula, C is the concentration of heavy metal ions, k' is the heavy metal sensitivity coefficient (which can be fitted by gradient concentration experiments and is positively correlated with the optical system gain), α is the turbidity-concentration coupling coefficient (which can be determined by turbidity gradient experiments), and λ1 is the characteristic absorption wavelength of heavy metals (e.g., 540 nm corresponds to Cr). 6+ ), λ2 is the reference wavelength (e.g., Cr). 6+ During monitoring, a reference wavelength of 650nm is typically used because it is less affected by turbidity. λ3 is a turbidity-sensitive wavelength (e.g., 405nm, high scattering). λ1 G λ2 and G λ3 These are the grayscale values for the current wavelengths λ1, λ2, and λ3, respectively.
[0024] Furthermore, to avoid mutual interference among multiple wavelengths, time-division multiplexing is used, such as alternating operation of 405nm, 540nm and 650nm.
[0025] Furthermore, the multi-wavelength LED light source can be selected according to the metal being tested, with selectable wavelengths including 405nm, 520nm, 620nm, and 650nm. Furthermore, the multi-wavelength LED light source array uses a temperature sensor to adjust the driving current in real time to maintain wavelength stability.
[0026] Further, the specific steps of step (3) are as follows: when the gray value of the wastewater sample image is the same as the gray value of the image of the same type of heavy metal in the database, the corresponding concentration value is directly retrieved; when the gray value of the wastewater sample image is different from the gray value of the image of the same type of heavy metal in the database, the concentration of heavy metal in the wastewater is calculated by substituting the gray value of the image into the standard curve of image gray value and heavy metal concentration.
[0027] Furthermore, during use, the known concentration values of heavy metals measured or equipped each time, along with the corresponding water sample image information (at least including image grayscale value information), are uploaded and stored in the database (the sensor's database management module). This includes the concentration values measured by staff using other methods after each alarm and the corresponding image information. This is to facilitate: 1) dynamically correcting the standard curve of image grayscale value-heavy metal concentration, making the system more accurate the more it is used; 2) providing data support for the monitoring of the same type of heavy metal. The next time the same type of heavy metal is encountered with the same image grayscale value, the corresponding concentration value will be directly retrieved, which not only reduces the amount of computation but also improves accuracy and efficiency, making the system faster and more accurate with use. The steps for dynamically correcting the image grayscale value-heavy metal concentration standard curve are as follows: 1) Obtain newly uploaded water sample image information, which includes at least image grayscale value information; 2) Substitute the image grayscale value into the corresponding image grayscale value-heavy metal concentration standard curve to calculate the concentration value corresponding to the image grayscale value; 3) When the deviation between the calculated concentration value and the actual concentration value exceeds the upper limit of deviation, or exceeds the lower limit of deviation multiple times consecutively (the upper limit, lower limit, and number of times the deviation exceeds the lower limit can be set by the user), update the standard curve and store it; when the deviation between the calculated concentration value and the actual concentration value does not exceed the upper limit of deviation, and does not exceed the lower limit of deviation multiple times consecutively, the historical standard curve is used. The upper limit of deviation can be 15%-20%, and the lower limit of deviation can be about 5% (which can be set according to actual needs).
[0028] Furthermore, in step (1), the method for establishing the standard curve of image gray value and heavy metal concentration is as follows: prepare heavy metal solutions with different concentration gradients, obtain their images respectively, and then obtain their image gray values.
[0029] Furthermore, it also includes step (4): when the concentration of heavy metals exceeds the set boundary value, an alarm is triggered so that staff can retain samples for further measurement or processing.
[0030] Because different wastewater treatment plants or different batches of wastewater typically discharge different types of wastewater—for example, some contain copper, some chromium, and some a combination of copper and nickel—this invention optimizes the aforementioned monitoring method. After determining the type of heavy metal in the wastewater, the corresponding heavy metal measurement mode is selected first, i.e., a standard curve of the heavy metal image grayscale value and concentration is chosen before quantification. This results in higher accuracy. For example, if a batch of wastewater from a factory contains only copper as a heavy metal pollutant, the copper mode is selected, i.e., the established standard curve of copper image grayscale value and concentration is chosen. In other words, this invention optimizes the aforementioned monitoring method by establishing standard curves for the image grayscale value and concentration of each common heavy metal, or simultaneously establishing standard curves for the image grayscale value and concentration of mixed solutions of two or more heavy metals. Before measurement, the corresponding heavy metal type and standard curve are selected to improve accuracy and allow application in more monitoring scenarios.
[0031] Furthermore, before the wastewater sample enters the detection area in the optical dark box, it undergoes pretreatment (including filtration, temperature adjustment, and pH adjustment) to ensure that the turbidity, temperature, and pH of the wastewater sample are within a specific range and are basically consistent with the temperature and pH range used when creating the standard curve of gray value-heavy metal concentration of the standard image. This also reduces the scattering effect caused by turbidity and improves the reliability of the measurement results.
[0032] The present invention also provides a dynamic monitoring sensor for heavy metal concentration in wastewater based on image grayscale, comprising:
[0033] Power supply, used to provide power to the sensor;
[0034] An optical dark box is used to provide a closed optical measurement environment to reduce ambient light interference. The optical dark box is equipped with a test area, which has a sewage sample inlet valve and a sewage sample outlet valve. The sewage sample inlet valve and outlet valve are used to control the entry and exit of sewage samples, thereby controlling the sample measurement frequency.
[0035] The light source module, located inside the optical dark box, is used to provide illumination;
[0036] The color chart synchronous imaging module, including a camera and a color chart, is located inside an optical dark box and is used to acquire composite images of sewage samples and color charts.
[0037] The data processing module is electrically connected to the color chart synchronous imaging module and is used to receive and process image information transmitted from the color chart synchronous imaging module and output concentration values.
[0038] The operation module is electrically connected to the light source module and the data processing module respectively, and is used to input instruction information into the data processing module;
[0039] The display module, electrically connected to the data processing module, is used to display data information, including concentration parameters.
[0040] Furthermore, the dynamic monitoring sensor for heavy metal ions in wastewater also includes a database management module. The database management module is electrically connected to the data processing module and the operation module, respectively. The database of the database management module receives and stores images and data from the data processing module, and receives and stores data and images input or edited by the operation module.
[0041] Furthermore, the dynamic monitoring sensor for heavy metal ions in the wastewater also includes a remote management module. The remote management module is electrically connected (preferably through communication) to the data processing module and the database management module, respectively. This enables remote understanding and viewing of the heavy metal pollution status, facilitating remote access to and sharing of database information, and understanding of the monitored heavy metal pollution status, which is beneficial for timely handling and response when heavy metal levels exceed the standard.
[0042] Furthermore, the operation module includes a power switch and multiple measurement mode buttons, including a single heavy metal mode button and a mixed heavy metal mode button. Further, the single heavy metal mode button may also include copper measurement mode buttons, nickel measurement mode buttons, Zn measurement mode buttons, etc. Before measurement, if the heavy metal types in the wastewater batch can be determined, the operation button corresponding to the heavy metal type should be selected first. At this time, the system automatically matches the corresponding light source, database, and standard curve type, which can improve accuracy.
[0043] Furthermore, the optical dark chamber also includes a control area, which is adjacent to the test area. This is for heavy metals that require color development with an indicator (such as Cd). 2+ Zn 2+ The control area contains no indicator; its image grayscale serves as a blank control, reducing the impact of turbidity on the monitoring results. The test area can simultaneously have an indicator inlet (or spray nozzle) and a wastewater sample inlet, each equipped with an indicator inlet valve and a wastewater sample inlet valve. A drain valve is also located at the bottom of the test area. The control area has a wastewater sample inlet, a wastewater sample inlet valve, and a drain valve. The inlet and outlet of the wastewater sample are controlled by the inlet and outlet valves, thereby controlling the sampling frequency. After the test is completed, the water samples from both the test and control areas are drained, awaiting the next wastewater sample intake.
[0044] Furthermore, the color card is placed in the splash-proof area about 5-8mm above the sample testing area.
[0045] Furthermore, the light source module employs a multi-wavelength LED light source array to provide a multi-band controllable light source. By utilizing the differentiated responses of different wavelengths to turbidity scattering and other heavy metal ions for compensation, the impact of turbidity and other heavy metal ions on monitoring accuracy can be reduced without the need for a turbidity sensor.
[0046] Furthermore, the optical dark box is an embedded optical dark box with a polarizing filter to eliminate reflections.
[0047] Furthermore, it also includes an alarm module, which is electrically connected to the data processing module. When the concentration of heavy metals exceeds the set boundary value, an alarm is issued to remind people to take further samples for measurement or treatment.
[0048] Furthermore, it also includes a filtration structure located at the wastewater inlet of the optical dark box, used to reduce the scattering effects caused by turbidity.
[0049] Therefore, this invention is applicable to the following scenarios: when a rapid estimation of the total concentration of metal ions is required, or when a rapid estimation of the concentration of a single metal is needed when the color-concentration relationship is clear. During operation, the switch is turned on, and the wastewater sample enters the test area of the optical dark chamber from the wastewater inlet. A standard color chart is simultaneously captured during imaging to obtain a composite image of the sample and the color chart. Ambient light changes are corrected in real time, and the image grayscale value of the target area is dynamically adjusted to improve the reliability and accuracy of the measurement results. Subsequently, the grayscale value is substituted into the established standard curve of image grayscale value-heavy metal concentration (or, if the image grayscale value is the same as that of the same type of heavy metal in the database, the corresponding concentration value is directly retrieved) to obtain the heavy metal concentration in the wastewater.
[0050] Compared with existing ultraviolet spectrophotometry (UV) and atomic absorption spectrophotometry (AAS), this invention uses a low-cost camera instead of a spectrometer, resulting in lower costs and one-click automatic detection, making it convenient to operate and suitable for online real-time monitoring of heavy metal pollutants. Compared with existing colorimetric strip methods, this invention uses machine vision instead of manual colorimetry, reducing the influence of subjective factors, making it less susceptible to ambient light interference, and enabling real-time online dynamic monitoring. In summary, the advantages of this invention are simple operation, small size and weight, easy portability, suitability for rapid processing, and low computational load. The database management module of this invention can archive original images and data, providing traceability, and can also realize data storage and sharing, resulting in a technology effect where the system becomes more accurate and faster with use. Furthermore, this invention is low-cost and uses machine vision correction, avoiding the defects of strong subjectivity, large errors, and difficulty in quantification of visual observation, enabling rapid, real-time online dynamic monitoring of heavy metals and timely detection of heavy metal pollution. By using a color chart synchronous imaging module, a standard color chart is simultaneously acquired during shooting to obtain a sample-color chart composite image. This can solve the problems of ambient light drift and the influence of equipment differences, correct for changes in ambient light in real time, establish a color mapping relationship under the current environment, and improve the accuracy and reliability of measurement results. Attached Figure Description
[0051] Figure 1 This is a flowchart of the dynamic monitoring method for heavy metal concentration in wastewater based on image grayscale according to Embodiment 1 of the present invention;
[0052] Figure 2 This is a flowchart of the dynamic correction of the image grayscale value-heavy metal concentration standard curve in Embodiment 1 of the present invention;
[0053] Figure 3 These are schematic diagrams of the wastewater heavy metal concentration dynamic monitoring sensors based on image grayscale in Embodiments 1 and 2 of the present invention.
[0054] Figure 4 This is a diagram showing the configuration of the light source array in Embodiment 2 of the present invention;
[0055] Figure 5 This is a schematic diagram of the structure of the image grayscale-based dynamic monitoring sensor for heavy metal concentration in wastewater according to Embodiment 3 of the present invention;
[0056] Figure 6 This is a schematic diagram of the optical dark box structure in Embodiment 3 of the present invention, wherein: 1-indicator inlet valve, 2-sewage sample inlet valve, 3-drain valve. Detailed Implementation
[0057] The following embodiments are provided to better understand the present invention, but are not intended to limit the invention. Unless otherwise specified, the experimental methods used in the following embodiments are conventional methods.
[0058] Example 1
[0059] 1. Please refer to the appendix. Figure 1 This embodiment provides a method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale, including the following steps:
[0060] (1) Establishing a database and standard curve for image grayscale values and heavy metal concentrations: Sample images of heavy metals at different concentrations are acquired. A standard color chart is simultaneously captured during image capture to obtain a composite image of the sample and color chart. Image recognition is performed to obtain the image grayscale values after dynamic calibration using the color chart. A database of image grayscale values and heavy metal concentrations is established, and a standard curve for image grayscale values and heavy metal concentrations is created. In this embodiment, the method for establishing the standard curve for image grayscale values and heavy metal concentrations is as follows: Heavy metal solutions with different concentration gradients are prepared, and their images are acquired respectively. Then, their image grayscale values are obtained, and a standard curve for image grayscale values and heavy metal concentrations is established. For example, standard curves for copper ion concentration-grayscale values, nickel ion concentration-grayscale values, lead ion concentration-grayscale values, and Cr ion concentration-grayscale values are established respectively. 6+ Ion concentration-grayscale value standard curves, etc., and then establish Zn 2+ / Cu 2+ Mixed ion concentration-gray value standard curve, Zn 2+ / Fe 3+ Mixed ion concentration-gray value standard curve, Cu 2+ / Ni 2+ Standard curves for mixed ion concentration-grayscale value, etc.
[0061] (2) Pre-process the wastewater sample (including filtration, temperature adjustment, and pH adjustment) to ensure that the temperature and pH of the wastewater sample entering the optical dark box detection area are within a specific range and consistent with the temperature and pH range when making the standard curve of gray value of standard image - heavy metal concentration, while reducing the scattering effect caused by turbidity; take images of wastewater sample, and simultaneously acquire standard color cards during the shooting process to obtain sample-color card composite images, perform image recognition, and obtain the gray value of wastewater sample image after dynamic calibration through color cards;
[0062] (3) When the gray value of the wastewater sample image is the same as the gray value of the image of the same type of heavy metal in the database, the corresponding concentration value is directly retrieved; when the gray value of the wastewater sample image is different from the gray value of the image of the same type of heavy metal in the database, the concentration of heavy metal in the wastewater is calculated by substituting the gray value of the image into the standard curve of image gray value and heavy metal concentration.
[0063] The following uses dynamic monitoring of Cr in discharged wastewater as an example. 6+ Taking concentration as an example (assuming that the wastewater discharged by a factory contains a single heavy metal ion Cr), 6+The following further explains the image grayscale-based dynamic monitoring method for heavy metal concentration in wastewater according to the present invention:
[0064] The wastewater heavy metal concentration dynamic monitoring method based on image grayscale in this embodiment includes the following steps:
[0065] (1) Establish Cr 6+ Database and standard curves for ion concentration-image grayscale values: Configuring Cr with different concentration gradients 6 + Ionic solutions with concentration gradients as follows: 0.01 mg / L, 0.025 mg / L, 0.05 mg / L, 0.075 mg / L, 0.1 mg / L, 0.5 mg / L, 1 mg / L, and 5 mg / L, in Cr... 6+ Images were acquired at a characteristic wavelength (540nm), and a standard color chart was simultaneously captured during the shooting process. A composite image of the sample and color chart was obtained, and image recognition was performed. The grayscale values of the images after dynamic calibration using the color chart were obtained, and a standard curve was established between the image grayscale values and the heavy metal concentration: C = -0.042 × G 540 +10.08(R 2 =0.9975, 0.01 mg / L - 5 mg / L), where C is Cr 6+ Ion concentration, G 540 The values are grayscale values (camera ROI mean extracted) under a 540nm light source. -0.042 and 10.08 are values fitted by gradient concentration experiments in this embodiment and represent only one example. The values may vary in different scenarios.
[0066] (2) In Cr 6+ Wastewater sample images were captured at a characteristic wavelength (540nm). A standard color chart was simultaneously acquired during the capture process to obtain a composite image of the sample and the color chart. Image recognition was performed to obtain the grayscale value of the wastewater sample image and to dynamically calibrate the grayscale value of the target area image.
[0067] (3) When the gray value of the wastewater sample image is the same as the gray value of the image of the same type of heavy metal in the database, the corresponding concentration value is directly retrieved; when the gray value of the wastewater sample image is different from the gray value of the image of the same type of heavy metal in the database, the concentration of heavy metal in the wastewater is calculated by substituting the gray value of the image into the standard curve of image gray value and heavy metal concentration.
[0068] In this embodiment, a sample-color chart composite image is obtained by simultaneously capturing standard color charts with known reflectance, establishing a color mapping relationship under the current environment, and dynamically calibrating the image grayscale value of the target area. The algorithm is as follows (8-bit camera):
[0069]
[0070] In the formula, G corrected This refers to the grayscale value after color chart correction, G sample G refers to the grayscale value of the captured sample. black This refers to the grayscale value of the darkest area on the color chart (to eliminate dark current), G white This refers to the grayscale value (normalized baseline) of the whitest area on the color chart.
[0071] Furthermore, this embodiment also includes step (4): when the concentration of heavy metals exceeds the set boundary value, an alarm is triggered so that staff can retain samples for further measurement or processing.
[0072] Furthermore, during use, each precise measurement or equipped known concentration of heavy metals and the corresponding water sample image information (at least including image grayscale value information) are uploaded and stored in the database (the sensor's database management module). This includes concentration values and corresponding image information precisely measured by staff using other methods after each alarm, so as to: 1) dynamically correct the standard curve of image grayscale value-heavy metal concentration, which is beneficial for the system of this invention to become more accurate with repeated use; 2) provide data support for the monitoring of the same type of heavy metal. The next time the same image grayscale value of the same type of heavy metal is encountered, the corresponding concentration value will be directly retrieved, which not only reduces the amount of calculation but also improves accuracy and efficiency. Please refer to the appendix. Figure 2 The steps for dynamically correcting the image grayscale value-heavy metal concentration standard curve are as follows: 1) Obtain the newly uploaded water sample image information, which includes at least image grayscale value information; 2) Substitute the image grayscale value into the corresponding image grayscale value-heavy metal concentration standard curve to calculate the concentration value corresponding to the image grayscale value; 3) When the deviation between the calculated concentration value and the actual concentration value exceeds 15%, or exceeds 5% for 5 consecutive times (this is an example of the present invention, and the specific upper and lower limits of deviation and the number of times exceeding can be set according to the situation), update the standard curve and store it; when the deviation between the calculated concentration value and the actual concentration value does not exceed the upper limit of deviation and does not exceed the lower limit of deviation multiple times, the historical standard curve is used.
[0073] 2. Regarding the above monitoring method, this embodiment provides the following sensor:
[0074] Please refer to the attached document. Figure 3 The image grayscale-based wastewater heavy metal concentration dynamic monitoring sensor of this embodiment includes:
[0075] Power supply, used to provide power to the sensor;
[0076] An optical dark box with a Vantablack coating (reflectivity <1%) on the inner wall is used to provide a closed optical measurement environment and reduce ambient light interference; the optical dark box is an embedded optical dark box with a polarizing filter to eliminate reflections;
[0077] The optical dark box contains a testing area, which has a wastewater sample inlet valve and a wastewater sample outlet valve. The wastewater sample inlet valve and outlet valve are used to control the entry and exit of wastewater samples, thereby controlling the sampling frequency. The wastewater sample inlet in the testing area is equipped with a filter structure to reduce the scattering effect caused by turbidity.
[0078] A light source module, located inside an optical dark box, is used to provide illumination; the light source module includes a 540±5nm narrowband LED light source;
[0079] The color chart synchronous imaging module, including a camera and a color chart, is located inside an optical dark box and is used to acquire composite images of sewage samples and color charts, which can solve the problem of ambient light drift. In this embodiment, the standard color chart is an X-Rite ColorChecker color chart, which is placed in a splash-proof area 5mm above the sample testing area. The camera is an industrial CCD or CMOS, which supports ROI (Region of Interest) histogram output, and the pixel depth can be 8 / 10 / 12 bits. In this embodiment, the pixel depth is selected as 8 bits.
[0080] The data processing module is electrically connected to the color card synchronous imaging module. It is used to receive and process image information transmitted from the color card synchronous imaging module, execute dynamic grayscale correction algorithms, and output concentration values.
[0081] The database management module is electrically connected to the data processing module and the operation module respectively. The database of the database management module receives and stores images and data from the data processing module.
[0082] The operation module, electrically connected to the light source module, data processing module, and database management module, is used to input instruction information to the data processing module and to input or edit data and image information to the database management module. The database management module receives and stores the data and images input or edited by the operation module. The operation module includes a switch button and multiple measurement mode buttons, including a single heavy metal mode button and a mixed heavy metal mode button. The single heavy metal mode button includes Cr... 6+ Measurement mode button, copper measurement mode button, nickel measurement mode button, Zn 2+ Measurement mode button, etc.;
[0083] The display module, electrically connected to the data processing module, is used to display data information including concentration parameters;
[0084] It also includes an alarm module, which is electrically connected to the data processing module. When the concentration of heavy metals exceeds the set boundary value, an alarm is issued to remind people to take further samples for measurement or treatment.
[0085] It also includes a remote management module, which is connected to the data processing module and the database management module to remotely understand and view the heavy metal pollution status. This facilitates remote access to and sharing of database information, as well as understanding the monitored heavy metal pollution status, enabling timely handling and response when heavy metal levels exceed the standards.
[0086] Before using the sensor in this embodiment, the measurement mode is selected as Cr. 6+ Measurement mode, i.e., selecting Cr 6+ Press the measurement mode button. The system will then automatically match the corresponding light source and standard curve type (acquiring sample images at the characteristic wavelengths of heavy metals; in this embodiment, Cr...). 6+ (A 540±5nm narrowband LED light source is used). This application employs machine vision correction, avoiding the shortcomings of strong subjectivity, large errors, and difficulty in quantitative analysis associated with visual observation. It enables rapid, real-time online dynamic monitoring of heavy metals, allowing for timely detection of heavy metal pollution. Through a color chart synchronous imaging module, a standard color chart is simultaneously acquired during shooting, obtaining a sample-color chart composite image. This solves the problems of ambient light drift and equipment differences, corrects for ambient light changes in real time, establishes a color mapping relationship under the current environment, and improves the accuracy and reliability of the measurement results.
[0087] Example 2
[0088] The Cr content in the discharged wastewater is still monitored dynamically. 6+ Taking concentration as an example (assuming that the wastewater discharged by a factory contains a single heavy metal ion Cr), 6+ When the turbidity in wastewater can significantly interfere with measurement accuracy, the difference between this embodiment and Embodiment 1 is as follows:
[0089] 1. In step (2) of this embodiment, a multi-wavelength LED light source array is used during the shooting process. Each wavelength LED light source is independently controllable, and multi-wavelength collaborative detection is used to compensate for the differential response of different wavelengths to turbidity scattering, so as to reduce the impact of turbidity on the monitoring accuracy. The specific method is as follows: 1) A coaxial optical path is used (to avoid interference from side-scattered light), and three wavelengths are excited in a time-division manner (10ms interval) to simultaneously collect gray values at wavelengths of 405nm, 540nm, and 650nm; 2) The turbidity compensation amount is calculated by the gray difference between 650nm and 405nm; 3) The concentration value is output after correcting the 540nm detection signal. The compensation formula (to reduce the influence of turbidity) is as follows:
[0090]
[0091] In the formula, C 真实 G represents the concentration of heavy metal ions. 650 G 540 and G 405These are the grayscale values at current wavelengths of 650nm, 540nm, and 405nm, respectively, where k' is the Cr value. 6+ The sensitivity coefficient (which can be fitted to the slope through a gradient concentration experiment) and α are the turbidity-concentration coupling coefficients (which can be determined through a turbidity gradient experiment). For example, k' can be 12.5 and α can be 0.18 (this is only one embodiment of the present invention; in different scenarios, the values are not exactly the same as in this embodiment).
[0092] In addition, in this embodiment, the multi-wavelength LED light source array adjusts the driving current in real time through a temperature sensor to maintain wavelength stability.
[0093] 2. Regarding the above monitoring method, this embodiment provides the following sensor:
[0094] Please refer to the attached document. Figure 3-4 The image grayscale-based wastewater heavy metal concentration dynamic monitoring sensor of this embodiment includes:
[0095] Power supply, used to provide power to the sensor;
[0096] An optical dark box with a Vantablack coating (reflectivity <1%) on the inner wall is used to provide a closed optical measurement environment and reduce ambient light interference; the optical dark box is an embedded optical dark box with a polarizing filter to eliminate reflections;
[0097] The optical dark box contains a testing area, which has a wastewater sample inlet valve and a wastewater sample outlet valve. The wastewater sample inlet valve and outlet valve are used to control the entry and exit of wastewater samples, thereby controlling the sampling frequency. The wastewater sample inlet in the testing area is equipped with a filter structure to reduce the scattering effect caused by turbidity.
[0098] The light source module, located inside the optical dark box, is used to provide illumination. The light source module includes a multi-wavelength LED array (405nm, 540nm, and 650nm wavelengths) in a ring layout, wherein the number of 540nm LEDs accounts for ≥40%, and the LEDs of each wavelength are arranged alternately at equal angles. The light source module also includes an STM32 controller, which can be used for real-time PWM adjustment.
[0099] The color chart synchronous imaging module, including a camera and a color chart, is located inside an optical dark box. It is used to acquire composite images of sewage samples and color charts, and dynamically calibrate the image grayscale values of the target area. This can be used to solve the problem of ambient light drift and reduce the impact of equipment differences. In this embodiment, the standard color chart is an X-Rite ColorChecker color chart, which is placed in a splash-proof area 5mm above the sample testing area. The camera is an industrial CCD or CMOS, which supports ROI (Region of Interest) histogram output, and the pixel depth can be 8 / 10 / 12 bits. In this embodiment, the pixel depth is selected as 8 bits.
[0100] The data processing module is electrically connected to the color card synchronous imaging module. It is used to receive and process image information transmitted from the color card synchronous imaging module, execute dynamic grayscale correction algorithms, and output concentration values.
[0101] The database management module is electrically connected to the data processing module and the operation module, and can receive and store data from the data processing module.
[0102] The operation module, electrically connected to the light source module, data processing module, and database management module, is used to input instruction information to the data processing module and to input or edit data and image information to the database management module. The database management module receives and stores the data and images input or edited by the operation module. The operation module includes a switch button and multiple measurement mode buttons, including a single heavy metal mode button and a mixed heavy metal mode button. The single heavy metal mode button includes Cr... 6+ Measurement mode buttons, copper measurement mode buttons, nickel measurement mode buttons, zinc measurement mode buttons, etc.;
[0103] The display module, electrically connected to the data processing module, is used to display data information, including concentration parameters.
[0104] It also includes an alarm module, which is electrically connected to the data processing module. When the concentration of heavy metals exceeds the set boundary value, an alarm is issued to remind people to take further samples for measurement or treatment.
[0105] It also includes a remote management module, which is connected to the data processing module and the database management module to remotely understand and view the heavy metal pollution status. This facilitates remote access to and sharing of database information, as well as understanding the monitored heavy metal pollution status, enabling timely handling and response when heavy metal levels exceed the standards.
[0106] Before using the sensor in this embodiment, the measurement mode is selected as Cr. 6+ Measurement mode, i.e., selecting Cr 6+Press the measurement mode button; the system will automatically match the corresponding light source, database, and standard curve type. This application employs machine vision correction, avoiding the shortcomings of strong subjectivity, large errors, and difficulty in quantitative analysis associated with visual observation. It enables rapid, real-time online dynamic monitoring of heavy metals, allowing for timely detection of heavy metal pollution. Through a color chart synchronous imaging module, a standard color chart is simultaneously acquired during shooting, obtaining a sample-color chart composite image. This solves the problem of ambient light drift, reduces the impact of equipment differences, corrects for ambient light changes in real time, establishes a color mapping relationship under the current environment, and improves the accuracy and reliability of the measurement results. Compensation is provided for the differentiated responses of different wavelengths to turbidity scattering and other heavy metal ions, reducing the impact of turbidity and other heavy metal ions on monitoring accuracy.
[0107] 3. The measurement accuracy of this embodiment is higher than that of Embodiment 1, but the cost is also higher. Therefore, the following adjustments can be made to this embodiment: Dual-wavelength differential detection technology is adopted, simplifying the three wavelengths of this embodiment to two wavelengths, 540nm and 405nm, that is, using dual wavelengths to correct grayscale. The specific method is as follows: 1) Using a coaxial optical path, the two wavelengths are excited in a time-division manner (10ms interval), and grayscale values at 405nm and 540nm wavelengths are acquired simultaneously; 2) The turbidity compensation is calculated using the grayscale difference between 540nm and 405nm; 3) The concentration value is output after correcting the 540nm detection signal. At this point, its accuracy is between that of Embodiment 1 and the three wavelengths of this embodiment.
[0108] Example 3
[0109] Suppose that the wastewater discharged by a factory contains a single heavy metal ion, Zn. 2+ The following section uses dynamic monitoring of Zn in discharged wastewater as an example. 2+ Taking concentration as an example, the dynamic monitoring method for heavy metal concentration in wastewater based on image grayscale of the present invention will be further explained:
[0110] Due to Zn 2+ The solution is colorless, and indirect measurement can be performed after a colorimetric reaction to form a colored complex. Methods such as the dithizone method, the Zincon method, or the PAR [4-(2-pyridiniazo)-resorcinol] method can be used for indirect measurement after color development. This example uses the Zincon method. (This invention is also applicable to situations where wastewater contains both copper ions and ferric ions; in this case, the concentration of copper or ferric ions can be measured first, and then Zn can be measured through a colorimetric reaction.) 2+ Concentration, Zn measurement 2+ At certain concentrations, masking agents such as KCN or sodium thiosulfate must be used to avoid interference from copper and iron ions.
[0111] Please refer to Figure 5Compared to Example 1, this embodiment differs in that: the optical dark box of the sensor of the present invention also includes a control area, which is adjacent to the test area. No indicator is placed in the control area; the image grayscale of the control area serves as a blank control, reducing the impact of turbidity on the monitoring results. The test area is equipped with both an indicator inlet and a wastewater sample inlet, each with its own indicator inlet valve and wastewater sample inlet valve. A drain valve is also provided at the bottom of the test area. The control area includes a wastewater sample inlet, a wastewater sample inlet valve, and a drain valve. The inlet and outlet of the wastewater sample are controlled by the inlet and outlet valves, thereby controlling the sampling frequency. After the wastewater sample and indicator enter the test area, sample images are acquired under a 620nm LED light source, and the image of the control area (without colorimetric reagent) is used as a blank control for turbidity correction. After the measurement is completed, the water samples from the test area and control area are discharged, awaiting the next wastewater sample entry.
[0112] The above description is merely an embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the technical solution of the present invention shall still fall within the protection scope of the technical solution of the present invention.
Claims
1. A method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale, comprising the following steps: (1) Establish a database and standard curve for image grayscale values and heavy metal concentrations: acquire sample images under different heavy metal concentrations, simultaneously acquire standard color cards during shooting, acquire sample-color card composite images, perform image recognition, acquire image grayscale values after dynamic calibration through color cards, establish a database for image grayscale values and heavy metal concentrations, and establish a standard curve for image grayscale values and heavy metal concentrations. (2) Take images of sewage samples, simultaneously collect standard color cards during shooting, obtain sample-color card composite images, perform image recognition, and obtain the grayscale values of sewage sample images after dynamic calibration through color cards. (3) Substitute the image grayscale value into the standard curve or database of image grayscale value and heavy metal concentration, and then calculate the heavy metal concentration in the wastewater.
2. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, The algorithm for dynamically calibrating image grayscale values is as follows: In the formula, G corrected It refers to the corrected grayscale value, G sample G refers to the grayscale value of the captured sample. black This refers to the grayscale value of the darkest area on the color chart, G. white V refers to the grayscale value of the whitest area on the color chart. std This refers to the standard white balance grayscale value.
3. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, When a turbidity compensation term is added, the compensation formula is: In the formula, G final This refers to the final grayscale value after turbidity correction, where k represents the turbidity-grayscale compensation coefficient and T is the turbidity value of the current sample.
4. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, During the shooting process in step (2), a multi-wavelength LED light source array is used. Each wavelength of the LED light source is independently controllable, and multi-wavelength collaborative detection is performed. The differential response of different wavelengths to turbidity scattering is used for compensation. The turbidity compensation formula is as follows: In the formula, C is the heavy metal ion concentration, k' is the heavy metal sensitivity coefficient, α is the turbidity-concentration coupling coefficient, λ1 is the characteristic absorption wavelength of heavy metals, λ2 is the reference wavelength, λ3 is the turbidity sensitive wavelength, and G... λ 1. G λ2 and G λ3 These are the grayscale values for the current wavelengths λ1, λ2, and λ3, respectively.
5. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, When the concentration range is complex, standard curves should be established in segments.
6. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, During use, each accurately measured or equipped known concentration of heavy metals and the corresponding water sample image information are uploaded and stored in the database. The image information includes at least image grayscale value information. Based on each newly uploaded heavy metal concentration and the corresponding water sample image grayscale value, the image grayscale value-heavy metal concentration standard curve is dynamically corrected. The steps are as follows: 1) Obtain the newly uploaded water sample image information, which includes at least image grayscale value information; 2) Substitute the image grayscale value into the corresponding image grayscale value-heavy metal concentration standard curve to calculate the concentration value corresponding to the image grayscale value; 3) When the deviation between the calculated concentration value and the actual concentration value exceeds the upper limit of the deviation or exceeds the lower limit of the deviation multiple times consecutively, update the standard curve and store it; when the deviation between the calculated concentration value and the actual concentration value does not exceed the upper limit of the deviation and does not exceed the lower limit of the deviation multiple times consecutively, the historical standard curve is used.
7. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, It also includes step (4): when the concentration of heavy metals exceeds the set boundary value, an alarm is triggered.
8. The method for dynamic monitoring of heavy metal concentration in wastewater based on image grayscale according to claim 1, characterized in that, Establish standard curves for the image grayscale value and concentration of each heavy metal separately, and / or simultaneously establish standard curves for the image grayscale value and concentration of two or more mixed solutions of heavy metals. Before measurement, select the corresponding heavy metal type and standard curve.
9. A sensor based on the image grayscale-based dynamic monitoring method for heavy metal concentration in wastewater according to claim 1, comprising: Power supply, used to provide power to the sensor; An optical dark box is used to provide a closed optical measurement environment and reduce ambient light interference. The optical dark box contains a testing area, which has a wastewater sample inlet valve and a wastewater sample outlet valve. The wastewater sample inlet valve and outlet valve are used to control the entry and exit of wastewater samples, thereby controlling the sampling frequency. The light source module, located inside the optical dark box, is used to provide illumination; The color chart synchronous imaging module, including a camera and a color chart, is located inside an optical dark box and is used to acquire composite images of sewage samples and color charts. The data processing module is electrically connected to the color chart synchronous imaging module and is used to receive and process image information transmitted from the color chart synchronous imaging module and output concentration values. The operation module is electrically connected to the light source module and the data processing module respectively, and is used to input instruction information into the data processing module; The display module, electrically connected to the data processing module, is used to display data information including concentration parameters; It also includes a database management module, which is electrically connected to the data processing module and the operation module. The database of the database management module receives and stores images and data from the data processing module, and receives and stores data and images input or edited by the operation module.
10. The image grayscale-based dynamic monitoring sensor for heavy metal concentration in wastewater according to claim 9, characterized in that, It also includes a remote management module, which is electrically connected to the data processing module and the database management module.
11. The image grayscale-based dynamic monitoring sensor for heavy metal concentration in wastewater according to claim 9, characterized in that, The optical dark box also includes a control area, which is adjacent to the test area. For heavy metals that require color development with an indicator, there is no indicator in the control area. The test area is equipped with an indicator inlet or spray port, as well as a wastewater sample inlet, and is equipped with an indicator inlet valve and a wastewater sample inlet valve respectively. A drain valve is also provided at the bottom of the test area. The control area is equipped with a wastewater sample inlet, a wastewater sample inlet valve, and a drain valve.
Citation Information
Cited By
MBR produced water turbidity detection method and system based on image processing
CN121811227A