Water quality monitoring and early warning method based on machine vision and its application

By combining the water body characteristics collected by visible light and near-infrared images, the water quality change trend is predicted, and the problems of neglecting single parameter monitoring and environmental factors in the existing technology are solved, multi-parameter detection and high-precision prediction are realized, and the reliability and dimension of monitoring are improved.

CN119741515APending Publication Date: 2025-04-01CHINA NAT ENVIRONMENTAL MONITORING CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411928989.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The existing intelligent water quality monitoring methods mainly focus on the monitoring of a single water quality parameter, ignoring the mutual influence between water body characteristics and water quality parameters and the impact of external environmental factors on water quality. At the same time, the monitoring effect based on machine vision is easily affected by the camera imaging quality, and the monitoring results at different times and weather are insufficiently reliable.

Method used

The visible light images and near-infrared video images of water bodies are collected through the camera, intuitive features and heat reflection features are extracted, water body image data is generated, and it is input with historical water quality data for training to predict water quality change trends. This method combines intuitive features and thermal reflection features in different ways in different processing modes to flexibly respond to different time and weather conditions.

Benefits of technology

Multi-parameter detection of water quality is realized, and the mutual influence between water body characteristics and water quality parameters and external environmental factors are related, the dimension and authenticity of monitoring are improved, the prediction accuracy is improved, and the image acquisition quality and the reliability of monitoring results are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741515A_ABST
    Figure CN119741515A_ABST
Patent Text Reader

Abstract

The present invention provides a water quality monitoring and early warning method and application based on machine vision. After extracting the image information of a preset marker from an initial visible light image, the image information is compared with a template image to enter a first processing mode or a second processing mode; the visible light video image is used to extract the intuitive features of the target water body, and the near-infrared video image is used to extract the thermal reflection features of the target water body, and the water body portrait data is generated by combining; the historical data of the water body portrait and the historical water quality data of the target water body are input into a learning model for training to obtain a prediction model. Multi-parameter detection is realized, the monitoring dimensions are more, the authenticity is restored more, and the prediction accuracy is also higher. The respective characteristics of visible light and near-infrared machine vision are brought into play to improve the image acquisition quality and monitoring accuracy. Under different processing modes, the combination methods are different, and the combination method can be more flexibly adjusted according to the specific conditions at different times and in different weather conditions to ensure the accuracy and reliability of the monitoring results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of environmental monitoring, and in particular to a water quality monitoring and early warning method and application based on machine vision. Background Art

[0002] Water quality monitoring is an important part of environmental monitoring and is the premise and basic work of environmental protection. Water quality monitoring is extremely important in ensuring drinking water safety, assessing water environment quality, preventing water pollution incidents, supporting the sustainable use of water resources, early warning and decision support.

[0003] Traditional water quality monitoring methods rely on physical sensors and chemical analysis. Although they can provide accurate water quality data, they only monitor physical and chemical indicators and cannot restore and describe the characteristics of the water body. With the development of machine vision technology and machine learning algorithms, water quality monitoring has begun to move towards intelligence and automation. Most existing intelligent water quality monitoring methods only focus on the monitoring of a single water quality parameter, ignoring the mutual influence between water body characteristics and water quality parameters and the impact of external environmental factors on water quality.

[0004] In addition, the monitoring effect of the water quality monitoring method based on machine vision in the existing technology is easily affected by the imaging quality of the camera, and the reliability of the monitoring results at different times and in different weather conditions needs to be enhanced. Summary of the invention

[0005] In order to solve the problems of the prior art, the present disclosure provides a water quality monitoring and early warning method and application based on machine vision, which can solve at least one technical problem in the prior art.

[0006] In a specific embodiment, a water quality monitoring and early warning method based on machine vision includes:

[0007] At least one frame of initial visible light image of the target water body is collected by a camera, image information of a preset marker is extracted from the initial visible light image, and then compared with a preset template image, and if the similarity meets a preset threshold, a first processing mode is entered, otherwise a second processing mode is entered;

[0008] In the first processing mode and the second processing mode, the camera is controlled to collect visible light video images of the target water body to extract intuitive features of the target water body, and the near-infrared spectrometer is controlled to collect near-infrared video images of the target water body to extract thermal reflection features of the target water body, and the water body portrait data is generated by combining the intuitive features and the thermal reflection features;

[0009] Inputting the historical data of the water body portrait and the historical water quality data of the target water body into a learning model for training to obtain a prediction model, and inputting the water body portrait data collected in real time into the prediction model to predict the water quality change trend of the target water body;

[0010] Among them, the method of combining the intuitive feature and the thermal reflection feature in the first processing mode is different from that in the second processing mode.

[0011] In a specific embodiment, the visual characteristics include one or a combination of water turbidity, water level change, water color, floating objects in the water and weather conditions, and the weather conditions include one or a combination of temperature, humidity, wind speed and rainfall;

[0012] The water quality data includes one or a combination of dissolved oxygen, conductivity, permanganate index, total phosphorus, ammonia nitrogen, total nitrogen and chlorophyll;

[0013] The change trend includes one or a combination of significantly rising, rising, stable, falling and significantly falling.

[0014] In a specific embodiment, the method of combining the intuitive feature and the thermal reflective feature in the first processing mode is different from the second processing mode, and includes:

[0015] In the first processing mode, multiple frames of visible light images are intercepted from the visible light video image according to a preset time sequence, and after preprocessing each frame of the visible light image, pixel information of the visible light image is calculated to identify multiple types of the intuitive features; multiple frames of near-infrared images are intercepted from the near-infrared video image according to a preset time sequence, and after preprocessing the near-infrared images, feature calculation is performed on the near-infrared images to extract the thermal reflection features of the target water body; the intuitive features and the thermal reflection features are combined to generate water body portrait data;

[0016] In the second processing mode, a plurality of frames of visible light images are captured from the visible light video image according to a preset time sequence, and after preprocessing each frame of the visible light image, pixel information of the visible light image is calculated to identify the intuitive features of the non-floating object type and the first outline of the floating object; a plurality of frames of near-infrared images are captured from the near-infrared video image according to a preset time sequence, and after preprocessing the near-infrared images, feature calculation is performed on the near-infrared images to extract the thermal reflection features of the target water body, and the second outline of the floating object is identified based on the thermal reflection features, the second outline is superimposed on the first outline to form the floating object outline, and the intuitive features are updated; the updated intuitive features are merged with the thermal reflection features to generate water body portrait data.

[0017] In a specific embodiment, the preprocessing includes denoising, color correction and feature extraction;

[0018] The learning model includes a group or combination of a random forest model, a support vector machine, a deep neural network, and a convolutional neural network.

[0019] In a specific embodiment, superimposing the second contour onto the first contour to form a floating object contour, and updating the intuitive feature, comprises:

[0020] For the pre-processed multiple frames of the visible light image, respectively calculate the pixel information of each frame of the visible light image, and identify the intuitive features of the non-floating object type by calculating the average of a preset number of adjacent multiple frames of the visible light image;

[0021] Calculating respectively the contour completeness of various floating objects in a preset number of adjacent frames of the visible light image, and identifying the first contour of various floating objects by using the frame of the visible light image with the highest average contour completeness;

[0022] For the visible light image frame with the highest mean value of contour integrity, a near-infrared image of the same time sequence is intercepted from the near-infrared video image, the near-infrared image is preprocessed, and then feature calculation is performed on the near-infrared image to extract the thermal reflection feature of the target water body, and the second contour of the floating object is identified based on the thermal reflection feature;

[0023] Based on the resolution difference between the near-infrared image and the visible light image, the second outline of the floating object is resized according to a preset ratio and then mapped into the visible light image to enhance the image clarity of the first outline of the floating object.

[0024] In a specific embodiment, identifying the second profile of the floating object based on the thermal reflection feature includes:

[0025] Identify the outline of each floating object in the near-infrared image based on the thermal reflection feature, and perform outline integrity detection;

[0026] If the contour completeness exceeds a preset threshold, the contour of each floating object in the near-infrared image of the same time sequence is used as the second contour;

[0027] If the contour completeness does not exceed the preset threshold, a plurality of the near-infrared images are respectively captured from the time series before and after the time series, the contour of each floating object in the near-infrared image is identified based on the thermal reflection feature, and contour completeness detection is performed, and the contour of each floating object whose contour completeness exceeds the preset threshold is selected as the second contour.

[0028] In a specific implementation, selecting the contour of each floating object whose contour integrity exceeds a preset threshold as the second contour includes:

[0029] Detecting the total number of floating objects in the target water body based on the contours of each floating object in the plurality of near-infrared images in the preceding and following time series of the time series;

[0030] For each floating object, the contour completeness of the floating object in the multiple near-infrared images is compared respectively, and the one with the highest contour completeness is selected as the second contour of the floating object. This cycle is repeated to obtain the second contours of all floating objects in the target water body.

[0031] In a specific embodiment, the visible light video image acquisition method in the first processing mode is different from the second processing mode and includes:

[0032] In the first processing mode, according to a preset lighting control method, the visible light source is controlled to perform lighting, and the camera is controlled to collect a visible light video image of the target water body;

[0033] In the second processing mode, the lighting control method is adjusted multiple times, and at least one frame of initial visible light image of the target water body is collected by the camera respectively. Image information of preset markers is extracted from the initial visible light image and then compared with the preset template image. The lighting control method corresponding to the initial visible light image with the highest similarity is the optimal lighting control method. According to the optimal lighting control method, the visible light source is controlled for lighting, and the camera is controlled to collect visible light video images of the target water body.

[0034] In a specific embodiment, a water quality monitoring and early warning system based on machine vision is used to execute the water quality monitoring and early warning method in any of the above embodiments, including:

[0035] A visible light image acquisition module, used for acquiring visible light video images of target water bodies;

[0036] A near-infrared image acquisition module, used for acquiring near-infrared video images of the target water body;

[0037] A data processing module, used for extracting the intuitive features of the target water body through the visible light video image, and extracting the thermal reflection features of the target water body through the near infrared video image, and combining the intuitive features and the thermal reflection features to generate water body portrait data, wherein the data processing module has a first processing mode and a second processing mode, and the method of combining the intuitive features and the thermal reflection features in the first processing mode is different from that in the second processing mode;

[0038] A prediction module, used for inputting the historical data of the water body portrait and the historical water quality data of the target water body into a learning model for training to obtain a prediction model, and inputting the water body portrait data collected in real time into the prediction model to predict the water quality change trend of the target water body;

[0039] A comparison module is used to collect at least one frame of initial visible light image of the target water body through a camera, extract image information of a preset marker from the initial visible light image and compare it with a preset template image. If the similarity meets a preset threshold, the first processing mode is entered, otherwise the second processing mode is entered.

[0040] In a specific embodiment, a computer-readable storage medium stores a computer program, and when the computer program is run, the water quality monitoring and early warning method in any of the aforementioned embodiments is executed.

[0041] The beneficial effects of the present invention include:

[0042] In the present invention, at least one frame of initial visible light image of the target water body is collected by a camera, and image information of a preset marker is extracted from the initial visible light image and compared with a preset template image. If the similarity meets a preset threshold, the first processing mode is entered, otherwise the second processing mode is entered; in the first processing mode and the second processing mode, the camera is controlled to collect visible light video images of the target water body to extract intuitive features of the target water body, and the near-infrared spectrometer is controlled to collect near-infrared video images of the target water body to extract thermal reflection features of the target water body, and water body portrait data is generated by combining the intuitive features and the thermal reflection features; historical data of the water body portrait and historical water quality data of the target water body are input into a learning model for training to obtain a prediction model, and the water body portrait data collected in real time are input into the prediction model to predict the water quality change trend of the target water body; wherein, the method of combining intuitive features and thermal reflection features in the first processing mode is different from that in the second processing mode.

[0043] Therefore, the present invention generates water body image data by collecting water body features through machine vision, inputs it and historical water quality data into the learning model for training, and obtains a prediction model to predict the trend of water quality changes. Multi-parameter detection of water quality is achieved, and the mutual influence between water body features and water quality parameters and the influence of external environmental factors on water quality are associated, with more monitoring dimensions, more authenticity, and higher prediction accuracy.

[0044] Furthermore, in the present invention, the respective characteristics of visible light machine vision and near infrared machine vision can be brought into play to improve the image acquisition quality and monitoring accuracy. In addition, in the present invention, different processing modes can be entered according to the imaging quality of the visible light image. In different processing modes, the methods of combining the intuitive features and the thermal reflection features are different. Therefore, the combination of the visible light image and the near infrared image can be adjusted more flexibly according to the specific conditions at different times and in different weather conditions to ensure the accuracy and reliability of the monitoring results. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a flow chart of the water quality monitoring and early warning method based on machine vision of the present invention;

[0046] Figure 2 is a flow chart of a first processing mode;

[0047] Figure 3 is a flow chart of the second processing mode;

[0048] Figure 4 This is a framework diagram of the water quality monitoring and early warning system based on machine vision of the present invention;

[0049] Figure 5 It is a schematic diagram of the transmission and reception of the camera and the near-infrared spectrometer of the present invention. DETAILED DESCRIPTION

[0050] Those skilled in the art will appreciate that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.

[0051] Example 1

[0052] like Figure 1 As shown, in this embodiment, a water quality monitoring and early warning method based on machine vision includes:

[0053] At least one frame of initial visible light image of the target water body is collected by a camera, and the image information of the preset marker is extracted from the initial visible light image and compared with the preset template image. If the similarity meets the preset threshold, the first processing mode is entered, otherwise the second processing mode is entered. Among them, the camera includes a CCD camera or a CMOS camera. The marker is set within the imaging range of the camera and can be located in or near the target water body. The marker can have a preset shape, such as a square, rectangle, circle or polygon or a three-dimensional shape, and the marker can have a preset pattern, such as a grid, a point cloud, an animal or plant pattern or other patterns. The preset template image is a pre-stored image whose imaging quality meets the requirements of the machine vision system. The imaging quality can be evaluated by similarity calculation.

[0054] In this embodiment, in the first processing mode and the second processing mode, the camera is controlled to collect visible light video images of the target water body to extract intuitive features of the target water body, and the near-infrared spectrometer is controlled to collect near-infrared video images of the target water body to extract thermal reflection features of the target water body, and water body portrait data is generated by combining the intuitive features and thermal reflection features.

[0055] Among them, the intuitive characteristics include one or a combination of water turbidity, water level changes, water color, floating objects in the water and weather conditions, and the weather conditions include one or a combination of temperature, humidity, wind speed and rainfall.

[0056] In this embodiment, the principle of near-infrared image monitoring based on thermal reflection characteristics is that an object will produce irregular movement of its own molecules and atoms under normal conditions and radiate thermal infrared energy. This energy radiates outward in the form of infrared rays, and the wavelength of infrared rays is between 0.76 and 100 μm. According to the wavelength range, it can be divided into four categories: near infrared, mid-infrared, far infrared, and extreme far infrared. When infrared radiation is irradiated onto the detector, the detector converts it into an electrical signal, which is then analyzed and processed. For near-infrared detection, it uses the spectral line characteristics such as vibration, rotation, and hydrogen bond stretching of material molecules to perform spectral technology for material analysis. Specifically, a near-infrared spectrometer measures the spectral reflection, transmission, or refraction of a sample in the near-infrared band, and then analyzes the spectral lines to determine the chemical composition, structural characteristics, physical properties, and other information in the sample. Near-infrared spectrometers can be used to measure various substances, including organic matter, inorganic matter, gas, liquid, etc., and can also detect the contour information of a variety of objects.

[0057] Among them, the thermal reflection characteristics refer to the different reflection characteristics of different substances in the target water body to the near-infrared light waves after the near-infrared spectrometer emits near-infrared light waves. By analyzing the near-infrared video images, the thermal reflection characteristics indicating different targets can be extracted from the near-infrared images.

[0058] In this embodiment, the historical data of the water body portrait and the historical water quality data of the target water body are input into the learning model for training to obtain a prediction model, and the water body portrait data collected in real time is input into the prediction model to predict the water quality change trend of the target water body.

[0059] Among them, the method of combining intuitive features and thermal reflection features in the first processing mode is different from that in the second processing mode.

[0060] The water quality data include one or a combination of dissolved oxygen, conductivity, permanganate index, total phosphorus, ammonia nitrogen, total nitrogen and chlorophyll. The change trend includes one or a combination of significantly rising, rising, stable, falling and significantly falling.

[0061] In this embodiment, water body features collected by machine vision are used to generate water body portrait data, which is input into the learning model together with historical water quality data for training to obtain a prediction model to predict the trend of water quality changes. Multi-parameter detection of water quality is achieved, and the mutual influence between water body features and water quality parameters and the influence of external environmental factors on water quality are associated, with more monitoring dimensions, more authenticity, and higher prediction accuracy.

[0062] Furthermore, the respective characteristics of visible light machine vision and near infrared machine vision can be brought into play to improve the image acquisition quality and monitoring accuracy. In this embodiment, different processing modes can be entered according to the imaging quality of the visible light image. In different processing modes, the methods of combining intuitive features and thermal reflection features are different. Therefore, the combination of visible light images and near infrared images can be adjusted more flexibly according to the specific conditions at different times and in different weather conditions to ensure the accuracy and reliability of the monitoring results.

[0063] In this embodiment, the method of combining the intuitive feature and the heat reflection feature in the first processing mode is different from the second processing mode, and includes:

[0064] like Figure 2 As shown, in the first processing mode, multiple frames of visible light images are intercepted from the visible light video image according to a preset time sequence, and after preprocessing each frame of the visible light image, the pixel information of the visible light image is calculated to identify multiple types of intuitive features. Multiple frames of near-infrared images are intercepted from the near-infrared video image according to a preset time sequence, and after preprocessing the near-infrared images, feature calculation is performed on the near-infrared images to extract the thermal reflection features of the target water body. The intuitive features and thermal reflection features are combined to generate water body portrait data.

[0065] Among them, preprocessing includes denoising, color correction and feature extraction. Through preprocessing, accurate classification state recognition can be obtained. Calculating the pixel information of visible light images to identify various types of intuitive features means that in a computer, the object imaging information is reflected by the pixel value of each pixel in the image. For example, for pixel point N with coordinates (X, Y), its pixel value is (R, G, B), and the value range of R, G, and B can all be 0-255. Using several mathematical statistics methods, the water turbidity, water level change, water color and other information of the target water body can be detected through the pixel value of each pixel in the image, and the contour information of floating objects in the target water body can be detected through the pixel value change law of each pixel.

[0066] like Figure 3 As shown, in the second processing mode, multiple frames of visible light images are intercepted from the visible light video image according to a preset time sequence, and after preprocessing each frame of the visible light image, the pixel information of the visible light image is calculated to identify the intuitive features of the non-floating object type and the first outline of the floating object. Multiple frames of near-infrared images are intercepted from the near-infrared video image according to a preset time sequence, and after preprocessing the near-infrared images, feature calculation is performed on the near-infrared images to extract the thermal reflection features of the target water body, and the second outline of the floating object is identified based on the thermal reflection features, and the second outline is superimposed on the first outline to form the outline of the floating object, and the intuitive features are updated. The updated intuitive features are merged with the thermal reflection features to generate water body portrait data.

[0067] In this embodiment, the learning model includes a group or combination of a random forest model, a support vector machine, a deep neural network, and a convolutional neural network. Taking the random forest model as an example, the process is as follows:

[0068] 1. Analysis through visual models

[0069] The machine vision system installed at the water station collects image data such as water turbidity, water level changes, water color, floating objects in the water, weather conditions, etc. The image data is preprocessed, including denoising, color correction, feature extraction, etc., to obtain accurate classification status recognition.

[0070] 2. Data Collection

[0071] Collect water quality monitoring data, including daily variation data of key water quality parameters such as dissolved oxygen, conductivity, permanganate index, total phosphorus, ammonia nitrogen, total nitrogen, and chlorophyll. Extract image features such as water turbidity, water level changes, water color, and floating objects in the water from the machine vision system of the water station and convert them into quantitative values. Collect weather condition data such as temperature, humidity, wind speed, rainfall, etc. and convert them into quantifiable values ​​or classification labels. Use yesterday's water quality data, image features, weather conditions, and meteorological forecast data as input features. Use the change trend of today's water quality parameters (dissolved oxygen, conductivity, etc.) (significantly increased, increased, stable, decreased, significantly decreased) as output labels. Select features that have an important impact on water quality situation prediction based on the importance and relevance of the data. Standardize or normalize the features to ensure that different features have the same scale in model training.

[0072] 3. Extract features

[0073] Use the random forest model for training. Random forest is an ensemble learning method that improves the accuracy and robustness of the model by building multiple decision trees and combining their prediction results. Input features (yesterday's water quality data, image features, weather conditions, etc.) and output labels (trends of water quality parameters) are input into the random forest model. The performance of the model is optimized by adjusting the parameters of the random forest (such as the number of trees, maximum depth, minimum number of samples, etc.).

[0074] 4. Prediction and result division

[0075] The trained random forest model is used in combination with current water quality image data, weather conditions and meteorological forecast data to predict the trend of future water quality parameters. The prediction results are divided into five levels: significant increase, increase, stable, decrease, and significant decrease. This can be achieved by setting a threshold or according to the probability distribution of the model output. Based on the prediction results, a water quality situation forecast report is generated, including the predicted trend of water quality parameters, warning information, and possible influencing factors.

[0076] In this implementation, the second outline is superimposed on the first outline to form the outline of the floating object, and the intuitive features are updated. The specific method includes:

[0077] For the pre-processed multiple frames of visible light images, respectively calculate the pixel information of each frame of the visible light image, and identify the intuitive features of the non-floating object type by calculating the average of a preset number of adjacent multiple frames of visible light images;

[0078] Calculating respectively the contour completeness of various floating objects in a preset number of adjacent multiple frames of visible light images, and identifying the first contour of various floating objects by using a frame of visible light image with the highest average contour completeness;

[0079] For a frame of visible light image with the highest mean value of contour integrity, a near-infrared image of the same time sequence is intercepted from the near-infrared video image, and after preprocessing the near-infrared image, feature calculation is performed on the near-infrared image to extract the thermal reflection feature of the target water body, and the second contour of the floating object is identified based on the thermal reflection feature;

[0080] Based on the resolution difference between the near-infrared image and the visible light image, the second outline of the floating object is resized according to a preset ratio and then mapped into the visible light image to enhance the image clarity of the first outline of the floating object.

[0081] Through the above-mentioned method, when the imaging quality of the visible light image is poor and the outline of the floating objects in the target water body is unclear, by superimposing the floating object image obtained based on the thermal reflection characteristics in the near-infrared image, the clarity of the floating object outline in the visible light image can be significantly enhanced, thereby improving the accuracy of floating object identification.

[0082] In this embodiment, the second contour of the floating object is identified based on the thermal reflection feature, and the specific method includes: identifying the contour of each floating object in the near-infrared image based on the thermal reflection feature, and performing contour integrity detection;

[0083] If the contour completeness exceeds a preset threshold, the contour of each floating object in the near-infrared image of the same time sequence is used as the second contour;

[0084] If the contour completeness does not exceed the preset threshold, multiple near-infrared images are respectively captured from the time series before and after the time series, the contour of each floating object in the near-infrared image is identified based on the thermal reflection feature, and the contour completeness detection is performed, and the contour of each floating object whose contour completeness exceeds the preset threshold is selected as the second contour.

[0085] In this embodiment, the contour of each floating object whose contour integrity exceeds a preset threshold is selected as the second contour, and the specific method includes:

[0086] Based on the outlines of each floating object in a plurality of near-infrared images of the time series before and after the time series, the total number of floating objects in the target water body is detected;

[0087] For each floating object, the contour completeness of the floating object in multiple near-infrared images is compared respectively, and the one with the highest contour completeness is selected as the second contour of the floating object. This cycle is repeated to obtain the second contours of all floating objects in the target water body.

[0088] By the above method, when the outline of the floating object in the near-infrared image of the same time sequence is not clear, the number of samples can be increased by intercepting multiple near-infrared images of similar time sequences, and the success rate of detecting and identifying the outline of the floating object in the near-infrared image is improved by identifying and settling multiple samples of similar time sequences. In addition, in addition to the traditional method of using each frame of image as a unit for selection or abandonment, the above method directly uses specific floating objects as the basis for selection or abandonment, such as the outline of floating object A comes from image 1, and the outline of floating object B comes from image 2. For floating objects, not only is the overall recognition success rate significantly improved, but when the outline of the floating object in the near-infrared image is superimposed on the visible light image, the clarity of the outline of the floating object is significantly increased, but the image of other substances other than the floating object in the visible light image has the lowest impact.

[0089] In this embodiment, the visible light video image acquisition method in the first processing mode is different from that in the second processing mode, and its specific method includes:

[0090] In the first processing mode, according to a preset lighting control method, the visible light source is controlled to perform lighting, and the camera is controlled to collect a visible light video image of the target water body;

[0091] In the second processing mode, the lighting control method is adjusted multiple times, and at least one frame of initial visible light image of the target water body is collected by the camera respectively. The image information of the preset marker is extracted from the initial visible light image and then compared with the preset template image. The lighting control method corresponding to the initial visible light image with the highest similarity is the optimal lighting control method. According to the optimal lighting control method, the visible light source is controlled to perform lighting, and the camera is controlled to collect the visible light video image of the target water body. Through the above method, when the real-time natural environment is not conducive to visible light imaging, the imaging quality of the visible light image can be increased by adjusting the lighting control method.

[0092] Example 2

[0093] like Figure 4 As shown, this embodiment provides a water quality monitoring and early warning system based on machine vision, which is used to execute the water quality monitoring and early warning method in the above-mentioned embodiment 1, including:

[0094] A visible light image acquisition module, used for acquiring visible light video images of target water bodies;

[0095] A near-infrared image acquisition module is used to acquire near-infrared video images of target water bodies;

[0096] A data processing module is used to extract intuitive features of a target water body through a visible light video image, and to extract thermal reflection features of a target water body through a near infrared video image, and to generate water body image data by combining the intuitive features and the thermal reflection features. The data processing module has a first processing mode and a second processing mode. The method of combining the intuitive features and the thermal reflection features in the first processing mode is different from that in the second processing mode.

[0097] The prediction module is used to input the historical data of the water body portrait and the historical water quality data of the target water body into the learning model for training to obtain a prediction model, and input the real-time collected water body portrait data into the prediction model to predict the water quality change trend of the target water body;

[0098] The comparison module is used to collect at least one frame of initial visible light image of the target water body through a camera, extract the image information of the preset marker from the initial visible light image and compare it with the preset template image. If the similarity meets the preset threshold, the first processing mode is entered, otherwise the second processing mode is entered.

[0099] Among them, Figure 5 As shown, the visible light image acquisition module includes a camera, and the camera includes a CCD camera or a CMOS camera. The camera can be configured with a visible light source, and the use of a visible light source for lighting can improve the image quality. Visible light images can be acquired through the lens and spectral information acquisition unit of the camera. The near-infrared image acquisition module includes a near-infrared light source, a filter, and an image acquisition unit. The signals acquired by the near-infrared image acquisition module and the visible light image acquisition module can be received by an integrated terminal device, and an MCU is provided in the terminal device for controlling the reception of signals. Among them, the data processing module, the prediction module, and the comparison module can be independent computer devices (CPU or GPU), or they can be integrated on the same computer device.

[0100] Example 3

[0101] An electronic device is also provided, comprising: a storage medium for storing a computer program and a processing unit; wherein the processing unit exchanges data with the storage medium, and is used to execute the computer program through the processing unit when predicting environmental events, and perform the steps of the environmental event auxiliary prediction method as described in specific example 1.

[0102] The CPU can perform various appropriate actions and processes according to the program stored in the storage medium. The electronic device also includes the following peripherals, including input parts such as a keyboard and a mouse, and may also include output parts such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; in particular, according to the embodiments of the present disclosure, Figure 1-Figure 5 Any of the processes described in can be implemented as a computer software program.

[0103] Example 4

[0104] A computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is run, the water quality monitoring and early warning method in the aforementioned embodiment 1 is executed.

[0105] A computer-readable storage medium: the computer-readable storage medium stores a computer program; when the computer program is run, the steps of the environmental event auxiliary prediction method as described in specific example 1 are executed.

[0106] In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, device or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0107] The above disclosures are only several specific implementation scenarios of the present disclosure, but the present disclosure is not limited thereto, and any changes that can be thought of by a person skilled in the art should fall within the protection scope of the present disclosure. The above disclosure serial numbers are only for description and do not represent the advantages and disadvantages of the implementation scenarios.

Claims

1. A water quality monitoring and early warning method based on machine vision, characterized in that: include: At least one frame of initial visible light image of the target water body is collected by a camera, image information of a preset marker is extracted from the initial visible light image, and then compared with a preset template image, and if the similarity meets a preset threshold, a first processing mode is entered, otherwise a second processing mode is entered; In the first processing mode and the second processing mode, the camera is controlled to collect visible light video images of the target water body to extract intuitive features of the target water body, and the near-infrared spectrometer is controlled to collect near-infrared video images of the target water body to extract thermal reflection features of the target water body, and the water body portrait data is generated by combining the intuitive features and the thermal reflection features; Inputting the historical data of the water body portrait and the historical water quality data of the target water body into a learning model for training to obtain a prediction model, and inputting the water body portrait data collected in real time into the prediction model to predict the water quality change trend of the target water body; Among them, the method of combining the intuitive feature and the thermal reflection feature in the first processing mode is different from that in the second processing mode.

2. The water quality monitoring and early warning method according to claim 1, characterized in that: The visual characteristics include one or a combination of water turbidity, water level change, water color, floating objects in the water and weather conditions, and the weather conditions include one or a combination of temperature, humidity, wind speed and rainfall; The water quality data includes one or a combination of dissolved oxygen, conductivity, permanganate index, total phosphorus, ammonia nitrogen, total nitrogen and chlorophyll; The change trend includes one or a combination of significantly rising, rising, stable, falling and significantly falling.

3. The water quality monitoring and early warning method according to claim 1 or 2, characterized in that: The method of combining the intuitive feature and the heat reflective feature in the first processing mode is different from the second processing mode, and includes: In the first processing mode, multiple frames of visible light images are intercepted from the visible light video image according to a preset time sequence, and after preprocessing each frame of the visible light image, pixel information of the visible light image is calculated to identify multiple types of the intuitive features; multiple frames of near-infrared images are intercepted from the near-infrared video image according to a preset time sequence, and after preprocessing the near-infrared images, feature calculation is performed on the near-infrared images to extract the thermal reflection features of the target water body; the intuitive features and the thermal reflection features are combined to generate water body portrait data; In the second processing mode, a plurality of frames of visible light images are captured from the visible light video image according to a preset time sequence, and after preprocessing each frame of the visible light image, pixel information of the visible light image is calculated to identify the intuitive features of the non-floating object type and the first outline of the floating object; a plurality of frames of near-infrared images are captured from the near-infrared video image according to a preset time sequence, and after preprocessing the near-infrared images, feature calculation is performed on the near-infrared images to extract the thermal reflection features of the target water body, and the second outline of the floating object is identified based on the thermal reflection features, the second outline is superimposed on the first outline to form the floating object outline, and the intuitive features are updated; the updated intuitive features are merged with the thermal reflection features to generate water body portrait data.

4. The water quality monitoring and early warning method according to claim 3 is characterized in that: The preprocessing includes denoising, color correction and feature extraction; The learning model includes a group or combination of a random forest model, a support vector machine, a deep neural network, and a convolutional neural network.

5. The water quality monitoring and early warning method according to claim 3 is characterized in that: The second contour is superimposed on the first contour to form a floating object contour, and the intuitive feature is updated, comprising: For the pre-processed multiple frames of the visible light image, respectively calculate the pixel information of each frame of the visible light image, and identify the intuitive features of the non-floating object type by calculating the average of a preset number of adjacent multiple frames of the visible light image; Calculating respectively the contour completeness of various floating objects in a preset number of adjacent frames of the visible light image, and identifying the first contour of various floating objects by using the frame of the visible light image with the highest average contour completeness; For the visible light image frame with the highest mean value of contour integrity, a near-infrared image of the same time sequence is intercepted from the near-infrared video image, the near-infrared image is preprocessed, and then feature calculation is performed on the near-infrared image to extract the thermal reflection feature of the target water body, and the second contour of the floating object is identified based on the thermal reflection feature; Based on the resolution difference between the near-infrared image and the visible light image, the second outline of the floating object is resized according to a preset ratio and then mapped into the visible light image to enhance the image clarity of the first outline of the floating object.

6. The water quality monitoring and early warning method according to claim 5, characterized in that: Identifying a second profile of the floating object based on the heat reflection feature includes: Identify the outline of each floating object in the near-infrared image based on the thermal reflection feature, and perform outline integrity detection; If the contour completeness exceeds a preset threshold, the contour of each floating object in the near-infrared image of the same time sequence is used as the second contour; If the contour completeness does not exceed the preset threshold, a plurality of the near-infrared images are respectively captured from the time series before and after the time series, the contour of each floating object in the near-infrared image is identified based on the thermal reflection feature, and contour completeness detection is performed, and the contour of each floating object whose contour completeness exceeds the preset threshold is selected as the second contour.

7. The water quality monitoring and early warning method according to claim 6 is characterized in that: Selecting the contour of each floating object whose contour completeness exceeds a preset threshold as the second contour includes: Detecting the total number of floating objects in the target water body based on the contours of each floating object in the plurality of near-infrared images in the preceding and following time series of the time series; For each floating object, the contour completeness of the floating object in the multiple near-infrared images is compared respectively, and the one with the highest contour completeness is selected as the second contour of the floating object. This cycle is repeated to obtain the second contours of all floating objects in the target water body.

8. The water quality monitoring and early warning method according to claim 1 is characterized in that: The visible light video image acquisition method in the first processing mode is different from the second processing mode and includes: In the first processing mode, according to a preset lighting control method, the visible light source is controlled to perform lighting, and the camera is controlled to collect a visible light video image of the target water body; In the second processing mode, the lighting control method is adjusted multiple times, and at least one frame of initial visible light image of the target water body is collected by the camera respectively. Image information of preset markers is extracted from the initial visible light image and then compared with the preset template image. The lighting control method corresponding to the initial visible light image with the highest similarity is the optimal lighting control method. According to the optimal lighting control method, the visible light source is controlled for lighting, and the camera is controlled to collect visible light video images of the target water body.

9. A water quality monitoring and early warning system based on machine vision, used to execute the water quality monitoring and early warning method according to any one of claims 1 to 8, characterized in that: include: A visible light image acquisition module, used for acquiring visible light video images of target water bodies; A near-infrared image acquisition module, used for acquiring near-infrared video images of the target water body; A data processing module, used for extracting the intuitive features of the target water body through the visible light video image, and extracting the thermal reflection features of the target water body through the near infrared video image, and combining the intuitive features and the thermal reflection features to generate water body portrait data, wherein the data processing module has a first processing mode and a second processing mode, and the method of combining the intuitive features and the thermal reflection features in the first processing mode is different from that in the second processing mode; A prediction module, used for inputting the historical data of the water body portrait and the historical water quality data of the target water body into a learning model for training to obtain a prediction model, and inputting the water body portrait data collected in real time into the prediction model to predict the water quality change trend of the target water body; A comparison module is used to collect at least one frame of initial visible light image of the target water body through a camera, extract image information of a preset marker from the initial visible light image and compare it with a preset template image. If the similarity meets a preset threshold, the first processing mode is entered, otherwise the second processing mode is entered.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is run, it executes the water quality monitoring and early warning method according to any one of claims 1 to 8.