Sewage discharge monitoring method and system based on image features
By acquiring the sewage surface image set at multiple time points, screening and calculating the possibility of seed points, and using the watershed segmentation algorithm to segment the oil film area, the problem of accuracy of sewage discharge monitoring under the influence of water surface fluctuations is solved, and the accuracy of the judgment of sewage pollution risks is improved. sex.
Patent Information
- Application Number
- CN202410534212.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-04-30
AI Technical Summary
Due to the high grayscale performance caused by water surface fluctuations, the existing sewage discharge monitoring methods are difficult to accurately segment the oil film area, which reduces the accuracy of sewage discharge monitoring.
By acquiring image sets of the same sewage outlet at multiple times, we screen suspected seed points, calculate the possibility of the seed points by combining the gray value and connected domain area of the seed points, and segment the oil film area through the watershed segmentation algorithm. Improve the accuracy of seed points.
It improves the segmentation accuracy of oil film areas, enhances the accuracy of judging the risk of sewage pollution, and reduces the possibility of non-oil film areas being misjudged as seed points.
Smart Images

Figure CN118115502B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a sewage discharge monitoring method and system based on image features. Background Art
[0002] With the acceleration of urbanization and the continuous improvement of industrialization, sewage discharge has become a major challenge for environmental protection and public health. Computer vision and image processing technology can realize the automatic and intelligent monitoring of sewage discharge through real-time and continuous monitoring and analysis of sewage outlets. Sewage often contains oil film due to the presence of grease, fat, solvents and other substances, which becomes an important source of pollution because it blocks oxygen and light from entering the water.
[0003] The oil film area on the sewage surface generally has a high grayscale with a reflective performance, and there are generally multiple oil film areas in the sewage surface image, so the watershed algorithm can be used to segment the oil film area. The segmentation effect of the watershed algorithm is affected by the seed point, and the seed point is generally determined directly based on the grayscale performance of the target area. However, the current sewage flow causes its surface to fluctuate, and the water surface fluctuation has a high grayscale performance similar to the target area in the image, so some seed points determined based on the grayscale performance may not be in the oil film area, thereby reducing the accuracy of sewage discharge monitoring. Summary of the invention
[0004] The present invention provides a sewage discharge monitoring method and system based on image features to solve the existing problems.
[0005] The sewage discharge monitoring method and system based on image features of the present invention adopt the following technical solutions:
[0006] An embodiment of the present invention provides a method for monitoring sewage discharge based on image features, the method comprising the following steps:
[0007] Acquire a sewage surface image set consisting of sewage surface images of the same sewage outlet at multiple different times;
[0008] Performing region growth on each pixel point in the sewage surface image to obtain the connected domain where each pixel point in the sewage surface image is located;
[0009] According to the gray value of the pixel points in the sewage surface image, the suspected seed points in the sewage surface image are screened out;
[0010] Selecting a sewage surface image from the sewage surface image set as the current image;
[0011] According to the area of the connected domain where each suspected seed point in the current image is located and the gray value of each suspected seed point, the possibility of each suspected seed point in the current image being a seed point is obtained;
[0012] According to the gray value of each pixel point in each sewage surface image and the area of the connected domain, the possibility that each suspected seed point in the current image is caused by water surface fluctuation is obtained;
[0013] According to the possibility of each suspected seed point in the current image being a seed point, the possibility of each suspected seed point in the current image being caused by water surface fluctuations, and the gray value of each pixel point in each sewage surface image, the possibility of each suspected seed point in the current image being a final seed point is obtained;
[0014] According to the possibility of each suspected seed point in the current image being used as the final seed point, the seed point in the current image is obtained;
[0015] Perform watershed segmentation according to the seed points in the current image to obtain the oil film area in the current image;
[0016] According to the oil film area in each sewage surface image, it is determined whether the sewage corresponding to each sewage surface image has a pollution risk.
[0017] Further, according to the gray value of the pixel points in the sewage surface image, the suspected seed points in the sewage surface image are screened out, and the specific steps included are as follows:
[0018] Preset grayscale threshold , the gray value of each sewage surface image is greater than The pixel point is recorded as the suspected seed point.
[0019] Further, according to the area of the connected domain where each suspected seed point in the current image is located and the gray value of each suspected seed point, the possibility of each suspected seed point in the current image being a seed point is obtained, and the specific steps included are as follows:
[0020] In the current image, horizontal right, horizontal left, vertical upward, and vertical downward are recorded as target directions;
[0021] The current image The specific calculation formula for the possibility of a suspected seed point being used as a seed point is:
[0022]
[0023] Where: Indicates the current image The possibility of using suspected seed points as seed points, Represents the gray value of the i-th suspected seed point in the current image, Indicates the area of the connected domain where the i-th suspected seed point is located in the current image. It represents the gray value of the vth pixel point traversed along the kth target direction starting from the i-th suspected seed point in the current image. represents the number of target directions, Indicates the preset number of pixels.
[0024] Further, according to the gray value of each pixel point in each sewage surface image and the area of the connected domain, the possibility that each suspected seed point in the current image is caused by water surface fluctuation is obtained, including the following specific steps:
[0025] Count the previous images with the closest shooting time to the current image other sewage surface images, according to the current image and the previous image The other sewage surface images constitute a set of adjacent images of the current image; is the preset number of images;
[0026] The current image The suspected seed points correspond to the pixel points in each adjacent image in the adjacent image set, which are recorded as target points;
[0027] In the adjacent image set, and The absolute value of the difference between the grayscale values of the target point in the adjacent images is recorded as the target point in the adjacent image set of the current image. Fluctuation of grayscale values of adjacent images;
[0028] In the adjacent image set, and The absolute value of the difference in the area of the connected domain where the target point is located in the adjacent images is recorded as the target point in the adjacent image set of the current image. The volatility of the connected domain in adjacent images;
[0029] According to the gray value fluctuation of each adjacent image of the target point in the adjacent image set of the current image and the fluctuation of the connected domain where the target point is located, the possibility that the target point in the current image is caused by water surface fluctuation is obtained.
[0030] Further, according to the gray value fluctuation of each adjacent image of the target point in the adjacent image set of the current image and the fluctuation of the connected domain, the possibility that the target point in the current image is caused by the water surface fluctuation is obtained, and the specific steps included are as follows:
[0031] Calculate the product of the gray value volatility of each adjacent image of the target point in the adjacent image set of the current image and the volatility of the connected domain where it is located, and record the sum of the products of the gray value volatility of all adjacent images of the target point in the adjacent image set of the current image and the volatility of the connected domain where it is located as the possibility that the target point in the current image is caused by water surface fluctuations.
[0032] Further, according to the possibility of each suspected seed point in the current image being used as a seed point, the possibility of each suspected seed point in the current image being caused by water surface fluctuations, and the gray value of each pixel point in each sewage surface image, the possibility of each suspected seed point in the current image being used as a final seed point is obtained, including the following specific steps:
[0033] The probability of setting the pixel points in each sewage surface image that are not suspected seed points as seed points to 0;
[0034] Set the current image and the adjacent images of the current image The absolute value of the difference between the probability of the target point in the uth adjacent image being used as a seed point, the reciprocal of the absolute value of the difference between the probability of the target point being used as a seed point plus 1 is recorded as the stable relationship of the probability of the target point being used as a seed point in the uth adjacent image set of the current image;
[0035] The average of all the suspected seed points in the connected domain where the target point is located in the current image is taken as the possibility of the seed point, which is recorded as the first mean;
[0036] The target point is located in the neighboring image set of the current image. The mean of all the suspected seed points in the connected domain of the adjacent images as the possibility of seed points is recorded as the second mean;
[0037] Calculate the absolute value of the difference between the first mean and the second mean , and then calculate the current image and the adjacent image set of the current image The absolute value of the difference in the number of suspected seed points in the connected domain where the target point in the adjacent images is located ,Will and The product of is recorded as the stable relationship between the connected domain where the target point is located in the current image and the connected domain in the u-th adjacent image in the adjacent image set of the current image, which contains the suspected seed point;
[0038] According to the stable relationship between the possibility of the target point being a seed point in each adjacent image in the adjacent image set of the current image and the stable relationship between the connected domain where the target point is located in the current image and the connected domain where the target point is located in each adjacent image in the adjacent image set of the current image contains suspected seed points, the possibility of the target point in the current image being the final seed point is obtained.
[0039] Further, according to the stable relationship between the possibility of the target point being a seed point in each adjacent image in the adjacent image set of the current image and the stable relationship between the connected domain where the target point is located in the current image and the connected domain where each adjacent image in the adjacent image set of the current image contains the suspected seed point, the possibility of the target point in the current image being the final seed point is obtained, including the specific formula as follows:
[0040]
[0041] in Indicates the possibility of the i-th suspected seed point in the current image being the final seed point, Represents the stable relationship of the possibility of the target point being a seed point in the u-th adjacent image in the adjacent image set of the current image, Indicates the stable relationship between the connected domain where the target point is located in the current image and the connected domain in the u-th adjacent image in the adjacent image set of the current image, which contains the suspected seed point. represents the sampling time interval between the current image and the uth adjacent image in the adjacent image set of the current image, Indicates the possibility of the i-th suspected seed point in the current image being used as a seed point, Indicates the possibility volatility of the i-th suspected seed point in the current image as a seed point, Indicates the number of images contained in the adjacent image set of the current image.
[0042] Further, according to the possibility of each suspected seed point in the current image being used as the final seed point, the seed point in the current image is obtained, including the following specific steps:
[0043] In the current image, all suspected seed points are clustered according to the possibility of each suspected seed point being the final seed point to obtain several clusters;
[0044] The average of the possibilities of all the suspected seed points in each cluster being the final seed points is calculated, and all the suspected seed points in the cluster having the largest average of the possibilities of all the suspected seed points being the final seed points are taken as seed points.
[0045] Further, according to the oil film area in each sewage surface image, it is judged whether the sewage corresponding to each sewage surface image has a pollution risk, including the following specific steps:
[0046] The number of pixels contained in the oil film region in the current image is recorded as the area of the oil film region;
[0047] According to the ratio of the oil film area to the current image area, the proportion of the oil film area is obtained;
[0048] Preset pollution threshold , if the proportion of the oil film area is less than , that is, it is determined that the sewage discharged in the current image does not have a pollution risk; if the proportion of the oil film area is greater than or equal to , that is, it is determined that the sewage discharged in the current image has a pollution risk.
[0049] The present invention also proposes a sewage discharge monitoring system based on image features, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned sewage discharge monitoring method based on image features.
[0050] The beneficial effects of the technical solution of the present invention are: obtaining a sewage surface image set consisting of sewage surface images of the same sewage outlet at multiple different times; performing regional growth on each pixel point in the sewage surface image to obtain a connected domain where each pixel point in the sewage surface image is located; screening out suspected seed points in the sewage surface image according to the grayscale value of the pixel points in the sewage surface image; obtaining the possibility of each suspected seed point in the current image being a seed point according to the area of the connected domain where each suspected seed point in the current image is located and the grayscale value of each suspected seed point, and when calculating the possibility of each suspected seed point in the current image being a seed point, not only the grayscale value of each pixel point is used, but also the grayscale values of the remaining pixels around each pixel point are used. , thereby reducing the possibility of pixels in non-oil film areas being used as seed points as much as possible; randomly select a sewage surface image in the sewage surface image set as the current image; according to the grayscale value of each pixel in each sewage surface image and the area of the connected domain in which it is located, obtain the possibility that each suspected seed point in the current image is caused by water surface fluctuations. When calculating the possibility that each suspected seed point in the current image is caused by water surface fluctuations, according to the situation of the pixel points corresponding to each suspected seed point in the current image on other sewage surfaces, the possibility that the suspected seed points in the oil film area of the current image are caused by water surface fluctuations is lower, and the possibility that the suspected seed points in the non-oil film area are caused by water surface fluctuations is lower; according to the possibility that each suspected seed point in the current image is used as a seed point The possibility of each suspected seed point in the current image being caused by water surface fluctuations and the grayscale value of each pixel in each sewage surface image are used to obtain the possibility of each suspected seed point in the current image being the final seed point. Because when calculating the possibility of each suspected seed point in the current image being the final seed point, not only the performance of each suspected seed point in the current image but also the performance of the pixel corresponding to each suspected seed point in the current image in other sewage surface images are used, so that the suspected seed point located in the oil film area in the current image is more likely to be the final seed point, while the suspected seed point located in the non-oil film area in the current image is less likely to be the final seed point; according to each suspected seed point in the current image The possibility of the point being the final seed point is used to obtain the seed point in the current image, because when obtaining the seed point in the current image, the possibility of each suspected seed point in the current image being the final seed point is used, thereby increasing the possibility that the seed point is located in the oil film area; watershed segmentation is performed according to the seed point in the current image to obtain the oil film area in the current image. When performing watershed segmentation, the possibility of the seed point being located in the oil film area is increased, thereby making the oil film area in the current image closer to the actual situation; according to the oil film area in each sewage surface image, it is judged whether the sewage corresponding to each sewage surface image has a pollution risk, because the oil film area in each sewage surface image is closer to the actual situation, thereby making the judgment result more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 The figure is a flowchart of the steps of the sewage discharge monitoring method based on image features of the present invention. DETAILED DESCRIPTION
[0053] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of the sewage discharge monitoring method and system based on image features proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0054] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0055] The specific scheme of the sewage discharge monitoring method and system based on image features provided by the present invention is described in detail below with reference to the accompanying drawings.
[0056] See also Figure 1 , which shows a flowchart of a method for monitoring sewage discharge based on image features according to an embodiment of the present invention, the method comprising the following steps:
[0057] Step S001, obtaining a sewage surface image set consisting of sewage surface images of the same sewage outlet at multiple different times; performing regional growth on each pixel point in the sewage surface image to obtain a connected domain where each pixel point in the sewage surface image is located; and screening out suspected seed points in the sewage surface image according to the grayscale value of the pixel point in the sewage surface image.
[0058] Sewage discharge detection mainly focuses on the detection of discharge outlets, so it is generally necessary to shoot the sewage surface image at the discharge outlet. At this time, a camera is installed just above the sewage discharge outlet, and then the shooting interval is set to obtain the original image, and the images of the same sewage discharge outlet at different times are obtained. The present invention sets the shooting interval to The shooting interval preset in this embodiment is , and this is used as an example for description. Other values may be set in other implementations, and this embodiment does not limit this. Grayscale processing is performed on all images obtained by shooting to obtain a sewage surface image set.
[0059] The oil film area on the sewage surface generally has a reflective appearance, so it has a higher grayscale appearance. There are generally multiple oil film areas in the sewage surface image, so the watershed algorithm can be used to segment the oil film area.
[0060] The segmentation effect of the watershed algorithm on the target area (oil film area) is greatly affected by the water injection seed point (hereinafter referred to as the seed point), so the position of the seed point needs to be determined first. Generally, the greater the possibility that a pixel point in the sewage surface image belongs to the oil film area, the greater the possibility that it is a seed point. The oil film area in the sewage surface image has a higher grayscale performance, so the higher the grayscale value of the pixel point, the greater the possibility that it is a seed point. Based on this, the threshold is set in each sewage surface image. Pixels with grayscale values greater than the threshold are called suspected seed points, and the seed points in each sewage surface image are obtained.
[0061] In this embodiment, the gray threshold is preset , and this is used as an example for description. Other values may be set in other implementations, and this embodiment does not limit this. It should be noted that the watershed algorithm is a well-known technology, and the specific method is not introduced here.
[0062] A pixel point is randomly selected from any sewage surface image in the sewage surface image set, and the pixel point is named as a regional pixel point. The connected domain where the regional pixel point is located is obtained as follows:
[0063] The regional pixel point is used as the starting point of regional growth, and the difference in gray value is used as As the growth condition, the connected domain where the regional pixels are located is obtained by the region growing algorithm. , other values may be set in other implementations, which are not limited in this embodiment. It should be noted that the region growing algorithm is a well-known technology and is not described in detail in this embodiment. The above operation is performed on each pixel point in each sewage surface image in the sewage surface image set to obtain a connected domain where each pixel point in each sewage surface image in the sewage surface image set is located.
[0064] Step S002, select any sewage surface image in the sewage surface image set as the current image; and obtain the possibility of each suspected seed point in the current image being a seed point according to the area of the connected domain where each suspected seed point in the current image is located and the grayscale value of each suspected seed point.
[0065] When selecting seed points in the watershed algorithm, all seed points are required to be located in the target area. However, in the sewage surface image, since the pixels in the water surface fluctuations also have high grayscale representation in the image, the high grayscale values are not necessarily the oil film area. That is, not all suspected seed points obtained in the above process are seed points. Therefore, it is necessary to calculate the possibility of each suspected seed point as a seed point.
[0066] The oil film in the sewage surface image has regional performance in the sewage surface image, so the pixels belonging to the oil film have a clustered performance in the sewage surface image, while the interference areas such as noise in the sewage surface image are mainly independent pixels, and the seed point generally selects the local maximum value, that is, the pixel point with the most oil film characteristic performance in the adjacent position. At this time, the area size of the suspected seed point and its local relationship can be used to reflect its possibility as a seed point.
[0067] Select any one of the sewage surface images as the current image.
[0068] The current image The larger the area of the connected domain where the suspected seed point is located, the greater the possibility that the suspected seed point is located in the oil film area; The greater the possibility that the gray value of a suspected seed point belongs to the local maximum, the greater the possibility that it is a seed point.
[0069] In this embodiment, in the current image, horizontal right, horizontal left, vertical upward, and vertical downward are used as target directions, and this is used as an example for description. In other implementations, the target direction can be set to other directions, which is not limited in this embodiment.
[0070] Based on this, determine the The possibility of using suspected seed points as seed points:
[0071]
[0072] Where: Indicates the current image The possibility of using suspected seed points as seed points, Represents the gray value of the i-th suspected seed point in the current image, Indicates the area of the connected domain where the i-th suspected seed point is located in the current image. The area is the number of pixels in the connected domain. It represents the gray value of the vth pixel point traversed along the kth target direction starting from the i-th suspected seed point in the current image. represents the grayscale difference between the grayscale value of the i-th suspected seed point in the current image and the grayscale value of the v-th pixel point adjacent to it in the k-th direction, represents the number of target directions, where Indicates the 1st, 2nd to target direction, Indicates that the gray value of the i-th suspected seed point in the current image belongs to the local maximum. Indicates the preset number of pixels. , this is used as an example for description, and other values may be set in other implementation modes, and this embodiment does not limit this.
[0073] Step S003: According to the gray value of each pixel point in each sewage surface image and the area of the connected domain, the possibility that each suspected seed point in the current image is caused by water surface fluctuation is obtained.
[0074] The above process mainly reflects the possibility of the suspected seed point as a seed point by the grayscale expression characteristics of the connected domain where the seed point is located. However, in the current sewage, since the sewage is flowing, the water flow fluctuations on the water surface will also form a high grayscale expression area, which will cause the seed point directly reflected by the above characteristics to show the reflection of the water surface fluctuations, which will lead to inaccurate position of the seed point.
[0075] The possibility of fluctuation at each position in the current image can be directly reflected by the fluctuation performance of the pixel points in the images at multiple different times. The greater the grayscale change of the pixel point at the same position in the images at multiple adjacent times, the greater the possibility of water surface fluctuation at the current position, and the reflective area formed by the water surface fluctuation changes irregularly. Therefore, the greater the size change of the connected domain of the pixel point at the same position in the images at multiple adjacent times, the greater the possibility of water surface fluctuation at the current position.
[0076] Count the previous images with the closest shooting time to the current image other sewage surface images, according to the current image and the previous image The other sewage surface images constitute a set of adjacent images of the current image; is the preset number of images. The example is used for description. Other values may be set in other embodiments, and this embodiment does not specifically limit it. Determine the gray value stability of the same pixel in the image at adjacent times and the volatility of the connected domain in which it is located in the adjacent image set of the current image. In the adjacent image set of the current image, the gray value stability of the same pixel in the image at adjacent times and the volatility of the connected domain in which it is located are determined. The suspected seed points correspond to the pixel points in all adjacent images, which are recorded as target points. The gray value fluctuation of adjacent images is , ,in , They represent the first and The grayscale value of the target point in the adjacent image set of the current image. The volatility of the connected domain in adjacent images is , ,in They represent the first and The area of the connected domain in the adjacent images.
[0077] It should be noted that the gray value fluctuation of the last image in the adjacent image set and the fluctuation of the connected domain in which it is located are equal to the gray value fluctuation of the penultimate image and the fluctuation of the connected domain in which it is located.
[0078] Furthermore, the probability that the i-th suspected seed point in the current image is caused by water surface fluctuation is determined as :
[0079]
[0080] in Indicates the possibility that the i-th suspected seed point in the current image is caused by water surface fluctuations, Indicates the first position of the target point in the adjacent image set of the current image. The gray value fluctuation of adjacent images, Indicates the target point is the first one in the adjacent image set of the current image. The volatility of the connected domain in adjacent images, That is, the gray value reflected by the target point in the adjacent image set of the current image and the volatility of the connected domain where it is located, that is, the possibility that the i-th suspected seed point in the current image is caused by water surface fluctuations. Indicates the number of images contained in the adjacent image set of the current image.
[0081] Step S004, based on the possibility of each suspected seed point in the current image being a seed point, the possibility of each suspected seed point in the current image being caused by water surface fluctuations, and the grayscale value of each pixel point in each sewage surface image, obtain the possibility of each suspected seed point in the current image being a final seed point.
[0082] Because the oil film on the sewage surface is formed by the adhesion between the oil films, the surface oil film is generally relatively stable, so the position of the oil film area in multiple adjacent images and the oil film performance are stable, that is, the possibility of obtaining the suspected seed point as a seed point in the above analysis is similar to the oil film area in the adjacent image of the current image. Based on this, the final possibility of the suspected seed point as a seed point can be further analyzed.
[0083] First, in the above process, the greater the possibility that the target point is used as a seed point in the uth adjacent image in the adjacent image set of the current image, the greater the possibility that the i-th suspected seed point in the current image is used as a seed point in the current image. The stable relationship of the i-th suspected seed point in the current image is manifested as a stable relationship of the possibility of the suspected seed point and a stable relationship that the suspected seed point forming area contains the suspected seed point.
[0084] The greater the possibility that the target point is used as a seed point in the uth adjacent image in the adjacent image set of the current image, the greater the possibility that the i-th suspected seed point in the current image is used as the final seed point in the current image. The stable relationship of the i-th suspected seed point is manifested as a stable relationship of seed point possibility and a stable relationship that the suspected seed point forming area contains the suspected seed point.
[0085] The probability that the target point is used as a seed point in the uth adjacent image in the adjacent image set of the current image is equal to the probability that the target point is used as a seed point in the uth adjacent image in the current image. The smaller the difference in the likelihood of the i-th suspected seed point being a seed point, the more stable the likelihood of the i-th suspected seed point being a seed point, thereby obtaining a stable relationship of the likelihood of the target point being a seed point in the u-th adjacent image in the adjacent image set of the current image. ,in Indicates the current image The possibility of using suspected seed points as seed points, Indicates the possibility that the target point is used as a seed point in the uth adjacent image in the adjacent image set of the current image. The target point represents the uth adjacent image in the current image. The suspected seed points correspond to the pixel points in all adjacent images. If the target point is not a suspected seed point in the uth adjacent image in the adjacent image set of the current image, let The reason for adding 1 to the denominator is to prevent the denominator from being equal to 0.
[0086] Furthermore, the greater the difference between the number of suspected seed points contained in the connected domain where the target point is located in the current image and the number of suspected seed points contained in the connected domain in the u-th adjacent image in the adjacent image set of the current image, the smaller the stable relationship that the suspected seed point forming area contains the suspected seed point, and the smaller the possibility that the target point is used as a seed point in the current image. At this time, the stable relationship between the connected domain where the target point is located in the current image and the connected domain in the u-th adjacent image in the adjacent image set of the current image containing the suspected seed point is obtained as follows: : ,in Indicates the number of suspected seed points contained in the connected domain where the target point is located in the current image. Indicates the number of suspected seed points contained in the connected domain of the target point in the u-th adjacent image of the current image's adjacent image set. It represents the mean of all the suspected seed points in the connected domain where the target point is located in the current image as the seed point and the probability of the target point in the adjacent image set of the current image. The target point represents the absolute value of the difference between the mean values of all suspected seed points in the connected domain in the adjacent images as the possibility of seed points. The suspected seed points correspond to pixels in all adjacent images.
[0087] Combined with the stability of the above-mentioned suspected seed points, determine the possibility of the i-th suspected seed point in the current image as the final seed point. The greater the volatility of the pixel point where the i-th suspected seed point in the current image is located, the smaller the possibility of it being the final seed point; the higher the stability of the possibility of the target point as a seed point reflected in the u-th adjacent image in the adjacent image set of the current image, the greater the possibility of the i-th suspected seed point in the current image as a seed point, and the greater the sampling time interval between the u-th adjacent image in the adjacent image set of the current image and the current image, the more reliable the stability of the target point obtained based on the u-th adjacent image in the adjacent image set of the current image as a seed point. Based on this, the possibility of the i-th suspected seed point in the current image being the final seed point is determined as follows:
[0088]
[0089] in Indicates the possibility of the i-th suspected seed point in the current image being the final seed point, Represents the stable relationship of the possibility of the target point being a seed point in the u-th adjacent image in the adjacent image set of the current image, Indicates the stable relationship between the connected domain where the target point is located in the current image and the connected domain in the u-th adjacent image in the adjacent image set of the current image, which contains the suspected seed point. represents the sampling time interval between the current image and the uth adjacent image in the adjacent image set of the current image, , They represent the possibility and volatility of the i-th suspected seed point in the current image as a seed point, and the target point represents the i-th suspected seed point in the current image. The suspected seed points correspond to the pixels in all adjacent images. It is necessary to explain that when the uth adjacent image in the adjacent image set of the current image is the current image, in order to prevent the denominator from being 0, let is 1.
[0090] At this point, the possibility of all suspected seed points being used as final seed points is obtained.
[0091] Step S005, according to the possibility of each suspected seed point in the current image as the final seed point, obtain the seed point in the current image; perform watershed segmentation according to the seed point in the current image to obtain the oil film area in the current image; according to the oil film area in each sewage surface image, determine whether the sewage corresponding to each sewage surface image has a pollution risk.
[0092] Furthermore, the watershed seed points are obtained by using the possibility of the suspected seed points obtained above as the final seed points. The acquisition steps are as follows: first, all suspected seed points are clustered according to the possibility of each suspected seed point as the final seed point. The clustering algorithm adopts the K-means clustering algorithm, and K=2 is set to cluster all suspected seed points into 2 categories to obtain two clusters. The mean of the possibility of all suspected seed points in each cluster as the final seed points is calculated, and all suspected seed points in the cluster with the largest mean of the possibility of all suspected seed points as the final seed points are used as seed points.
[0093] K-means clustering algorithm is also called K-means clustering algorithm, K is an important parameter in the algorithm, K-means clustering algorithm is a well-known technology, and the specific method is not introduced here. Further, the current image is segmented using the watershed algorithm to obtain the total oil film area of the image. The existing technology of the watershed algorithm is not repeated here.
[0094] Then, based on the obtained oil film area, the current wastewater pollution risk is determined. The specific steps are as follows:
[0095] First, the area of the oil film area is obtained according to the number of pixels contained in the oil film area; then the proportion of the oil film area is obtained according to the ratio of the area of the oil film area to the area of the current image; finally, the pollution threshold is preset , if the proportion of the oil film area is less than , that is, it is judged that the current wastewater discharge does not have a pollution risk; if the proportion of the oil film area is greater than or equal to , that is, judging that the current discharged sewage has a pollution risk. In this embodiment, the preset pollution threshold , can be set to other values in other implementations and is not limited in this embodiment.
[0096] The present invention also provides a sewage discharge monitoring system based on image features, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned sewage discharge monitoring method based on image features.
[0097] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A sewage discharge monitoring method based on image features, characterized in that: The method comprises the following steps: Acquire a sewage surface image set consisting of sewage surface images of the same sewage outlet at multiple different times; Performing region growth on each pixel point in the sewage surface image to obtain the connected domain where each pixel point in the sewage surface image is located; According to the gray value of the pixel points in the sewage surface image, the suspected seed points in the sewage surface image are screened out; Selecting a sewage surface image from the sewage surface image set as the current image; According to the area of the connected domain where each suspected seed point in the current image is located and the gray value of each suspected seed point, the possibility of each suspected seed point in the current image being a seed point is obtained; According to the gray value of each pixel point in each sewage surface image and the area of the connected domain, the possibility that each suspected seed point in the current image is caused by water surface fluctuation is obtained; According to the possibility of each suspected seed point in the current image being a seed point, the possibility of each suspected seed point in the current image being caused by water surface fluctuations, and the gray value of each pixel point in each sewage surface image, the possibility of each suspected seed point in the current image being a final seed point is obtained; According to the possibility of each suspected seed point in the current image being used as the final seed point, the seed point in the current image is obtained; Perform watershed segmentation according to the seed points in the current image to obtain the oil film area in the current image; According to the oil film area in each sewage surface image, it is determined whether the sewage corresponding to each sewage surface image has a pollution risk; The method of obtaining the possibility of each suspected seed point in the current image being a seed point according to the area of the connected domain where each suspected seed point in the current image is located and the gray value of each suspected seed point includes the following specific steps: In the current image, horizontal right, horizontal left, vertical upward, and vertical downward are recorded as target directions; The current image The specific calculation formula for the possibility of a suspected seed point being used as a seed point is: Where: Indicates the current image The possibility of using suspected seed points as seed points, Represents the gray value of the i-th suspected seed point in the current image, Indicates the area of the connected domain where the i-th suspected seed point is located in the current image. It represents the gray value of the vth pixel point traversed along the kth target direction starting from the i-th suspected seed point in the current image. represents the number of target directions, Indicates the preset number of pixels; The method of obtaining the possibility that each suspected seed point in the current image is caused by water surface fluctuations according to the gray value of each pixel point in each sewage surface image and the area of the connected domain in which it is located includes the following specific steps: Count the previous images with the closest shooting time to the current image other sewage surface images, according to the current image and the previous image The other sewage surface images constitute a set of adjacent images of the current image; is the preset number of images; The current image The suspected seed points correspond to the pixel points in each adjacent image in the adjacent image set, which are recorded as target points; In the adjacent image set, and The absolute value of the difference between the grayscale values of the target point in the adjacent images is recorded as the target point in the adjacent image set of the current image. Fluctuation of grayscale values of adjacent images; In the adjacent image set, and The absolute value of the difference in the area of the connected domain where the target point is located in the adjacent images is recorded as the target point in the adjacent image set of the current image. The volatility of the connected domain in adjacent images; According to the gray value fluctuation of each adjacent image of the target point in the adjacent image set of the current image and the fluctuation of the connected domain where the target point is located, the possibility that the target point in the current image is caused by water surface fluctuation is obtained.
2. The method for monitoring sewage discharge based on image features according to claim 1 is characterized in that: The specific steps of screening out suspected seed points in the sewage surface image according to the grayscale values of the pixels in the sewage surface image are as follows: Preset grayscale threshold , the gray value of each sewage surface image is greater than The pixel point is recorded as the suspected seed point.
3. The sewage discharge monitoring method based on image features according to claim 1 is characterized in that: The method of obtaining the possibility that the target point in the current image is caused by water surface fluctuations according to the gray value fluctuations of each adjacent image of the target point in the adjacent image set of the current image and the fluctuations of the connected domain in which the target point is located includes the following specific steps: Calculate the product of the gray value volatility of each adjacent image of the target point in the adjacent image set of the current image and the volatility of the connected domain where it is located, and record the sum of the products of the gray value volatility of all adjacent images of the target point in the adjacent image set of the current image and the volatility of the connected domain where it is located as the possibility that the target point in the current image is caused by water surface fluctuations.
4. The method for monitoring sewage discharge based on image features according to claim 1, characterized in that: The method of obtaining the possibility of each suspected seed point in the current image being a seed point, the possibility of each suspected seed point in the current image being caused by water surface fluctuations, and the gray value of each pixel in each sewage surface image, comprises the following specific steps: The probability of setting the pixel points in each sewage surface image that are not suspected seed points as seed points to 0; Set the current image and the adjacent images of the current image The absolute value of the difference between the probability of the target point in the uth adjacent image being used as a seed point, the reciprocal of the absolute value of the difference between the probability of the target point being used as a seed point plus 1 is recorded as the stable relationship of the probability of the target point being used as a seed point in the uth adjacent image set of the current image; The average of all the suspected seed points in the connected domain where the target point is located in the current image is taken as the possibility of the seed point, which is recorded as the first mean; The target point is located in the neighboring image set of the current image. The mean of all the suspected seed points in the connected domain of the adjacent images as the possibility of seed points is recorded as the second mean; Calculate the absolute value of the difference between the first mean and the second mean , and then calculate the current image and the adjacent image set of the current image The absolute value of the difference in the number of suspected seed points in the connected domain where the target point in the adjacent images is located ,Will and The product of is recorded as the stable relationship between the connected domain where the target point is located in the current image and the connected domain in the u-th adjacent image in the adjacent image set of the current image, which contains the suspected seed point; According to the stable relationship between the possibility of the target point being a seed point in each adjacent image in the adjacent image set of the current image and the stable relationship between the connected domain where the target point is located in the current image and the connected domain where the target point is located in each adjacent image in the adjacent image set of the current image contains suspected seed points, the possibility of the target point in the current image being the final seed point is obtained.
5. The method for monitoring sewage discharge based on image features according to claim 4 is characterized in that: The possibility of the target point in the current image being the final seed point is obtained according to the stable relationship between the possibility of the target point being the seed point in each adjacent image in the adjacent image set of the current image and the stable relationship between the connected domain where the target point is located in the current image and the connected domain where each adjacent image in the adjacent image set of the current image contains the suspected seed point, and the specific formula included is as follows: in Indicates the possibility of the i-th suspected seed point in the current image being the final seed point, Represents the stable relationship of the possibility of the target point being a seed point in the u-th adjacent image in the adjacent image set of the current image, Indicates the stable relationship between the connected domain where the target point is located in the current image and the connected domain in the u-th adjacent image in the adjacent image set of the current image, which contains the suspected seed point. represents the sampling time interval between the current image and the uth adjacent image in the adjacent image set of the current image, Indicates the possibility of the i-th suspected seed point in the current image being used as a seed point, Indicates the possibility volatility of the i-th suspected seed point in the current image as a seed point, Indicates the number of images contained in the adjacent image set of the current image.
6. The method for monitoring sewage discharge based on image features according to claim 1, characterized in that: The step of obtaining the seed point in the current image according to the possibility of each suspected seed point in the current image being used as the final seed point includes the following specific steps: In the current image, all suspected seed points are clustered according to the possibility of each suspected seed point being the final seed point to obtain several clusters; The average of the possibilities of all the suspected seed points in each cluster being the final seed points is calculated, and all the suspected seed points in the cluster having the largest average of the possibilities of all the suspected seed points being the final seed points are taken as seed points.
7. The method for monitoring sewage discharge based on image features according to claim 1, characterized in that: The specific steps of judging whether the sewage corresponding to each sewage surface image has a pollution risk according to the oil film area in each sewage surface image are as follows: The number of pixels contained in the oil film region in the current image is recorded as the area of the oil film region; According to the ratio of the oil film area to the current image area, the proportion of the oil film area is obtained; Preset pollution threshold , if the proportion of the oil film area is less than , that is, it is determined that the sewage discharged in the current image does not have a pollution risk; if the proportion of the oil film area is greater than or equal to , that is, it is determined that the sewage discharged in the current image has a pollution risk.
8. A sewage discharge monitoring system based on image features, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of the sewage discharge monitoring method based on image features as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Sewage discharge monitoring method and system based on image features
CN122929495A
